8
8
- ' examples/**'
9
9
- ' lib/**'
10
10
- ' hw/**'
11
- - ' tools/get_deps.py'
12
11
- ' tools/build.py'
12
+ - ' tools/get_deps.py'
13
13
- ' .github/actions/**'
14
14
- ' .github/workflows/build.yml'
15
15
- ' .github/workflows/build_util.yml'
21
21
- ' examples/**'
22
22
- ' lib/**'
23
23
- ' hw/**'
24
- - ' tools/get_deps.py '
24
+ - ' test/hil/** '
25
25
- ' tools/build.py'
26
+ - ' tools/get_deps.py'
26
27
- ' .github/actions/**'
27
28
- ' .github/workflows/build.yml'
28
29
- ' .github/workflows/build_util.yml'
@@ -31,21 +32,35 @@ concurrency:
31
32
group : ${{ github.workflow }}-${{ github.ref }}
32
33
cancel-in-progress : true
33
34
35
+ env :
36
+ HIL_JSON : test/hil/tinyusb.json
37
+
34
38
jobs :
39
+ # ---------------------------------------
40
+ #
41
+ # Build
42
+ #
43
+ # ---------------------------------------
35
44
set-matrix :
36
45
runs-on : ubuntu-latest
37
46
outputs :
38
47
json : ${{ steps.set-matrix-json.outputs.matrix }}
48
+ hil_json : ${{ steps.set-matrix-json.outputs.hil_matrix }}
39
49
steps :
40
50
- name : Checkout TinyUSB
41
51
uses : actions/checkout@v4
42
52
43
53
- name : Generate matrix json
44
54
id : set-matrix-json
45
55
run : |
56
+ # build matrix
46
57
MATRIX_JSON=$(python .github/workflows/ci_set_matrix.py)
47
58
echo "matrix=$MATRIX_JSON"
48
59
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
60
+ # hil matrix
61
+ HIL_MATRIX_JSON=$(python test/hil/hil_ci_set_matrix.py ${{ env.HIL_JSON }})
62
+ echo "hil_matrix=$HIL_MATRIX_JSON"
63
+ echo "hil_matrix=$HIL_MATRIX_JSON" >> $GITHUB_OUTPUT
49
64
50
65
# ---------------------------------------
51
66
# Build CMake
@@ -151,3 +166,107 @@ jobs:
151
166
run : |
152
167
west build -b pca10056 -d examples/device/cdc_msc/build examples/device/cdc_msc -- -DRTOS=zephyr
153
168
west build -b pca10056 -d examples/device/msc_dual_lun/build examples/device/msc_dual_lun -- -DRTOS=zephyr
169
+
170
+ # ---------------------------------------
171
+ #
172
+ # Hardware in the loop (HIL)
173
+ # Run on PR only (hil-tinyusb), hil-hfp only run on non-forked PR
174
+ # ---------------------------------------
175
+
176
+ # ---------------------------------------
177
+ # Build arm-gcc
178
+ # ---------------------------------------
179
+ hil-build :
180
+ if : |
181
+ github.repository_owner == 'hathach' &&
182
+ (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
183
+ needs : set-matrix
184
+ uses : ./.github/workflows/build_util.yml
185
+ strategy :
186
+ fail-fast : false
187
+ matrix :
188
+ toolchain :
189
+ - ' arm-gcc'
190
+ - ' esp-idf'
191
+ with :
192
+ build-system : ' cmake'
193
+ toolchain : ${{ matrix.toolchain }}
194
+ build-args : ${{ toJSON(fromJSON(needs.set-matrix.outputs.hil_json)[matrix.toolchain]) }}
195
+ one-per-family : true
196
+ upload-artifacts : true
197
+
198
+ # ---------------------------------------
199
+ # Hardware in the loop (HIL)
200
+ # self-hosted on local VM, for attached hardware checkout HIL_JSON
201
+ # ---------------------------------------
202
+ hil-tinyusb :
203
+ if : |
204
+ github.repository_owner == 'hathach' &&
205
+ (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
206
+ needs : hil-build
207
+ runs-on : [self-hosted, X64, hathach, hardware-in-the-loop]
208
+ steps :
209
+ - name : Clean workspace
210
+ run : |
211
+ echo "Cleaning up previous run"
212
+ rm -rf "${{ github.workspace }}"
213
+ mkdir -p "${{ github.workspace }}"
214
+
215
+ - name : Checkout TinyUSB
216
+ uses : actions/checkout@v4
217
+ with :
218
+ sparse-checkout : test/hil
219
+
220
+ - name : Download Artifacts
221
+ uses : actions/download-artifact@v4
222
+ with :
223
+ path : cmake-build
224
+ merge-multiple : true
225
+
226
+ - name : Test on actual hardware
227
+ run : |
228
+ ls cmake-build/
229
+ python3 test/hil/hil_test.py ${{ env.HIL_JSON }}
230
+
231
+ # ---------------------------------------
232
+ # Hardware in the loop (HIL)
233
+ # self-hosted by HFP, build with IAR toolchain, for attached hardware checkout test/hil/hfp.json
234
+ # Since IAR Token secret is not passed to forked PR, only build non-forked PR
235
+ # ---------------------------------------
236
+ hil-hfp :
237
+ if : |
238
+ github.repository_owner == 'hathach' &&
239
+ github.event.pull_request.head.repo.fork == false &&
240
+ (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
241
+ runs-on : [self-hosted, Linux, X64, hifiphile]
242
+ env :
243
+ IAR_LMS_BEARER_TOKEN : ${{ secrets.IAR_LMS_BEARER_TOKEN }}
244
+ steps :
245
+ - name : Clean workspace
246
+ run : |
247
+ echo "Cleaning up previous run"
248
+ rm -rf "${{ github.workspace }}"3
249
+ mkdir -p "${{ github.workspace }}"
250
+
251
+ - name : Toolchain version
252
+ run : |
253
+ iccarm --version
254
+
255
+ - name : Checkout TinyUSB
256
+ uses : actions/checkout@v4
257
+
258
+ - name : Get build boards
259
+ run : |
260
+ MATRIX_JSON=$(python test/hil/hil_ci_set_matrix.py test/hil/hfp.json)
261
+ BUILD_ARGS=$(echo $MATRIX_JSON | jq -r '.["arm-gcc"] | join(" ")')
262
+ echo "BUILD_ARGS=$BUILD_ARGS"
263
+ echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
264
+
265
+ - name : Get Dependencies
266
+ run : python3 tools/get_deps.py $BUILD_ARGS
267
+
268
+ - name : Build
269
+ run : python3 tools/build.py --toolchain iar $BUILD_ARGS
270
+
271
+ - name : Test on actual hardware (hardware in the loop)
272
+ run : python3 test/hil/hil_test.py hfp.json
0 commit comments