-
Notifications
You must be signed in to change notification settings - Fork 0
219 lines (180 loc) · 6.39 KB
/
Copy pathfunction_ci.yml
File metadata and controls
219 lines (180 loc) · 6.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# MIT License
#
# Copyright (c) 2022 EASE lab, University of Edinburgh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: David Schall
name: Function CI for gem5 Simulator
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: "0 7 * * 1"
push:
branches: [main]
paths:
- "test/**"
- "gem5utils/**"
pull_request:
branches: [main]
paths:
- "test/**"
- "gem5utils/**"
env:
WORKING_DIR: wkdir/test/
MAKEFILE: test/Makefile
ARTIFACTS_DIR: artifacts/
KERNEL: artifacts/kernel
DISK: artifacts/disk-image.qcow2
DISK2: artifacts/disk.qcow2
CLIENT: artifacts/test-client
jobs:
### We want to use the cache from the build stage
## Check if the cache exist otherwise download it from the artifacts
prepare-artifacts:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Use the cache from the build workflow
id: build-artifacts
uses: actions/cache@v4
with:
path: artifacts/
key: ${{ runner.os }}-${{ github.sha }}-func-ci-base
- name: Download latest kernel
if: steps.build-artifacts.outputs.cache-hit != 'true'
uses: dawidd6/action-download-artifact@v6
with:
workflow: build_kernel.yml
name: vmlinux-amd64
path: tmp
- name: Download latest test client
if: steps.build-artifacts.outputs.cache-hit != 'true'
uses: dawidd6/action-download-artifact@v6
with:
workflow: test_client.yml
name: test-client
path: tmp
- name: Download latest base image
if: steps.build-artifacts.outputs.cache-hit != 'true'
uses: dawidd6/action-download-artifact@v6
with:
workflow: create_base_image.yml
name: disk-image-amd64
# workflow_conclusion: success
run_id: 2477855216
path: disktmp
- name: Copy Artifacts
if: steps.build-artifacts.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.ARTIFACTS_DIR }}
cp tmp/kernel ${{ env.KERNEL }}
cp tmp/test-client ${{ env.CLIENT }}
./resources/artifacts.sh decompress-split disktmp/disk-image.qcow2
cp temp/disk-image.qcow2 ${{ env.DISK }}
emulator-function-test:
name: Test functions on emulator
# For running the qe
# runs-on: ubuntu-20.04
runs-on: [self-hosted, gem5-test]
needs: prepare-artifacts
outputs:
function_matrix: ${{ steps.set-matrix.outputs.function_matrix }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Functions for testing
id: set-matrix
shell: bash
run: |
FUTS=$(cat .github/configs/functions-under-test.txt)
FUTS=${FUTS//$'\n'/ }
echo "$FUTS"
matrix=$(printf '%s\n' $(cat .github/configs/functions-under-test.txt) | jq -ncR [inputs])
echo $matrix
echo "FUNCTIONS_UNDER_TEST=$FUTS" >> $GITHUB_ENV
echo "::set-output name=function_matrix::$matrix"
## Use the artifact cache from the build stage
- name: Cache Build Artifacts
uses: actions/cache@v4
with:
path: artifacts/
key: ${{ runner.os }}-${{ github.sha }}-func-ci-base
##### Setup Test #####
# - name: Install dependencies
# run: |
# make -f ${{ env.MAKEFILE }} dep_install
- name: Install dependencies
run: |
make -f ${{ env.MAKEFILE }} dep_check_qemu
- name: Create the working directory to run the test.
env:
KERNEL: ${{ env.KERNEL }}
DISK: ${{ env.DISK }}
TEST_CLIENT: ${{ env.CLIENT }}
run: |
make -f ${{ env.MAKEFILE }} build
- name: Run the actual test of the emulator.
timeout-minutes: 30
run: |
make -f ${{ env.MAKEFILE }} run_emu_test
- name: Check the results file.
run: |
make -f ${{ env.MAKEFILE }} check_emu
## Once the Test completed successfully
## cache the working directory for the later simulator test jobs
- name: Cache test disk image
id: wkdir-cache
uses: actions/cache@v4
with:
path: ${{ env.WORKING_DIR }}
key: ${{ runner.os }}-${{ github.run_number }}-func-ci-test
simulator-function-test:
name: Test function on Simulator
# For running the qe
runs-on: [self-hosted, gem5-test]
needs: emulator-function-test
strategy:
fail-fast: false
max-parallel: 7
matrix:
function: ${{ fromJson(needs.emulator-function-test.outputs.function_matrix) }}
env:
FUNCTION: ${{ matrix.function }}
steps:
- name: Check out code
uses: actions/checkout@v4
## Use the artifact cache from the build stage
- name: Cache Build Artifacts
uses: actions/cache@v4
with:
path: ${{ env.WORKING_DIR }}
key: ${{ runner.os }}-${{ github.run_number }}-func-ci-test
- name: Check dependencies of the simulator.
run: |
make -f ${{ env.MAKEFILE }} dep_check_gem5
- name: Run the actual test of the simulator.
timeout-minutes: 10
run: |
make -f ${{ env.MAKEFILE }} run_sim_test
- name: Check the results file.
run: |
make -f ${{ env.MAKEFILE }} check_sim