1010permissions :
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+
1317jobs :
1418 get-artifacts :
1519 name : Get required artifacts
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 :
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
@@ -296,43 +298,29 @@ jobs:
296298
297299 echo "Proceeding with GitLab pipeline trigger..."
298300
299- - name : Checkout repository
300- if : ${{ steps.check-tests.outputs.enabled == 'true' }}
301- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
302- with :
303- ref : ${{ needs.get-artifacts.outputs.base || github.ref }}
304-
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-
314301 - name : Trigger GitLab Pipeline and Download Artifacts
315302 if : ${{ steps.check-tests.outputs.enabled == 'true' }}
316303 uses :
digital-blueprint/[email protected] 317304 id : gitlab-trigger
318305 with :
319306 host : ${{ secrets.GITLAB_URL }}
320307 id : ${{ secrets.GITLAB_PROJECT_ID }}
321- ref : ' ci/hw_gitlab'
322- # ref: 'master'
308+ ref : ${{ env.TESTS_BRANCH }}
323309 trigger_token : ${{ secrets.GITLAB_TRIGGER_TOKEN }}
324310 access_token : ${{ secrets.GITLAB_ACCESS_TOKEN }}
325311 download_artifacts : ' true'
326312 download_artifacts_on_failure : ' true'
327313 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 }}"}'
314+ 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 }}"}'
329315
330316 - name : Process Downloaded Artifacts
331317 if : ${{ always() && steps.check-tests.outputs.enabled == 'true' }}
332318 run : |
333319 echo "GitLab Pipeline Status: ${{ steps.gitlab-trigger.outputs.status }}"
334320 echo "Artifacts Downloaded: ${{ steps.gitlab-trigger.outputs.artifacts_downloaded }}"
335321
322+ ls -laR gitlab-artifacts/ || echo "No GitLab artifacts found"
323+
336324 # Create tests directory structure expected by GitHub caching
337325 mkdir -p tests
338326
@@ -346,7 +334,8 @@ jobs:
346334
347335 for job_dir in ./gitlab-artifacts/job_*; do
348336 if [ -d "$job_dir/artifacts/tests" ]; then
349- mv "$job_dir/artifacts/tests/"* tests/
337+ # Merge results into tests/ without failing on non-empty directories
338+ cp -a "$job_dir/artifacts/tests/." tests/
350339 fi
351340 done
352341
@@ -356,7 +345,7 @@ jobs:
356345 echo "No artifacts were downloaded from GitLab"
357346 fi
358347
359- - name : Upload ${{ matrix.chip }} ${{ matrix.type }} hardware results as cache
348+ - name : Upload hardware results as cache
360349 uses : actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
361350 if : steps.check-tests.outputs.enabled == 'true' && needs.get-artifacts.outputs.pr_num
362351 with :
@@ -365,11 +354,11 @@ jobs:
365354 tests/**/*.xml
366355 tests/**/result_*.json
367356
368- - name : Upload ${{ matrix.chip }} ${{ matrix.type }} hardware results as artifacts
357+ - name : Upload hardware results as artifacts
369358 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
370359 if : always()
371360 with :
372- name : test-results-hw-${{ matrix.chip }}-${{ matrix.type }}
361+ name : test-results-hw
373362 overwrite : true
374363 path : |
375364 tests/**/*.xml
@@ -387,7 +376,7 @@ jobs:
387376 core.debug(`repo: ${repo}`);
388377 core.debug(`sha: ${sha}`);
389378 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)',
379+ context: 'Runtime Tests / Internal Hardware Tests (${{ github.event.workflow_run.event }} -> workflow_run)',
391380 owner: owner,
392381 repo: repo,
393382 sha: sha,
@@ -412,7 +401,7 @@ jobs:
412401 strategy :
413402 fail-fast : false
414403 matrix :
415- type : ${{ fromJson(needs.get-artifacts.outputs.types ) }}
404+ type : ${{ fromJson(needs.get-artifacts.outputs.wokwi_types ) }}
416405 chip : ${{ fromJson(needs.get-artifacts.outputs.targets) }}
417406 steps :
418407 - name : Report pending
0 commit comments