Skip to content

Commit 2409742

Browse files
committed
test runner tags
1 parent 44ef88d commit 2409742

File tree

11 files changed

+603
-190
lines changed

11 files changed

+603
-190
lines changed

.github/scripts/tests_matrix.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ targets="'esp32','esp32s2','esp32s3','esp32c3','esp32c6','esp32h2','esp32p4'"
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_hw_wokwi.yml

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ permissions:
1212

1313
env:
1414
WOKWI_TIMEOUT: 600000 # Milliseconds
15+
#TESTS_BRANCH: "master" # Branch that will be checked out to run the tests
16+
TESTS_BRANCH: "ci/hw_gitlab"
1517

1618
jobs:
1719
get-artifacts:
@@ -25,7 +27,7 @@ jobs:
2527
ref: ${{ steps.set-ref.outputs.ref }}
2628
base: ${{ steps.set-ref.outputs.base }}
2729
targets: ${{ steps.set-ref.outputs.targets }}
28-
types: ${{ steps.set-ref.outputs.types }}
30+
wokwi_types: ${{ steps.set-ref.outputs.wokwi_types }}
2931
hw_tests_enabled: ${{ steps.set-ref.outputs.hw_tests_enabled }}
3032
push_time: ${{ steps.set-ref.outputs.push_time }}
3133
steps:
@@ -105,12 +107,14 @@ jobs:
105107
push_time=""
106108
fi
107109
108-
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:],[]'")
109112
targets=$(cat artifacts/matrix_info/targets.txt | tr -cd "[:alnum:],[]'")
110113
111114
echo "base = $base"
112115
echo "targets = $targets"
113-
echo "types = $types"
116+
echo "wokwi_types = $wokwi_types"
117+
echo "hw_types = $hw_types"
114118
echo "pr_num = $pr_num"
115119
echo "hw_tests_enabled = $hw_tests_enabled"
116120
echo "push_time = $push_time"
@@ -148,7 +152,8 @@ jobs:
148152
echo "pr_num=$pr_num" >> $GITHUB_OUTPUT
149153
echo "base=$base" >> $GITHUB_OUTPUT
150154
echo "targets=$targets" >> $GITHUB_OUTPUT
151-
echo "types=$types" >> $GITHUB_OUTPUT
155+
echo "wokwi_types=$wokwi_types" >> $GITHUB_OUTPUT
156+
echo "hw_types=$hw_types" >> $GITHUB_OUTPUT
152157
echo "ref=$ref" >> $GITHUB_OUTPUT
153158
echo "hw_tests_enabled=$hw_tests_enabled" >> $GITHUB_OUTPUT
154159
echo "push_time=$push_time" >> $GITHUB_OUTPUT
@@ -192,7 +197,7 @@ jobs:
192197
core.info(`${name} is ${state}`);
193198
194199
hardware-test:
195-
name: Hardware ${{ matrix.chip }} ${{ matrix.type }} tests
200+
name: Internal Hardware Tests
196201
if: |
197202
(github.event.workflow_run.conclusion == 'success' ||
198203
github.event.workflow_run.conclusion == 'failure' ||
@@ -201,15 +206,10 @@ jobs:
201206
runs-on: ubuntu-latest
202207
needs: get-artifacts
203208
env:
204-
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 }}
205210
permissions:
206211
actions: read
207212
statuses: write
208-
strategy:
209-
fail-fast: false
210-
matrix:
211-
type: ${{ fromJson(needs.get-artifacts.outputs.types) }}
212-
chip: ${{ fromJson(needs.get-artifacts.outputs.targets) }}
213213
steps:
214214
- name: Report pending
215215
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
@@ -222,7 +222,7 @@ jobs:
222222
core.debug(`repo: ${repo}`);
223223
core.debug(`sha: ${sha}`);
224224
const { context: name, state } = (await github.rest.repos.createCommitStatus({
225-
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)',
226226
owner: owner,
227227
repo: repo,
228228
sha: sha,
@@ -261,8 +261,7 @@ jobs:
261261
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
262262
run: |
263263
# A webhook to sync the repository is sent to GitLab when a commit is pushed to GitHub
264-
# In the worst case, it can take up to 5 minutes for the sync to complete
265-
# 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
266265
267266
echo "Ensuring GitLab sync has completed before triggering pipeline..."
268267
@@ -281,8 +280,8 @@ jobs:
281280
282281
echo "Elapsed time since push: ${elapsed_minutes} minutes"
283282
284-
if [ $elapsed_minutes -lt 6 ]; then
285-
wait_time=$(( (6 - elapsed_minutes) * 60 ))
283+
if [ $elapsed_minutes -lt 10 ]; then
284+
wait_time=$(( (10 - elapsed_minutes) * 60 ))
286285
echo "Waiting ${wait_time} seconds for GitLab sync to complete..."
287286
sleep $wait_time
288287
else
@@ -305,30 +304,20 @@ jobs:
305304
with:
306305
ref: ${{ needs.get-artifacts.outputs.base || github.ref }}
307306

308-
- name: Get test binaries
309-
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
310-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
311-
with:
312-
github-token: ${{ secrets.GITHUB_TOKEN }}
313-
run-id: ${{ github.event.workflow_run.id }}
314-
name: test-bin-${{ matrix.chip }}-${{ matrix.type }}
315-
path: test-binaries
316-
317307
- name: Trigger GitLab Pipeline and Download Artifacts
318308
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
319309
uses: digital-blueprint/[email protected]
320310
id: gitlab-trigger
321311
with:
322312
host: ${{ secrets.GITLAB_URL }}
323313
id: ${{ secrets.GITLAB_PROJECT_ID }}
324-
ref: 'ci/hw_gitlab'
325-
#ref: 'master'
314+
ref: ${{ env.TESTS_BRANCH }}
326315
trigger_token: ${{ secrets.GITLAB_TRIGGER_TOKEN }}
327316
access_token: ${{ secrets.GITLAB_ACCESS_TOKEN }}
328317
download_artifacts: 'true'
329318
download_artifacts_on_failure: 'true'
330319
download_path: './gitlab-artifacts'
331-
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 }}"}'
332321

