Skip to content

Commit

Permalink
Cache regression tests in workflow (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
JumiDeluxe authored Nov 14, 2023
1 parent 8d94029 commit 8454fb8
Showing 1 changed file with 37 additions and 8 deletions.
45 changes: 37 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,39 @@ jobs:
name: Build regression tests
runs-on: ubuntu-latest
container: ghcr.io/kuznia-rdzeni/riscv-toolchain:2023.10.08_v
outputs:
cache_hit: ${{ steps.cache-regression.outputs.cache-hit }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Build riscv-tests
- name: Cache regression-tests
id: cache-regression
uses: actions/cache@v3
env:
cache-name: cache-regression-tests
with:
path: test/external/riscv-tests/test-*

key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(
'**/test/external/riscv-tests/environment/**',
'**/test/external/riscv-tests/Makefile',
'**/.git/modules/test/external/riscv-tests/riscv-tests/HEAD',
'**/docker/riscv-toolchain.Dockerfile'
) }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-
- if: ${{ steps.cache-regression.outputs.cache-hit != 'true' }}
run: cd test/external/riscv-tests && make

- uses: actions/upload-artifact@v3
- if: ${{ steps.cache-regression.outputs.cache-hit != 'true' }}
name: Upload riscv-tests
uses: actions/upload-artifact@v3
with:
name: "riscv-tests"
path: |
test/external/riscv-tests/test-*
path: test/external/riscv-tests

run-regression-tests:
name: Run regression tests
Expand All @@ -40,6 +59,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -58,10 +79,18 @@ jobs:
. venv/bin/activate
PYTHONHASHSEED=0 ./scripts/gen_verilog.py --verbose --config full
- uses: actions/download-artifact@v3
- uses: actions/cache@v3
env:
cache-name: cache-regression-tests
with:
name: "riscv-tests"
path: test/external/riscv-tests
path: test/external/riscv-tests/test-*
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(
'**/test/external/riscv-tests/environment/**',
'**/test/external/riscv-tests/Makefile',
'**/.git/modules/test/external/riscv-tests/riscv-tests/HEAD',
'**/docker/riscv-toolchain.Dockerfile'
) }}
fail-on-cache-miss: true

- name: Run tests
run: |
Expand Down

0 comments on commit 8454fb8

Please sign in to comment.