Skip to content

Commit 04cfdb5

Browse files
committed
test runner tags
1 parent d1201e6 commit 04cfdb5

File tree

22 files changed

+709
-238
lines changed

22 files changed

+709
-238
lines changed

.github/scripts/tests_matrix.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ if [[ $IS_PR != 'true' ]] || [[ $PERFORMANCE_ENABLED == 'true' ]]; then
1212
#qemu_types+=",'performance'"
1313
fi
1414

15-
targets="'esp32','esp32s2','esp32s3','esp32c3','esp32c6','esp32h2','esp32p4'"
15+
targets="'esp32','esp32s2','esp32s3','esp32c3','esp32c5','esp32c6','esp32h2','esp32p4'"
1616

1717
mkdir -p info
1818

1919
echo "[$wokwi_types]" > info/wokwi_types.txt
20+
echo "[$hw_types]" > info/hw_types.txt
2021
echo "[$targets]" > info/targets.txt
2122

2223
{

.github/workflows/tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ jobs:
8989
type: ${{ matrix.type }}
9090
chip: ${{ matrix.chip }}
9191

92-
# Hardware tests now run via workflow_run trigger in tests_hw_wokwi.yml
93-
# This provides secure access to GitLab secrets while maintaining the same functionality
94-
9592
# This job is disabled for now
9693
call-qemu-tests:
9794
name: QEMU
@@ -107,4 +104,4 @@ jobs:
107104
type: ${{ matrix.type }}
108105
chip: ${{ matrix.chip }}
109106

110-
# Wokwi tests are run after this workflow as it needs access to secrets
107+
# Hardware and Wokwi tests are run after this workflow as they need access to secrets

.github/workflows/tests_hw_wokwi.yml

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
permissions:
1111
contents: read
1212

13+
env:
14+
#TESTS_BRANCH: "master" # Branch that will be checked out to run the tests
15+
TESTS_BRANCH: "ci/hw_gitlab"
16+
1317
jobs:
1418
get-artifacts:
1519
name: Get required artifacts
@@ -22,7 +26,8 @@ jobs:
2226
ref: ${{ steps.set-ref.outputs.ref }}
2327
base: ${{ steps.set-ref.outputs.base }}
2428
targets: ${{ steps.set-ref.outputs.targets }}
25-
types: ${{ steps.set-ref.outputs.types }}
29+
wokwi_types: ${{ steps.set-ref.outputs.wokwi_types }}
30+
hw_types: ${{ steps.set-ref.outputs.hw_types }}
2631
hw_tests_enabled: ${{ steps.set-ref.outputs.hw_tests_enabled }}
2732
push_time: ${{ steps.set-ref.outputs.push_time }}
2833
steps:
@@ -62,7 +67,7 @@ jobs:
6267
name: matrix_info
6368
path: artifacts/matrix_info
6469

65-
- name: Try to read PR number
70+
- name: Get info
6671
id: set-ref
6772
run: |
6873
pr_num=$(jq -r '.pull_request.number' artifacts/event_file/event.json | tr -cd "[:digit:]")
@@ -102,12 +107,14 @@ jobs:
102107
push_time=""
103108
fi
104109
105-
types=$(cat artifacts/matrix_info/wokwi_types.txt | tr -cd "[:alpha:],[]'")
110+
wokwi_types=$(cat artifacts/matrix_info/wokwi_types.txt | tr -cd "[:alpha:],[]'")
111+
hw_types=$(cat artifacts/matrix_info/hw_types.txt | tr -cd "[:alpha:],[]'")
106112
targets=$(cat artifacts/matrix_info/targets.txt | tr -cd "[:alnum:],[]'")
107113
108114
echo "base = $base"
109115
echo "targets = $targets"
110-
echo "types = $types"
116+
echo "wokwi_types = $wokwi_types"
117+
echo "hw_types = $hw_types"
111118
echo "pr_num = $pr_num"
112119
echo "hw_tests_enabled = $hw_tests_enabled"
113120
echo "push_time = $push_time"
@@ -145,7 +152,8 @@ jobs:
145152
echo "pr_num=$pr_num" >> $GITHUB_OUTPUT
146153
echo "base=$base" >> $GITHUB_OUTPUT
147154
echo "targets=$targets" >> $GITHUB_OUTPUT
148-
echo "types=$types" >> $GITHUB_OUTPUT
155+
echo "wokwi_types=$wokwi_types" >> $GITHUB_OUTPUT
156+
echo "hw_types=$hw_types" >> $GITHUB_OUTPUT
149157
echo "ref=$ref" >> $GITHUB_OUTPUT
150158
echo "hw_tests_enabled=$hw_tests_enabled" >> $GITHUB_OUTPUT
151159
echo "push_time=$push_time" >> $GITHUB_OUTPUT
@@ -189,7 +197,7 @@ jobs:
189197
core.info(`${name} is ${state}`);
190198
191199
hardware-test:
192-
name: Hardware ${{ matrix.chip }} ${{ matrix.type }} tests
200+
name: Internal Hardware Tests
193201
if: |
194202
(github.event.workflow_run.conclusion == 'success' ||
195203
github.event.workflow_run.conclusion == 'failure' ||
@@ -198,15 +206,10 @@ jobs:
198206
runs-on: ubuntu-latest
199207
needs: get-artifacts
200208
env:
201-
id: ${{ needs.get-artifacts.outputs.ref }}-${{ github.event.workflow_run.head_sha || github.sha }}-${{ matrix.chip }}-${{ matrix.type }}
209+
id: ${{ needs.get-artifacts.outputs.ref }}-${{ github.event.workflow_run.head_sha || github.sha }}
202210
permissions:
203211
actions: read
204212
statuses: write
205-
strategy:
206-
fail-fast: false
207-
matrix:
208-
type: ${{ fromJson(needs.get-artifacts.outputs.types) }}
209-
chip: ${{ fromJson(needs.get-artifacts.outputs.targets) }}
210213
steps:
211214
- name: Report pending
212215
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
@@ -219,7 +222,7 @@ jobs:
219222
core.debug(`repo: ${repo}`);
220223
core.debug(`sha: ${sha}`);
221224
const { context: name, state } = (await github.rest.repos.createCommitStatus({
222-
context: 'Runtime Tests / Hardware (${{ matrix.type }}, ${{ matrix.chip }}) / Hardware ${{ matrix.chip }} ${{ matrix.type }} tests (${{ github.event.workflow_run.event }} -> workflow_run)',
225+
context: 'Runtime Tests / Internal Hardware Tests (${{ github.event.workflow_run.event }} -> workflow_run)',
223226
owner: owner,
224227
repo: repo,
225228
sha: sha,
@@ -258,8 +261,7 @@ jobs:
258261
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
259262
run: |
260263
# A webhook to sync the repository is sent to GitLab when a commit is pushed to GitHub
261-
# In the worst case, it can take up to 5 minutes for the sync to complete
262-
# We wait for 6 minutes after the push to GitHub to be safe
264+
# We wait for 10 minutes after the push to GitHub to be safe
263265
264266
echo "Ensuring GitLab sync has completed before triggering pipeline..."
265267
@@ -278,8 +280,8 @@ jobs:
278280
279281
echo "Elapsed time since push: ${elapsed_minutes} minutes"
280282
281-
if [ $elapsed_minutes -lt 6 ]; then
282-
wait_time=$(( (6 - elapsed_minutes) * 60 ))
283+
if [ $elapsed_minutes -lt 10 ]; then
284+
wait_time=$(( (10 - elapsed_minutes) * 60 ))
283285
echo "Waiting ${wait_time} seconds for GitLab sync to complete..."
284286
sleep $wait_time
285287
else
@@ -302,30 +304,20 @@ jobs:
302304
with:
303305
ref: ${{ needs.get-artifacts.outputs.base || github.ref }}
304306

305-
- name: Get test binaries
306-
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
307-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
308-
with:
309-
github-token: ${{ secrets.GITHUB_TOKEN }}
310-
run-id: ${{ github.event.workflow_run.id }}
311-
name: test-bin-${{ matrix.chip }}-${{ matrix.type }}
312-
path: test-binaries
313-
314307
- name: Trigger GitLab Pipeline and Download Artifacts
315308
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
316309
uses: digital-blueprint/[email protected]
317310
id: gitlab-trigger
318311
with:
319312
host: ${{ secrets.GITLAB_URL }}
320313
id: ${{ secrets.GITLAB_PROJECT_ID }}
321-
ref: 'ci/hw_gitlab'
322-
#ref: 'master'
314+
ref: ${{ env.TESTS_BRANCH }}
323315
trigger_token: ${{ secrets.GITLAB_TRIGGER_TOKEN }}
324316
access_token: ${{ secrets.GITLAB_ACCESS_TOKEN }}
325317
download_artifacts: 'true'
326318
download_artifacts_on_failure: 'true'
327319
download_path: './gitlab-artifacts'
328-
variables: '{"TEST_TYPE":"${{ matrix.type }}","TEST_CHIP":"${{ matrix.chip }}","PIPELINE_ID":"${{ env.id }}","BINARIES_RUN_ID":"${{ github.event.workflow_run.id }}","GITHUB_REPOSITORY":"${{ github.repository }}"}'
320+
variables: '{"TEST_TYPES":"${{ needs.get-artifacts.outputs.hw_types }}","TEST_CHIPS":"${{ needs.get-artifacts.outputs.targets }}","PIPELINE_ID":"${{ env.id }}","BINARIES_RUN_ID":"${{ github.event.workflow_run.id }}","GITHUB_REPOSITORY":"${{ github.repository }}"}'
329321

330322
- name: Process Downloaded Artifacts
331323
if: ${{ always() && steps.check-tests.outputs.enabled == 'true' }}
@@ -356,7 +348,7 @@ jobs:
356348
echo "No artifacts were downloaded from GitLab"
357349
fi
358350
359-
- name: Upload ${{ matrix.chip }} ${{ matrix.type }} hardware results as cache
351+
- name: Upload hardware results as cache
360352
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
361353
if: steps.check-tests.outputs.enabled == 'true' && needs.get-artifacts.outputs.pr_num
362354
with:
@@ -365,11 +357,11 @@ jobs:
365357
tests/**/*.xml
366358
tests/**/result_*.json
367359
368-
- name: Upload ${{ matrix.chip }} ${{ matrix.type }} hardware results as artifacts
360+
- name: Upload hardware results as artifacts
369361
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
370362
if: always()
371363
with:
372-
name: test-results-hw-${{ matrix.chip }}-${{ matrix.type }}
364+
name: test-results-hw
373365
overwrite: true
374366
path: |
375367
tests/**/*.xml
@@ -387,7 +379,7 @@ jobs:
387379
core.debug(`repo: ${repo}`);
388380
core.debug(`sha: ${sha}`);
389381
const { context: name, state } = (await github.rest.repos.createCommitStatus({
390-
context: 'Runtime Tests / Hardware (${{ matrix.type }}, ${{ matrix.chip }}) / Hardware ${{ matrix.chip }} ${{ matrix.type }} tests (${{ github.event.workflow_run.event }} -> workflow_run)',
382+
context: 'Runtime Tests / Internal Hardware Tests (${{ github.event.workflow_run.event }} -> workflow_run)',
391383
owner: owner,
392384
repo: repo,
393385
sha: sha,
@@ -412,7 +404,7 @@ jobs:
412404
strategy:
413405
fail-fast: false
414406
matrix:
415-
type: ${{ fromJson(needs.get-artifacts.outputs.types) }}
407+
type: ${{ fromJson(needs.get-artifacts.outputs.wokwi_types) }}
416408
chip: ${{ fromJson(needs.get-artifacts.outputs.targets) }}
417409
steps:
418410
- name: Report pending

.github/workflows/tests_results.yml

Lines changed: 76 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,29 @@ permissions:
1111
contents: read
1212

1313
jobs:
14-
unit-test-results:
15-
name: Unit Test Results
16-
if: |
17-
github.event.workflow_run.conclusion == 'success' ||
18-
github.event.workflow_run.conclusion == 'failure' ||
19-
github.event.workflow_run.conclusion == 'timed_out'
14+
get-artifacts:
15+
name: Get artifacts
2016
runs-on: ubuntu-latest
21-
permissions:
22-
actions: write
23-
statuses: write
24-
checks: write
25-
pull-requests: write
26-
contents: write
17+
outputs:
18+
original_event: ${{ steps.get-info.outputs.original_event }}
19+
original_action: ${{ steps.get-info.outputs.original_action }}
20+
original_sha: ${{ steps.get-info.outputs.original_sha }}
21+
original_ref: ${{ steps.get-info.outputs.original_ref }}
22+
original_conclusion: ${{ steps.get-info.outputs.original_conclusion }}
23+
original_run_id: ${{ steps.get-info.outputs.original_run_id }}
2724
steps:
28-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29-
with:
30-
ref: gh-pages
31-
3225
- name: Download and Extract Artifacts
3326
uses: dawidd6/action-download-artifact@07ab29fd4a977ae4d2b275087cf67563dfdf0295 # v9
3427
with:
3528
run_id: ${{ github.event.workflow_run.id }}
3629
path: ./artifacts
3730

3831
- name: Get original info
32+
id: get-info
3933
run: |
34+
echo "Artifacts:"
35+
ls -laR ./artifacts
36+
4037
original_event=$(cat ./artifacts/parent-artifacts/event.txt)
4138
original_action=$(cat ./artifacts/parent-artifacts/action.txt)
4239
original_sha=$(cat ./artifacts/parent-artifacts/sha.txt)
@@ -64,12 +61,12 @@ jobs:
6461
# Run ID: Allow numeric characters
6562
original_run_id=$(echo "$original_run_id" | tr -cd '[:digit:]')
6663
67-
echo "original_event=$original_event" >> $GITHUB_ENV
68-
echo "original_action=$original_action" >> $GITHUB_ENV
69-
echo "original_sha=$original_sha" >> $GITHUB_ENV
70-
echo "original_ref=$original_ref" >> $GITHUB_ENV
71-
echo "original_conclusion=$original_conclusion" >> $GITHUB_ENV
72-
echo "original_run_id=$original_run_id" >> $GITHUB_ENV
64+
echo "original_event=$original_event" >> $GITHUB_OUTPUT
65+
echo "original_action=$original_action" >> $GITHUB_OUTPUT
66+
echo "original_sha=$original_sha" >> $GITHUB_OUTPUT
67+
echo "original_ref=$original_ref" >> $GITHUB_OUTPUT
68+
echo "original_conclusion=$original_conclusion" >> $GITHUB_OUTPUT
69+
echo "original_run_id=$original_run_id" >> $GITHUB_OUTPUT
7370
7471
echo "original_event = $original_event"
7572
echo "original_action = $original_action"
@@ -80,17 +77,37 @@ jobs:
8077
8178
- name: Print links to other runs
8279
run: |
83-
echo "Build and QEMU tests: https://github.com/${{ github.repository }}/actions/runs/${{ env.original_run_id }}"
80+
echo "Build and QEMU tests: https://github.com/${{ github.repository }}/actions/runs/${{ steps.get-info.outputs.original_run_id }}"
8481
echo "Hardware and Wokwi tests: https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}"
8582
83+
unit-test-results:
84+
name: Unit Test Results
85+
needs: get-artifacts
86+
if: |
87+
github.event.workflow_run.conclusion == 'success' ||
88+
github.event.workflow_run.conclusion == 'failure' ||
89+
github.event.workflow_run.conclusion == 'timed_out'
90+
runs-on: ubuntu-latest
91+
permissions:
92+
actions: write
93+
statuses: write
94+
checks: write
95+
pull-requests: write
96+
contents: write
97+
steps:
98+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
99+
with:
100+
ref: gh-pages
101+
86102
- name: Publish Unit Test Results
87103
uses: EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # v2.18.0
88104
with:
89-
commit: ${{ env.original_sha }}
105+
commit: ${{ needs.get-artifacts.outputs.original_sha }}
90106
event_file: ./artifacts/parent-artifacts/event_file/event.json
91-
event_name: ${{ env.original_event }}
107+
event_name: ${{ needs.get-artifacts.outputs.original_event }}
92108
files: ./artifacts/**/*.xml
93109
action_fail: true
110+
action_fail_on_inconclusive: true
94111
compare_to_earlier_commit: false
95112
json_file: ./unity_results.json
96113
json_suite_details: true
@@ -105,7 +122,13 @@ jobs:
105122
./unity_results.json
106123
107124
- name: Fail if tests failed
108-
if: ${{ env.original_conclusion == 'failure' || env.original_conclusion == 'timed_out' || github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out' }}
125+
if: |
126+
needs.get-artifacts.outputs.original_conclusion == 'failure' ||
127+
needs.get-artifacts.outputs.original_conclusion == 'cancelled' ||
128+
needs.get-artifacts.outputs.original_conclusion == 'timed_out' ||
129+
github.event.workflow_run.conclusion == 'failure' ||
130+
github.event.workflow_run.conclusion == 'cancelled' ||
131+
github.event.workflow_run.conclusion == 'timed_out'
109132
run: exit 1
110133

111134
- name: Clean up caches
@@ -162,12 +185,24 @@ jobs:
162185
core.info(`${name} is ${state}`);
163186
164187
- name: Generate report
165-
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }} # codespell:ignore cancelled
188+
if: |
189+
(!cancelled() &&
190+
needs.get-artifacts.outputs.original_conclusion != 'cancelled' &&
191+
github.event.workflow_run.conclusion != 'cancelled') &&
192+
(needs.get-artifacts.outputs.original_event == 'schedule' ||
193+
needs.get-artifacts.outputs.original_event == 'workflow_dispatch')
166194
env:
167195
REPORT_FILE: ./runtime-test-results/RUNTIME_TEST_RESULTS.md
168196
WOKWI_RUN_ID: ${{ github.event.workflow_run.id }}
169-
BUILD_RUN_ID: ${{ env.original_run_id }}
170-
IS_FAILING: ${{ env.original_conclusion == 'failure' || env.original_conclusion == 'timed_out' || github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out' || job.status == 'failure' }}
197+
BUILD_RUN_ID: ${{ needs.get-artifacts.outputs.original_run_id }}
198+
IS_FAILING: |
199+
needs.get-artifacts.outputs.original_conclusion == 'failure' ||
200+
needs.get-artifacts.outputs.original_conclusion == 'cancelled' ||
201+
needs.get-artifacts.outputs.original_conclusion == 'timed_out' ||
202+
github.event.workflow_run.conclusion == 'failure' ||
203+
github.event.workflow_run.conclusion == 'cancelled' ||
204+
github.event.workflow_run.conclusion == 'timed_out' ||
205+
job.status == 'failure'
171206
run: |
172207
rm -rf artifacts $REPORT_FILE
173208
mv -f ./unity_results.json ./runtime-test-results/unity_results.json
@@ -176,7 +211,12 @@ jobs:
176211
mv -f ./test_results.json ./runtime-test-results/test_results.json
177212
178213
- name: Generate badge
179-
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }} # codespell:ignore cancelled
214+
if: |
215+
(!cancelled() &&
216+
needs.get-artifacts.outputs.original_conclusion != 'cancelled' &&
217+
github.event.workflow_run.conclusion != 'cancelled') &&
218+
(needs.get-artifacts.outputs.original_event == 'schedule' ||
219+
needs.get-artifacts.outputs.original_event == 'workflow_dispatch')
180220
uses: jaywcjlove/generated-badges@0e078ae4d4bab3777ea4f137de496ab44688f5ad # v1.0.13
181221
with:
182222
label: Runtime Tests
@@ -186,7 +226,12 @@ jobs:
186226
style: flat
187227

188228
- name: Push badge
189-
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }} # codespell:ignore cancelled
229+
if: |
230+
(!cancelled() &&
231+
needs.get-artifacts.outputs.original_conclusion != 'cancelled' &&
232+
github.event.workflow_run.conclusion != 'cancelled') &&
233+
(needs.get-artifacts.outputs.original_event == 'schedule' ||
234+
needs.get-artifacts.outputs.original_event == 'workflow_dispatch')
190235
run: |
191236
git config user.name "github-actions[bot]"
192237
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

0 commit comments

Comments
 (0)