-
Notifications
You must be signed in to change notification settings - Fork 41
227 lines (193 loc) · 6.13 KB
/
run-tests.yaml
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
name: Run tests
on: [pull_request]
env:
ZEPHYR_SDK_VERSION: 0.16.0
ZEPHYR_REV: zephyr-v3.4.0
jobs:
merge-test-1:
runs-on: ubuntu-22.04
strategy:
matrix:
platform: ["native_posix", "native_posix_64", "mps2_an521"]
asserts: ["", "-x VERBOSE=ON -x ASSERTS=ON"]
name: Merge tests 1 (${{ matrix.platform }}${{ matrix.asserts != '' && ' with asserts' || '' }})
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Install zcbor
uses: ./.github/actions/install_zcbor
- name: Prepare and run tests
uses: ./.github/actions/prepare_and_run_tests
with:
twister_arguments: "--timestamps --platform ${{ matrix.platform }} ${{ matrix.asserts }} --exclude-tag release"
zephyr_toolchain: ${{ matrix.platform == 'mps2_an521' && 'zephyr' || 'host'}}
zephyr_toolchain_arch: ${{ matrix.platform == 'mps2_an521' && 'arm' || ''}}
merge-test-2:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
name: Merge tests 2 (Python ${{ matrix.python-version }})
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install zcbor
uses: ./.github/actions/install_zcbor
with:
zcbor_package: 'setup_install'
- name: Run python tests
working-directory: tests/scripts
run: |
python3 -m unittest test_zcbor
merge-test-3:
runs-on: windows-latest
name: Merge tests 3 (Windows)
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Install west and dependencies
run: |
pip install -U pip
pip install -U build
pip install -U -r scripts/requirements.txt
- name: Generate and install zcbor package
run: |
python build bdist_wheel
pip install dist/zcbor-0.7.99-py3-none-any.whl
pip uninstall -y zcbor
pip install -e .
- name: Run python tests
working-directory: tests/scripts
run: |
python3 -m unittest test_zcbor
merge-test-4:
runs-on: ubuntu-22.04
name: Merge tests 4 (Test repo files)
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install zcbor
uses: ./.github/actions/install_zcbor
with:
zcbor_package: 'setup_develop'
- name: Run tests on repo files
working-directory: tests/scripts
run: |
python3 -m unittest test_repo_files
release-test-1:
runs-on: ubuntu-22.04
name: Release tests 1 (Fuzz)
needs:
- merge-test-1
- merge-test-2
- merge-test-3
- merge-test-4
if: "startswith(github.head_ref, 'release/')"
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Install zcbor
uses: ./.github/actions/install_zcbor
- name: Run python release tests
working-directory: tests/scripts
run: |
echo -n ${{ github.head_ref }} > HEAD_REF
python3 -m unittest test_versions
rm HEAD_REF
- name: Install packages
run: |
sudo apt update
sudo apt install -y afl++
- name: Run manifest12 fuzz tests
working-directory: tests/fuzz
run: |
./test-afl.sh 3200 64 manifest12
- name: Run pet fuzz tests
working-directory: tests/fuzz
run: |
./test-afl.sh 400 64 pet
- name: Rename fuzz failures
if: ${{ failure() }}
working-directory: tests/fuzz/build-afl/output/default/crashes/
run: |
for i in ./* ; do mv "$i" "${i//:/_}_1"; done
- name: Upload fuzz failures
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: fuzz-failures
path: tests/fuzz/build-afl/output/default/crashes/
- name: Upload release files
uses: actions/upload-artifact@v3
with:
name: zcbor-release
path: dist/*
release-test-2:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
asserts: ["", "-x VERBOSE=ON -x ASSERTS=ON"]
name: Release tests 2 (Python ${{ matrix.python-version }}${{ matrix.asserts != '' && ' with asserts' || '' }})
needs:
- merge-test-1
- merge-test-2
- merge-test-3
- merge-test-4
if: "startswith(github.head_ref, 'release/')"
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install zcbor
uses: ./.github/actions/install_zcbor
with:
zcbor_package: 'setup_install'
- name: Prepare and run tests
uses: ./.github/actions/prepare_and_run_tests
with:
twister_arguments: "--timestamps --platform native_posix --platform native_posix_64 --platform mps2_an521 --platform qemu_malta_be ${{ matrix.asserts }}"
zephyr_toolchain: zephyr
zephyr_toolchain_arch: arm,mips
release-test-3:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
asserts: ["", "-x VERBOSE=ON -x ASSERTS=ON"]
name: Release tests 3 (Python ${{ matrix.python-version }}${{ matrix.asserts != '' && ' with asserts' || '' }})
needs:
- merge-test-1
- merge-test-2
- merge-test-3
- merge-test-4
if: "startswith(github.head_ref, 'release/')"
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install zcbor
uses: ./.github/actions/install_zcbor
with:
zcbor_package: 'setup_develop'
- name: Run python tests on samples
working-directory: tests/scripts
run: |
python3 -m unittest test_repo_files.TestSamples