Skip to content

Commit 5de054b

Browse files
authored
ci(wokwi): Fix concurrency (#9625)
1 parent 5dd4692 commit 5de054b

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

Diff for: .github/workflows/hil.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,10 @@ jobs:
270270
271271
event_file:
272272
name: "Event File"
273-
if: |
274-
contains(github.event.pull_request.labels.*.name, 'hil_test') ||
275-
contains(github.event.pull_request.labels.*.name, 'perf_test') ||
276-
github.event_name == 'schedule'
277-
needs: hardware-test
278273
runs-on: ubuntu-latest
279274
steps:
280275
- name: Upload
281276
uses: actions/upload-artifact@v4
282277
with:
283-
name: Event File
278+
name: event_file
284279
path: ${{github.event_path}}

Diff for: .github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ jobs:
3333
uses: EnricoMi/publish-unit-test-result-action@v1
3434
with:
3535
commit: ${{ github.event.workflow_run.head_sha }}
36-
event_file: artifacts/Event File/event.json
36+
event_file: artifacts/event_file/event.json
3737
event_name: ${{ github.event.workflow_run.event }}
3838
files: "artifacts/**/*.xml"

Diff for: .github/workflows/wokwi.yml

+33-7
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,37 @@ env:
1515
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
1616
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1717

18-
concurrency:
19-
group: wokwi-${{github.event.pull_request.number || github.ref}}
20-
cancel-in-progress: true
21-
2218
jobs:
19+
get_event_file:
20+
name: Get event file
21+
runs-on: ubuntu-latest
22+
outputs:
23+
ref: ${{ steps.get-ref.outputs.ref }}
24+
steps:
25+
- name: Download event file
26+
uses: actions/download-artifact@v4
27+
with:
28+
run-id: ${{github.event.workflow_run.id}}
29+
github-token: ${{env.GITHUB_TOKEN}}
30+
name: event_file
31+
32+
- name: Get ref
33+
id: get-ref
34+
run: |
35+
PR_NUMBER=$(jq -r '.number' event.json)
36+
echo "PR_NUMBER = $PR_NUMBER"
37+
echo "ref=$PR_NUMBER" >> $GITHUB_OUTPUT
38+
2339
gen_chunks:
2440
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
2541
name: Generate Chunks matrix
2642
runs-on: ubuntu-latest
43+
needs: get_event_file
2744
outputs:
2845
chunks: ${{ steps.gen-chunks.outputs.chunks }}
46+
concurrency:
47+
group: wokwi-${{ needs.get_event_file.outputs.ref || github.ref }}
48+
cancel-in-progress: true
2949
steps:
3050
- name: Checkout Repository
3151
uses: actions/checkout@v4
@@ -47,8 +67,11 @@ jobs:
4767
echo "chunks=${CHUNKS}" >>$GITHUB_OUTPUT
4868
4969
wokwi-test:
50-
needs: [gen_chunks]
70+
needs: [get_event_file, gen_chunks]
5171
name: ${{matrix.chip}}-Wokwi_Test#${{matrix.chunks}}
72+
concurrency:
73+
group: wokwi-${{ needs.get_event_file.outputs.ref || github.ref }}-${{matrix.chip}}-${{matrix.chunks}}
74+
cancel-in-progress: true
5275
strategy:
5376
fail-fast: false
5477
matrix:
@@ -101,7 +124,10 @@ jobs:
101124
report-result:
102125
name: Report wokwi test result
103126
runs-on: ubuntu-latest
104-
needs: wokwi-test
127+
needs: [get_event_file, wokwi-test]
128+
concurrency:
129+
group: wokwi-${{ needs.get_event_file.outputs.ref || github.ref }}
130+
cancel-in-progress: true
105131
if: always() && github.event.workflow_run.event == 'pull_request'
106132
steps:
107133
- name: Report result
@@ -127,4 +153,4 @@ jobs:
127153
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
128154
})).data;
129155
core.info(`${name} is ${state}`);
130-
156+

0 commit comments

Comments
 (0)