-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 2.56 KB
/
ci-lean.yml
File metadata and controls
69 lines (56 loc) · 2.56 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
# ============================================================
# .github/workflows/ci-lean.yml (Continuous Integration)
# ============================================================
# SOURCE: https://github.com/denisecase/templates
#
# WHY-FILE: Lean deliverables are proofs; broken proofs must not merge.
# REQ: Any check that can be run locally MUST be available locally via pre-commit.
# REQ: CI MUST NOT introduce arbitrary rules that are not reproducible locally.
name: CI Lean
# WHY: Validate repo contents on pushes to main branch and pull requests.
on:
push:
branches: [main] # WHY: Run when pushing to main branch.
pull_request:
branches: [main] # WHY: Run on pull requests targeting main branch.
workflow_dispatch: # WHY: Allow manual triggering from Actions tab.
permissions: # WHY: Use least privileges required.
contents: read
env:
PYTHONUNBUFFERED: "1" # WHY: Real-time logging.
PYTHONIOENCODING: "utf-8" # WHY: Ensure UTF-8 encoding for international characters.
jobs:
ci:
name: Repository checks
runs-on: ubuntu-latest # WHY: Linux environment matches most production deployments
timeout-minutes: 10 # WHY: Prevent hanging jobs. If over time, likely stuck.
steps:
# ============================================================
# ASSEMBLE: Get code and set up environment
# ============================================================
- name: A1) Checkout repository code
# WHY: Needed to access files for checks.
uses: actions/checkout@v6
- name: A2) Run pre-commit (all files)
# WHY: Single source of truth for locally runnable quality gates.
# OBS: Fails if hooks would modify files; does not commit changes.
id: precommit # WHY: Identify step for conditional follow-up. # WHY: Identify step for conditional follow-up.
uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
- name: A2f) If pre-commit failed, run it locally
if: failure()
run: |
echo "## Pre-commit failed" >> "$GITHUB_STEP_SUMMARY"
echo "Please run pre-commit locally and commit the resulting changes." >> "$GITHUB_STEP_SUMMARY"
build:
name: Build Lean (compile)
runs-on: ubuntu-latest
timeout-minutes: 20
needs: ci # WHY: Build only if ci job succeeds.
steps:
# ============================================================
# BUILD: Get code and build Lean project
# ============================================================
- uses: actions/checkout@v6
- uses: leanprover/lean-action@v1