Skip to content

Commit ffcc3ed

Browse files
committed
ci(agda): cache .agdai interface files to skip the cold recompile
Every CI run started from a fresh runner with no Agda interface cache, so each push retypechecked the whole stdlib subset plus the entire ordinal/Buchholz development from scratch — the multi-minute cold pass. Pin the stdlib and absolute-zero clones to fixed $HOME paths and add an actions/cache step keyed on the proof sources hash + absolute-zero commit, with restore-keys for a warm partial cache on source changes. Agda validates every .agdai against its source, so a stale cache only costs extra recompilation, never correctness.
1 parent 78950b2 commit ffcc3ed

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/agda.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ jobs:
2626
- name: Fetch Agda standard library (v2.3)
2727
id: stdlib
2828
run: |
29-
STDLIB_DIR="$RUNNER_TEMP/agda-stdlib"
29+
STDLIB_DIR="$HOME/agda-stdlib"
3030
git clone --depth 1 --branch v2.3 https://github.com/agda/agda-stdlib.git "$STDLIB_DIR"
3131
echo "stdlib_dir=$STDLIB_DIR" >> "$GITHUB_OUTPUT"
3232
3333
- name: Fetch absolute-zero library
3434
id: absz
3535
run: |
36-
ABSZ_DIR="$RUNNER_TEMP/absolute-zero"
36+
ABSZ_DIR="$HOME/absolute-zero"
3737
git clone --depth 1 https://github.com/hyperpolymath/absolute-zero.git "$ABSZ_DIR"
38+
echo "absz_commit=$(git -C "$ABSZ_DIR" rev-parse HEAD)" >> "$GITHUB_OUTPUT"
3839
echo "absz_dir=$ABSZ_DIR" >> "$GITHUB_OUTPUT"
3940
4041
- name: Register libraries for Agda
@@ -56,6 +57,25 @@ jobs:
5657
printf '%s\n%s\n' "$STDLIB_LIB" "$ABSZ_LIB" > "$HOME/.agda/libraries"
5758
printf '%s\n' "standard-library" > "$HOME/.agda/defaults"
5859
60+
# Cache Agda interface (.agdai) files. A fresh runner otherwise
61+
# recompiles the entire stdlib subset + the whole proof development
62+
# from scratch every run (the multi-minute cold pass). Agda validates
63+
# each .agdai against its source, so a stale cache is always safe —
64+
# it just means more modules recompile. The key rotates on any proof
65+
# source change or absolute-zero bump; restore-keys give a warm
66+
# partial cache even when it does.
67+
- name: Cache Agda interface files
68+
uses: actions/cache@v4
69+
with:
70+
path: |
71+
~/agda-stdlib/**/*.agdai
72+
~/absolute-zero/**/*.agdai
73+
proofs/agda/**/*.agdai
74+
key: agdai-${{ runner.os }}-agda2.6.3-stdlib2.3-absz${{ steps.absz.outputs.absz_commit }}-${{ hashFiles('proofs/agda/**/*.agda') }}
75+
restore-keys: |
76+
agdai-${{ runner.os }}-agda2.6.3-stdlib2.3-absz${{ steps.absz.outputs.absz_commit }}-
77+
agdai-${{ runner.os }}-agda2.6.3-stdlib2.3-
78+
5979
- name: Typecheck full suite
6080
run: agda -i proofs/agda proofs/agda/All.agda
6181

0 commit comments

Comments
 (0)