Skip to content

ci(wokwi): Fix concurrency #9625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/hil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,10 @@ jobs:

event_file:
name: "Event File"
if: |
contains(github.event.pull_request.labels.*.name, 'hil_test') ||
contains(github.event.pull_request.labels.*.name, 'perf_test') ||
github.event_name == 'schedule'
needs: hardware-test
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
name: event_file
path: ${{github.event_path}}
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ jobs:
uses: EnricoMi/publish-unit-test-result-action@v1
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_file: artifacts/event_file/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/**/*.xml"
40 changes: 33 additions & 7 deletions .github/workflows/wokwi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,37 @@ env:
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

concurrency:
group: wokwi-${{github.event.pull_request.number || github.ref}}
cancel-in-progress: true

jobs:
get_event_file:
name: Get event file
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.get-ref.outputs.ref }}
steps:
- name: Download event file
uses: actions/download-artifact@v4
with:
run-id: ${{github.event.workflow_run.id}}
github-token: ${{env.GITHUB_TOKEN}}
name: event_file

- name: Get ref
id: get-ref
run: |
PR_NUMBER=$(jq -r '.number' event.json)
echo "PR_NUMBER = $PR_NUMBER"
echo "ref=$PR_NUMBER" >> $GITHUB_OUTPUT

gen_chunks:
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
name: Generate Chunks matrix
runs-on: ubuntu-latest
needs: get_event_file
outputs:
chunks: ${{ steps.gen-chunks.outputs.chunks }}
concurrency:
group: wokwi-${{ needs.get_event_file.outputs.ref || github.ref }}
cancel-in-progress: true
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -47,8 +67,11 @@ jobs:
echo "chunks=${CHUNKS}" >>$GITHUB_OUTPUT

wokwi-test:
needs: [gen_chunks]
needs: [get_event_file, gen_chunks]
name: ${{matrix.chip}}-Wokwi_Test#${{matrix.chunks}}
concurrency:
group: wokwi-${{ needs.get_event_file.outputs.ref || github.ref }}-${{matrix.chip}}-${{matrix.chunks}}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -101,7 +124,10 @@ jobs:
report-result:
name: Report wokwi test result
runs-on: ubuntu-latest
needs: wokwi-test
needs: [get_event_file, wokwi-test]
concurrency:
group: wokwi-${{ needs.get_event_file.outputs.ref || github.ref }}
cancel-in-progress: true
if: always() && github.event.workflow_run.event == 'pull_request'
steps:
- name: Report result
Expand All @@ -127,4 +153,4 @@ jobs:
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})).data;
core.info(`${name} is ${state}`);

Loading