|
4 | 4 | # proof-regression.yml — Verify that formal proofs still compile after code changes. |
5 | 5 | # Covers: Lean 4 mechanized proofs (jtv_proofs/) and Idris2 ABI types (src/abi/). |
6 | 6 | # Taxonomy category: Proof Regression (PRF) |
| 7 | +# |
| 8 | +# NOTE: existence checks are performed in a post-checkout STEP rather than a |
| 9 | +# job-level `if: hashFiles(...)`. `hashFiles` at job-condition time runs before |
| 10 | +# checkout (empty workspace), which can produce a workflow "startup_failure" |
| 11 | +# run with zero scheduled jobs. Guarding per-step after checkout is reliable. |
7 | 12 | name: Proof Regression |
8 | 13 |
|
9 | 14 | on: |
@@ -36,59 +41,97 @@ jobs: |
36 | 41 | lean4-proofs: |
37 | 42 | name: Lean 4 proof verification |
38 | 43 | runs-on: ubuntu-latest |
39 | | - if: hashFiles('jtv_proofs/lakefile.lean') != '' |
| 44 | + timeout-minutes: 30 |
40 | 45 |
|
41 | 46 | steps: |
42 | 47 | - name: Checkout repository |
43 | 48 | uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
44 | 49 |
|
| 50 | + - name: Detect Lean proof project |
| 51 | + id: detect |
| 52 | + run: | |
| 53 | + if [ -f jtv_proofs/lakefile.lean ]; then |
| 54 | + echo "present=true" >> "$GITHUB_OUTPUT" |
| 55 | + else |
| 56 | + echo "present=false" >> "$GITHUB_OUTPUT" |
| 57 | + echo "No jtv_proofs/lakefile.lean — skipping Lean verification." |
| 58 | + fi |
| 59 | +
|
45 | 60 | - name: Install elan (Lean toolchain manager) |
| 61 | + if: steps.detect.outputs.present == 'true' |
46 | 62 | run: | |
47 | 63 | curl -sSf https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh | sh -s -- -y --default-toolchain none |
48 | 64 | echo "$HOME/.elan/bin" >> "$GITHUB_PATH" |
49 | 65 |
|
50 | | - - name: Cache Lean build |
51 | | - uses: actions/cache@v4 |
52 | | - with: |
53 | | - path: | |
54 | | - jtv_proofs/.lake |
55 | | - jtv_proofs/build |
56 | | - key: lean4-${{ hashFiles('jtv_proofs/lakefile.lean', 'jtv_proofs/lean-toolchain') }} |
57 | | - restore-keys: lean4- |
| 66 | + # NOTE: no actions/cache step — a pinned cache SHA can be auto-failed by |
| 67 | + # GitHub when that release is deprecated, and a cold Lean build is fine for |
| 68 | + # this path-filtered job. Re-add a *current* actions/cache@v4 SHA if build |
| 69 | + # time becomes a problem. |
58 | 70 |
|
59 | 71 | - name: Build Lean proofs |
| 72 | + if: steps.detect.outputs.present == 'true' |
60 | 73 | working-directory: jtv_proofs |
61 | 74 | run: | |
62 | 75 | lake build |
63 | | - echo "## Lean 4 Proof Verification" >> "$GITHUB_STEP_SUMMARY" |
64 | | - echo "" >> "$GITHUB_STEP_SUMMARY" |
65 | | - echo "All proofs compiled successfully." >> "$GITHUB_STEP_SUMMARY" |
| 76 | + { |
| 77 | + echo "## Lean 4 Proof Verification" |
| 78 | + echo "" |
| 79 | + echo "All proofs compiled successfully." |
| 80 | + } >> "$GITHUB_STEP_SUMMARY" |
66 | 81 |
|
67 | 82 | idris2-abi: |
68 | 83 | name: Idris2 ABI type verification |
69 | 84 | runs-on: ubuntu-latest |
70 | | - if: hashFiles('src/abi/Types.idr') != '' |
| 85 | + # Generous: when no distro package exists, idris2-pack bootstraps Idris2 |
| 86 | + # from source against a Chez Scheme backend, which is slow. |
| 87 | + timeout-minutes: 60 |
71 | 88 |
|
72 | 89 | steps: |
73 | 90 | - name: Checkout repository |
74 | 91 | uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
75 | 92 |
|
| 93 | + - name: Detect Idris2 ABI sources |
| 94 | + id: detect |
| 95 | + run: | |
| 96 | + if [ -f src/abi/Types.idr ]; then |
| 97 | + echo "present=true" >> "$GITHUB_OUTPUT" |
| 98 | + else |
| 99 | + echo "present=false" >> "$GITHUB_OUTPUT" |
| 100 | + echo "No src/abi/Types.idr — skipping Idris2 verification." |
| 101 | + fi |
| 102 | +
|
76 | 103 | - name: Install Idris2 |
| 104 | + if: steps.detect.outputs.present == 'true' |
77 | 105 | run: | |
78 | 106 | sudo apt-get update |
79 | | - sudo apt-get install -y idris2 || { |
80 | | - # Fallback: install from pack |
81 | | - curl -sSf https://raw.githubusercontent.com/stefan-hoeck/idris2-pack/main/install.bash | bash |
| 107 | + # Prefer the distro package. If unavailable, bootstrap via idris2-pack. |
| 108 | + if ! sudo apt-get install -y idris2; then |
| 109 | + # idris2-pack needs a Chez Scheme backend. |
| 110 | + sudo apt-get install -y chezscheme |
| 111 | + # Debian/Ubuntu name the Chez binary `chez`; fall back to others. |
| 112 | + scheme_bin="$(command -v chez || command -v chezscheme || command -v scheme || echo chez)" |
| 113 | + echo "Using Scheme backend: $scheme_bin" |
| 114 | + # IMPORTANT: download the installer to a FILE. Running it via |
| 115 | + # `curl | bash` makes its interactive `read SCHEME` consume the |
| 116 | + # script's own text as the answer. With a file + the Scheme name on |
| 117 | + # stdin, the prompt is answered correctly and later reads hit EOF |
| 118 | + # (taking defaults). |
| 119 | + curl -sSfL -o /tmp/idris2-pack-install.bash \ |
| 120 | + https://raw.githubusercontent.com/stefan-hoeck/idris2-pack/main/install.bash |
| 121 | + printf '%s\n' "$scheme_bin" | bash /tmp/idris2-pack-install.bash |
82 | 122 | echo "$HOME/.pack/bin" >> "$GITHUB_PATH" |
83 | | - } |
| 123 | + fi |
84 | 124 |
|
85 | 125 | - name: Check Idris2 ABI types |
| 126 | + if: steps.detect.outputs.present == 'true' |
86 | 127 | run: | |
87 | 128 | cd src/abi |
88 | 129 | idris2 --check Types.idr || { |
89 | 130 | echo "::error::Idris2 ABI type definitions failed to compile" |
90 | 131 | exit 1 |
91 | 132 | } |
92 | | - echo "## Idris2 ABI Verification" >> "$GITHUB_STEP_SUMMARY" |
93 | | - echo "" >> "$GITHUB_STEP_SUMMARY" |
94 | | - echo "ABI type definitions verified successfully." >> "$GITHUB_STEP_SUMMARY" |
| 133 | + { |
| 134 | + echo "## Idris2 ABI Verification" |
| 135 | + echo "" |
| 136 | + echo "ABI type definitions verified successfully." |
| 137 | + } >> "$GITHUB_STEP_SUMMARY" |
0 commit comments