Skip to content

Commit

Permalink
test persistent cache across runs
Browse files Browse the repository at this point in the history
  • Loading branch information
mickflemm committed Nov 10, 2024
1 parent 1524e78 commit e54290a
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,41 @@ jobs:
submodule_cache:
name: Initialize submodule cache
runs-on: ubuntu-latest
outputs:
key: ${{ steps.keygen.outputs.smcache_key }}
steps:
- uses: actions/checkout@v4

- name: Remove unneeded frameworks to recover disk space
run: sudo ./.github/cleanup-rootfs.sh

- name: Generate submodule cache key
id: keygen
run: echo "smcache_key=smcache-$(printf $(git submodule | sha1sum))" >> $GITHUB_OUTPUT

- name: Setup submodule cache
id: smcache
uses: actions/cache@v4
with:
enableCrossOsArchive: true
path: ${{ env.submodule_paths }}
key: ${{ steps.keygen.outputs.smcache_key }}

- name: Checkout required submodules
if: steps.smcache.outputs.cache-hit != 'true'
run: git submodule update --init -j $(nproc) --depth 1 $(echo ${submodule_paths} | sed '$d' | tr '\n' ' ')

- name: Storage size optimization
if: steps.smcache.outputs.cache-hit != 'true'
run: |
echo "Submodules env var: ${submodule_paths}"
git submodule foreach 'git maintenance run'
- name: Setup submodule cache
uses: actions/cache@v4
with:
enableCrossOsArchive: true
path: ${{ env.submodule_paths }}
key: submodule-cache-${{ github.run_id }}-${{ github.run_attempt }}

build:
runs-on: ${{ matrix.os }}
needs: [submodule_cache]
env:
smcache_key: ${{ needs.submodule_cache.outputs.key }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
Expand All @@ -76,7 +87,7 @@ jobs:
with:
enableCrossOsArchive: true
path: ${{ env.submodule_paths }}
key: submodule-cache-${{ github.run_id }}-${{ github.run_attempt }}
key: ${{ env.smcache_key }}

- name: build toolchain
run: |
Expand Down Expand Up @@ -129,6 +140,8 @@ jobs:
test-sim:
runs-on: ${{ matrix.os }}
needs: [submodule_cache]
env:
smcache_key: ${{ needs.submodule_cache.outputs.key }}
strategy:
matrix:
os: [ubuntu-24.04]
Expand All @@ -149,7 +162,7 @@ jobs:
with:
enableCrossOsArchive: true
path: ${{ env.submodule_paths }}
key: submodule-cache-${{ github.run_id }}-${{ github.run_attempt }}
key: ${{ env.smcache_key }}

- name: build toolchain
run: |
Expand Down

0 comments on commit e54290a

Please sign in to comment.