Skip to content

Commit d405918

Browse files
cometkimfhammerschmidt
authored andcommitted
CI: experiment state cache for incremental build (#7360)
1 parent 8b99821 commit d405918

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,24 @@ jobs:
244244
fi
245245
shell: bash
246246

247+
- name: Compiler build state key
248+
id: compiler-build-state-key
249+
shell: bash
250+
run: |
251+
echo "value=compiler-build-state-v1-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }}" \
252+
| sed 's/,/-/g' >> "$GITHUB_OUTPUT"
253+
254+
- name: Restore compiler build state
255+
if: github.base_ref == 'master'
256+
id: compiler-build-state
257+
uses: actions/cache/restore@v4
258+
with:
259+
path: |
260+
D:\.cache\dune
261+
~/.cache/dune
262+
_build
263+
key: ${{ steps.compiler-build-state-key.outputs.value }}
264+
247265
- name: Build compiler
248266
if: runner.os != 'Linux'
249267
run: opam exec -- dune build --display quiet --profile release
@@ -252,6 +270,16 @@ jobs:
252270
if: runner.os == 'Linux'
253271
run: opam exec -- dune build --display quiet --profile static
254272

273+
- name: Save compiler build state
274+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
275+
uses: actions/cache/save@v4
276+
with:
277+
path: |
278+
D:\.cache\dune
279+
~/.cache/dune
280+
_build
281+
key: ${{ steps.compiler-build-state-key.outputs.value }}
282+
255283
- name: Install npm packages
256284
run: npm ci --ignore-scripts
257285

0 commit comments

Comments
 (0)