Skip to content

Commit 1e77a4e

Browse files
committed
Build: CI: Fix test job matrix caching concurrency race
1 parent 6cc4685 commit 1e77a4e

File tree

1 file changed

+40
-17
lines changed

1 file changed

+40
-17
lines changed

.github/workflows/build.yml

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,50 @@ jobs:
583583
pattern: wheels-*
584584
delete-merged: false # Optional: removes the individual artifacts
585585

586+
setup-tests-cache:
587+
runs-on: ubuntu-latest
588+
steps:
589+
- uses: actions/checkout@v5
590+
591+
- name: Install just
592+
uses: taiki-e/install-action@just
593+
594+
- name: Install uv
595+
uses: astral-sh/setup-uv@v6
596+
597+
- name: Restore cached tests setup
598+
id: cache-tests-setup-restore
599+
uses: actions/cache/restore@v4
600+
with:
601+
key: tests-setup-v1
602+
path: |
603+
tests/*.onnx
604+
tests/*.onnx.json
605+
tests/kaldi_model
606+
607+
- name: Setup tests
608+
if: steps.cache-tests-setup-restore.outputs.cache-hit != 'true'
609+
run: |
610+
just setup-tests
611+
612+
- name: Save cached tests setup
613+
if: steps.cache-tests-setup-restore.outputs.cache-hit != 'true'
614+
uses: actions/cache/save@v4
615+
with:
616+
key: tests-setup-v1
617+
path: |
618+
tests/*.onnx
619+
tests/*.onnx.json
620+
tests/kaldi_model
621+
586622
test-wheels:
587623
runs-on: ${{ matrix.os }}
588624
needs:
589625
- build-linux
590626
- build-windows
591627
- build-macos-arm
592628
- build-macos-intel
629+
- setup-tests-cache
593630
if: ${{ always() && true }} # Run even if some build jobs failed
594631
timeout-minutes: 60 # For each job run of the matrix
595632
defaults:
@@ -645,29 +682,15 @@ jobs:
645682
fi
646683
647684
- name: Restore cached tests setup
648-
id: cache-tests-setup-restore
649685
uses: actions/cache/restore@v4
650686
with:
651-
key: tests-setup-${{ hashFiles('tests/*.onnx, tests/*.onnx.json, tests/kaldi_model') }}-v1
652-
path: |
653-
tests/*.onnx
654-
tests/*.onnx.json
655-
tests/kaldi_model
656-
657-
- name: Setup tests
658-
if: steps.wheels-presence.outputs.found == 'true' && steps.cache-tests-setup-restore.outputs.cache-hit != 'true'
659-
run: |
660-
just setup-tests
661-
662-
- name: Save cached tests setup
663-
if: steps.wheels-presence.outputs.found == 'true' && steps.cache-tests-setup-restore.outputs.cache-hit != 'true'
664-
uses: actions/cache/save@v4
665-
with:
666-
key: ${{ steps.cache-tests-setup-restore.outputs.cache-primary-key }}
687+
key: tests-setup-v1
667688
path: |
668689
tests/*.onnx
669690
tests/*.onnx.json
670691
tests/kaldi_model
692+
enableCrossOsArchive: true
693+
fail-on-cache-miss: true
671694

672695
- name: Run tests
673696
if: steps.wheels-presence.outputs.found == 'true'

0 commit comments

Comments
 (0)