-
Notifications
You must be signed in to change notification settings - Fork 2
137 lines (126 loc) · 4.13 KB
/
Copy pathlean-morph.yml
File metadata and controls
137 lines (126 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Lean on Morph (Sharded Lean CI)
on:
workflow_dispatch:
inputs:
shards:
description: "Number of shards"
required: false
default: "8"
push:
branches: [main, develop]
paths:
- "**/*.lean"
- "**/lakefile.lean"
- ".github/workflows/lean-morph.yml"
pull_request:
branches: [main, develop]
paths:
- "**/*.lean"
- "**/lakefile.lean"
- ".github/workflows/lean-morph.yml"
permissions:
contents: read
jobs:
# Attempt Morph reusable workflow first; fallback to local sharded builds when MORPH is unavailable.
morph:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for MORPH_API_KEY
id: keycheck
run: |
if [ -z "${{ secrets.MORPH_API_KEY }}" ]; then
echo "missing=true" >> $GITHUB_OUTPUT
else
echo "missing=false" >> $GITHUB_OUTPUT
fi
- name: Invoke Morph Lean CI
if: steps.keycheck.outputs.missing == 'false'
env:
MORPH_API_KEY: ${{ secrets.MORPH_API_KEY }}
run: |
set -e
git clone --depth 1 https://github.com/SentinelOps-CI/morph-lean-ci tmp/morph-lean-ci
cd tmp/morph-lean-ci
bash run.sh \
--api-key "$MORPH_API_KEY" \
--shards "${{ inputs.shards || 8 }}" \
--targets "proofs,spec-templates/v1/proofs,Fabric.lean,Policy.lean,ProofBench.lean"
- name: Skip (no MORPH_API_KEY)
if: steps.keycheck.outputs.missing == 'true'
run: |
echo "Skipping Morph job: MORPH_API_KEY not set"
fallback-local:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8]
total: [8]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Lean toolchain and mathlib artifacts
uses: actions/cache@v4
with:
path: |
~/.elan
~/.cache/lake
vendor/mathlib/.lake
vendor/mathlib/.git
key: lean-morph-${{ hashFiles('lean-toolchain', 'scripts/vendor-mathlib.sh') }}
restore-keys: |
lean-morph-
- name: Set up Lean (elan)
run: |
curl -fsSL https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh | sh -s -- -y --default-toolchain none
echo "$HOME/.elan/bin" >> $GITHUB_PATH
export PATH="$HOME/.elan/bin:$PATH"
TOOLCHAIN=$(tr -d '\n\r' < lean-toolchain)
if ! elan toolchain list | grep -Fq "$TOOLCHAIN"; then
# ci-honesty: justified wave7-remediation
elan toolchain install "$TOOLCHAIN" || true
fi
elan override set "$TOOLCHAIN"
lean --version
- name: Vendor mathlib
timeout-minutes: 20
run: |
chmod +x scripts/vendor-mathlib.sh
bash scripts/vendor-mathlib.sh
- name: Prewarm caches (core libs & templates)
run: |
set -e
cd core/lean-libs
lake build
cd ../../spec-templates/v1/proofs
lake build
- name: Sharded build - bundles
run: |
set -e
SHARD=${{ matrix.shard }}
TOTAL=${{ matrix.total }}
i=0
for p in bundles/*/proofs; do
[ -d "$p" ] || continue
i=$((i+1))
idx=$(( (i-1) % TOTAL + 1 ))
if [ "$idx" -eq "$SHARD" ]; then
echo "[shard $SHARD/$TOTAL] building $p"
(cd "$p" && lake build)
fi
done
- name: Root Lean targets
run: |
set -e
# Compile top-level Lean entry points (non-sharded, cheap)
# ci-honesty: justified wave7-remediation
lean --make Fabric.lean || true
# ci-honesty: justified wave7-remediation
lean --make Policy.lean || true
# ci-honesty: justified wave7-remediation
lean --make ProofBench.lean || true
- name: Print snapshot info (if available)
run: |
echo "MORPH_SNAPSHOT_ID=${MORPH_SNAPSHOT_ID:-unavailable}"