A minimal, reusable CI template for running Lean 4 proofs on Morph Cloud's Infinibranch with intelligent caching and sharding.
-
Fork the Repository: Click the 'Fork' button at the top-right of this page.
-
Set Up Morph API Key:
- Navigate to your forked repository's settings.
- Under 'Secrets and variables' > 'Actions', add a new repository secret named
MORPH_API_KEYwith your Morph Cloud API key.
-
Trigger the Workflow:
- Go to the 'Actions' tab in your repository.
- Select the 'lean-ci' workflow.
- Click 'Run workflow' to start the CI process.
- Base Snapshot: Pre-built with Lean 4, Pantograph, and warmed mathlib cache
- Sharding: Configurable matrix of shards (default: 4) for parallel execution
- Caching: Mathlib and tactic states cached in snapshots for instant repro
- Failure Handling: Failing shards create snapshots for instant debugging
- Cold Start: ≤ p95 60s across 4 shards
- Warm Cache: ≤ p95 20s across 4 shards
/scripts
build_snapshot.py # Creates/refreshes base snapshot
run_shard.py # Runs tests on each shard
/examples/hello-lean # Minimal Lean project with proofs
lakefile.lean
Main.lean
.github/workflows/lean-ci.yml # GitHub Actions workflow
README.md
The pipeline automatically:
- Builds a cached Lean snapshot with mathlib
- Fans out to N configurable shards
- Runs
lake buildandlake teston each shard - Uploads logs and artifacts
- Preserves failing shard snapshots for instant repro
When a shard fails, the logs will contain a snapshot ID. You can instantly repro the failure:
morphcloud instance start <snapshot-id>
morphcloud instance ssh <instance-id>Modify .github/workflows/lean-ci.yml to adjust:
- Number of shards (default: 4)
- Resource allocation (vcpus, memory, disk)
- Timeout settings
- Matrix strategy