Skip to content

Commit 8b08be4

Browse files
committed
ci: add cabal-cache logic
1 parent f50c11e commit 8b08be4

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,23 @@ jobs:
2020
- name: install-nix
2121
uses: DeterminateSystems/nix-installer-action@v16
2222

23+
- name: gen-plan-json
24+
id: gen-plan-json
25+
run: |
26+
nix develop --command bash -c 'cd frontend && wasm32-wasi-cabal update && wasm32-wasi-cabal build ghc-wasm-reflex-examples --dry-run && echo WASM32_WASI_GHC=$(which wasm32-wasi-ghc) >> $GITHUB_OUTPUT'
27+
28+
- name: cabal-cache
29+
uses: actions/cache@v4
30+
with:
31+
key: nix-${{ hashFiles('dist-newstyle/cache/plan.json') }}
32+
restore-keys: nix-
33+
path: |
34+
~/.ghc-wasm/.cabal/store
35+
dist-newstyle
36+
2337
- name: build-frontend
2438
run: |
25-
nix develop --command bash -c "cd frontend && wasm32-wasi-cabal update && exec ./build.sh --low-memory-unused --converge --gufa --flatten --rereloop -Oz"
39+
nix develop --command bash -c "cd frontend && exec ./build.sh --low-memory-unused --converge --gufa --flatten --rereloop -Oz"
2640
2741
ghcup-build:
2842
name: ghcup-build
@@ -56,14 +70,32 @@ jobs:
5670
ghcup config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/develop/ghcup-cross-0.0.8.yaml
5771
ghcup install ghc --set wasm32-wasi-9.10.1.20241021 -- $CONFIGURE_ARGS
5872
59-
- name: build-frontend
73+
- name: gen-plan-json
6074
run: |
6175
cd frontend
6276
cabal \
6377
--with-compiler=wasm32-wasi-ghc \
6478
--with-hc-pkg=wasm32-wasi-ghc-pkg \
6579
--with-hsc2hs=wasm32-wasi-hsc2hs \
6680
update
81+
cabal \
82+
--with-compiler=wasm32-wasi-ghc \
83+
--with-hc-pkg=wasm32-wasi-ghc-pkg \
84+
--with-hsc2hs=wasm32-wasi-hsc2hs \
85+
build ghc-wasm-reflex-examples --dry-run
86+
87+
- name: cabal-cache
88+
uses: actions/cache@v4
89+
with:
90+
key: ghcup-${{ hashFiles('dist-newstyle/cache/plan.json') }}
91+
restore-keys: ghcup-
92+
path: |
93+
~/.local/state/cabal/store
94+
dist-newstyle
95+
96+
- name: build-frontend
97+
run: |
98+
cd frontend
6799
./build.sh --low-memory-unused --converge --gufa --flatten --rereloop -Oz
68100
69101
non-nix-build:
@@ -93,6 +125,20 @@ jobs:
93125
env:
94126
FLAVOUR: '9.10'
95127

128+
- name: gen-plan-json
129+
run: |
130+
cd frontend
131+
wasm32-wasi-cabal build ghc-wasm-reflex-examples --dry-run
132+
133+
- name: cabal-cache
134+
uses: actions/cache@v4
135+
with:
136+
key: vanilla-${{ hashFiles('dist-newstyle/cache/plan.json') }}
137+
restore-keys: vanilla-
138+
path: |
139+
~/.ghc-wasm/.cabal/store
140+
dist-newstyle
141+
96142
- name: build-frontend
97143
run: |
98144
cd frontend

0 commit comments

Comments
 (0)