Skip to content

Commit 2fa0589

Browse files
committed
Also cache dist-newstyle
1 parent b98a610 commit 2fa0589

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

.github/workflows/wasm.yaml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,26 @@ jobs:
1717
path: als
1818
submodules: recursive
1919

20+
- name: Compute cache key
21+
run: echo "CI_CACHE_KEY=${{ runner.os }}-${{ runner.arch }}-${{ env.GHC_WASM_META_COMMIT_HASH }}-flavor-${{ env.GHC_WASM_META_FLAVOUR }}" >> "$GITHUB_ENV"
22+
2023
- name: Try to restore cached .ghc-wasm
2124
id: ghc-wasm-cache-restore
2225
uses: actions/cache/restore@v4
2326
with:
24-
path: ~/.ghc-wasm
25-
key: 'ghc-wasm-${{ runner.os }}-${{ runner.arch }}-${{ env.GHC_WASM_META_COMMIT_HASH }}-flavor-${{ env.GHC_WASM_META_FLAVOUR }}'
27+
path: |
28+
~/.cabal
29+
~/.ghc-wasm
30+
key: ghc-wasm-${{ env.CI_CACHE_KEY }}
31+
32+
- name: Try to restore cached dist-newstyle
33+
id: dist-newstyle-cache-restore
34+
uses: actions/cache/restore@v4
35+
with:
36+
path: dist-newstyle
37+
key: dist-newstyle-${{ env.CI_CACHE_KEY }}-${{ hashFiles('dist-newstyle/**') }}
2638
restore-keys: |
27-
'ghc-wasm-${{ runner.os }}-${{ runner.arch }}-${{ env.GHC_WASM_META_COMMIT_HASH }}-flavor-${{ env.GHC_WASM_META_FLAVOUR }}-'
39+
dist-newstyle-${{ env.CI_CACHE_KEY }}-
2840
2941
- name: Clone and setup ghc-wasm-meta
3042
id: ghc-wasm-setup
@@ -57,15 +69,24 @@ jobs:
5769
5870
- name: 'Build dep: lsp-types'
5971
uses: nick-fields/retry@v3
72+
id: build-dep-lsp-types
6073
with:
6174
timeout_minutes: 10
6275
max_attempts: 2
6376
command: cd als && wasm32-wasi-cabal build lib:lsp-types
6477

6578
- name: 'Build dep: agda'
79+
id: build-dep-agda
6680
working-directory: './als'
6781
run: wasm32-wasi-cabal build lib:agda
6882

83+
- name: Cache dist-newstyle
84+
uses: actions/cache/save@v4
85+
if: steps.build-dep-lsp-types.outcome == 'success' && steps.build-dep-agda.outcome == 'success'
86+
with:
87+
path: dist-newstyle
88+
key: dist-newstyle-${{ env.CI_CACHE_KEY }}-${{ hashFiles('dist-newstyle/**') }}
89+
6990
- name: Build every dependency else
7091
working-directory: './als'
7192
run: |
@@ -82,14 +103,16 @@ jobs:
82103
cp $(wasm32-wasi-cabal list-bin als) ~/out
83104
84105
- name: Clean up cabal logs
85-
run: rm -rf ~/.ghc-wasm/.cabal/logs
106+
run: rm -rf ~/.cabal/logs ~/.ghc-wasm/.cabal/logs
86107

87108
- name: Cache ghc-wasm-meta
88109
uses: actions/cache/save@v4
89110
if: always()
90111
with:
91-
path: ~/.ghc-wasm
92-
key: ${{ steps.ghc-wasm-cache-restore.outputs.cache-primary-key }}-${{ hashFiles('.ghc-wasm/**') }}
112+
path:
113+
~/.cabal
114+
~/.ghc-wasm
115+
key: ${{ steps.ghc-wasm-cache-restore.outputs.cache-primary-key }}
93116

94117
- name: Upload artifact
95118
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)