333322
- name: Process Downloaded Artifacts
334323
if: ${{ always() && steps.check-tests.outputs.enabled == 'true' }}
@@ -359,7 +348,7 @@ jobs:
359348
echo "No artifacts were downloaded from GitLab"
360349
fi
361350
362-
- name: Upload ${{ matrix.chip }} ${{ matrix.type }} hardware results as cache
351+
- name: Upload hardware results as cache
363352
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
364353
if: steps.check-tests.outputs.enabled == 'true' && needs.get-artifacts.outputs.pr_num
365354
with:
@@ -368,11 +357,11 @@ jobs:
368357
tests/**/*.xml
369358
tests/**/result_*.json
370359
371-
- name: Upload ${{ matrix.chip }} ${{ matrix.type }} hardware results as artifacts
360+
- name: Upload hardware results as artifacts
372361
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
373362
if: always()
374363
with:
375-
name: test-results-hw-${{ matrix.chip }}-${{ matrix.type }}
364+
name: test-results-hw
376365
overwrite: true
377366
path: |
378367
tests/**/*.xml
@@ -390,7 +379,7 @@ jobs:
390379
core.debug(`repo: ${repo}`);
391380
core.debug(`sha: ${sha}`);
392381
const { context: name, state } = (await github.rest.repos.createCommitStatus({
393-
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)',
394383
owner: owner,
395384
repo: repo,
396385
sha: sha,
@@ -415,7 +404,7 @@ jobs:
415404
strategy:
416405
fail-fast: false
417406
matrix:
418-
type: ${{ fromJson(needs.get-artifacts.outputs.types) }}
407+
type: ${{ fromJson(needs.get-artifacts.outputs.wokwi_types) }}
419408
chip: ${{ fromJson(needs.get-artifacts.outputs.targets) }}
420409
steps:
421410
- name: Report pending

.gitlab-ci.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
workflow:
22
rules:
3-
# Disable those non-protected push triggered pipelines
4-
- if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^\d+\.\d+(\.\d+)?($|-)/ && $CI_PIPELINE_SOURCE == "push"'
5-
when: never
6-
# when running merged result pipelines, CI_COMMIT_SHA represents the temp commit it created.
7-
# Please use PIPELINE_COMMIT_SHA at all places that require a commit sha of the original commit.
8-
- if: $CI_OPEN_MERGE_REQUESTS != null
9-
variables:
10-
PIPELINE_COMMIT_SHA: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
11-
IS_MR_PIPELINE: 1
12-
- if: $CI_OPEN_MERGE_REQUESTS == null
13-
variables:
14-
PIPELINE_COMMIT_SHA: $CI_COMMIT_SHA
15-
IS_MR_PIPELINE: 0
16-
- if: '$CI_PIPELINE_SOURCE == "schedule"'
17-
variables:
18-
IS_SCHEDULED_RUN: "true"
19-
- when: always
3+
# Allow only when triggered manually (web), via API, or by a trigger token
4+
- if: '$CI_PIPELINE_SOURCE =~ /^(trigger|api|web)$/'
5+
when: always
6+
# Deny all other sources
7+
- when: never
208

219
# Place the default settings in `.gitlab/workflows/common.yml` instead
2210

2311
include:
2412
- ".gitlab/workflows/common.yml"
25-
- ".gitlab/workflows/hardware_tests.yml"
13+
- ".gitlab/workflows/hardware_tests_dynamic.yml"

0 commit comments

Comments
 (0)