forked from antmicro/renode-linux-runner-action
-
Notifications
You must be signed in to change notification settings - Fork 1
271 lines (237 loc) · 7.16 KB
/
release.yml
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
name: Release
on: [push, workflow_dispatch, repository_dispatch]
permissions: write-all
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
build: ${{ steps.build-needed.outputs.build }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.ref_name }}
filters: |
build:
- 'image/**'
- 'kernel/**'
- 'scripts/compile-kernel.sh'
- 'scripts/compile-image.sh'
- name: check if release exists
id: check-release
run: |
# gh release view returns non-zero if no such release exists
echo "build=$(gh release view ${{ github.ref_name }} &> /dev/null && echo $? || echo $?)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: check if build is needed
id: build-needed
run: |
# Step outputs apparently are strings, so we have to compare against literals to avoid silly JS type coercion issues.
echo "build=${{ steps.filter.outputs.build == 'true' || steps.check-release.outputs.build != '0' }}" >> $GITHUB_OUTPUT
build-kernel:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.build == 'true' && !github.event.act }}
strategy:
fail-fast: false
matrix:
arch: [riscv64, arm32]
include:
- arch: riscv64
board: hifive_unleashed
- arch: arm32
board: zynq_7000
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.buildroot-ccache
key: ${{ github.ref }}
- name: build kernel
run: scripts/compile-kernel.sh ${{ matrix.arch }} ${{ matrix.board }}
- name: upload artifacts
if: success()
uses: actions/upload-artifact@v3
with:
path: images/
build-image:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.build == 'true' && !github.event.act }}
strategy:
fail-fast: false
matrix:
arch: [riscv64, arm32]
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.buildroot-ccache
key: ${{ github.ref }}
- name: build images
run: scripts/compile-image.sh ${{ matrix.arch }} ${{ matrix.name }}
- name: upload artifacts
if: success()
uses: actions/upload-artifact@v3
with:
path: images/
send-to-releases:
runs-on: ubuntu-latest
needs: [build-kernel, build-image]
if: ${{ needs.changes.outputs.build == 'true' && !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: ./
- name: send to releases
uses: svenstaro/upload-release-action@v2
with:
repo_token: "${{ github.token }}"
tag: ${{ github.ref_name }}
file: artifact/*
file_glob: true
overwrite: true
riscv64-test:
runs-on: ubuntu-latest
needs: send-to-releases
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3
- name: test
uses: ./
with:
shared-dirs: tests
renode-run: |
wget example.org
sh gpio.sh
sh i2c.sh
python pyrav4l2/.github/save_examples.py pyrav4l2/README.md
python examples/controls-enumeration.py
devices: |
vivid:
gpio:
left-bound: 0
right-bound: 16
i2c:
chip-addr: 0x1C
python-packages: |
git+https://github.com/antmicro/pyrav4l2.git@3c071a7494b6b67263c4dddb87b47025338fd960
git+https://github.com/antmicro/tuttest.git@c44309e0365c54759fb36864fb77bf8b347bd647
repos: https://github.com/antmicro/pyrav4l2.git pyrav4l2
riscv64-shared-dirs-test:
runs-on: ubuntu-latest
needs: send-to-releases
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3
- name: prepare shared dirs
run: |
mkdir shared_dir shared_dir2
- name: test
uses: ./
with:
shared-dirs: |
shared_dir /home/shared_dir
shared_dir2 /home/shared_dir2
renode-run: |
echo "shared-dirs-test" > shared_dir/f.txt
echo "shared-dirs-test2" > shared_dir2/f.txt
- name: read shared_dirs
run: |
ls shared_dir
cat shared_dir/f.txt
ls shared_dir2
cat shared_dir2/f.txt
arm32-test:
runs-on: ubuntu-latest
needs: send-to-releases
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3
- name: test
uses: ./
with:
arch: arm32
shared-dirs: tests
renode-run: |
wget example.org
sh gpio.sh
sh i2c.sh
python pyrav4l2/.github/save_examples.py pyrav4l2/README.md
python examples/controls-enumeration.py
devices: |
vivid
gpio 0 16
i2c 0x1C
python-packages: |
git+https://github.com/antmicro/pyrav4l2.git@3c071a7494b6b67263c4dddb87b47025338fd960
git+https://github.com/antmicro/tuttest.git@c44309e0365c54759fb36864fb77bf8b347bd647
repos: https://github.com/antmicro/pyrav4l2.git pyrav4l2
riscv64-docker-test:
runs-on: ubuntu-latest
needs: send-to-releases
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3
- name: test
uses: ./
with:
arch: riscv64
image-type: docker
image: riscv64/debian:experimental
shared-dirs: tests
renode-run: |
ls /dev | grep video
bash bash_test.sh
devices: vivid
arm32-docker-test:
runs-on: ubuntu-latest
needs: send-to-releases
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3
- name: test
uses: ./
with:
arch: arm32
image-type: docker
image: arm32v7/ubuntu
shared-dirs: tests
renode-run: |
ls /dev | grep video
bash bash_test.sh
uname -a
cat /etc/os-release
devices: vivid
should-fail-test:
runs-on: ubuntu-latest
needs: send-to-releases
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3
- name: test
uses: ./
with:
network: false
renode-run: |
should-fail: true
commands:
- "wget example.org"
custom-task-test:
runs-on: ubuntu-latest
needs: send-to-releases
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3
- name: test
uses: ./
with:
shared-dirs: tests
tasks: |
tests/python_exists_image.yml
tests/python_exists_initramfs.yml