Repository navigation
158 lines (158 loc) · 5.98 KB
/
Copy pathdocs-build.yml
File metadata and controls
158 lines (158 loc) · 5.98 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Documentation build stage
'on':
workflow_call:
inputs:
phase:
required: true
type: string
stage:
required: true
type: string
build_revision:
required: true
type: string
previous_complete:
type: string
default: 'false'
outputs:
complete:
value: ${{ jobs.receipt.outputs.complete }}
permissions:
contents: read
actions: write
env:
DOCGEN_LOCAL_MODULE_ROOTS: LeanPool
DOCGEN_DEPS_DOCS_URL: https://leanprover-community.github.io/mathlib4_docs
DOCGEN_DEPS_DOCS_URLS: TauCeti=https://taucetiproject.github.io/TauCeti/docs
jobs:
build:
name: Documentation ${{ inputs.phase }} ${{ inputs.stage }}
if: inputs.phase == 'render' || inputs.previous_complete != 'true'
runs-on: ubuntu-latest
timeout-minutes: 330
outputs:
complete: ${{ steps.analysis.outputs.complete }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
- name: Restore Lean dependencies
id: dependency-cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
path: |
~/.elan
.lake/packages
key: LeanDependencies-v1-${{ runner.os }}-${{ hashFiles('lean-toolchain', 'lake-manifest.json') }}
- name: Restore pool build
id: pool-build
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
path: .lake/build
key: LeanPoolBuild-v1-${{ runner.os }}-${{ hashFiles('lean-toolchain', 'lake-manifest.json', 'lakefile.toml')
}}-${{ inputs.build_revision }}
restore-keys: |
LeanPoolBuild-v1-${{ runner.os }}-${{ hashFiles('lean-toolchain', 'lake-manifest.json', 'lakefile.toml') }}-
- name: Restore documentation checkpoint
id: docs-cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
path: |-
docbuild/.lake/build
.lake/packages/doc-gen4
.lake/packages/leansqlite
.lake/packages/UnicodeBasic
.lake/packages/BibtexQuery
.lake/packages/MD4Lean
key: DocsState-v1-${{ runner.os }}-${{ hashFiles('lean-toolchain', 'lakefile.toml', 'lake-manifest.json',
'docbuild/lakefile.toml', 'docbuild/lake-manifest.json') }}-${{ github.run_id }}-${{ github.run_attempt
}}-${{ inputs.stage }}
restore-keys: |
DocsState-v1-${{ runner.os }}-${{ hashFiles('lean-toolchain', 'lakefile.toml', 'lake-manifest.json', 'docbuild/lakefile.toml', 'docbuild/lake-manifest.json') }}-
- name: Install Lean
uses: leanprover/lean-action@38fbc41a8c28c4cbaec22d7f7de508ec2e7c0dd9
with:
auto-config: false
use-github-cache: false
use-mathlib-cache: false
- name: Install Mathlib cache
run: |
set -euo pipefail
~/.elan/bin/lake exe cache get
expected=$(jq -r '.packages[] | select(.name == "mathlib") | .rev' lake-manifest.json)
actual=$(git -C .lake/packages/mathlib rev-parse HEAD)
if [ "$actual" != "$expected" ]; then
echo "::error::Mathlib checkout $actual does not match lake-manifest.json ($expected)."
exit 1
fi
- name: Reuse matching Lean CI build
if: steps.pool-build.outputs.cache-hit != 'true'
env:
GH_TOKEN: ${{ github.token }}
BUILD_HEAD: ${{ github.event.pull_request.head.sha || github.sha }}
BUILD_EVENT: push
run: PYTHONPATH=python python3 -m lean_pool.ci_artifacts restore --head "$BUILD_HEAD" --event "$BUILD_EVENT"
- name: Verify documentation workspace
run: PYTHONPATH=python python3 -m lean_pool.documentation prepare
- name: Verify pinned doc-gen compatibility
run: cd docbuild && ~/.elan/bin/lake build doc-gen4
- name: Analyze a bounded batch
id: analysis
if: inputs.phase == 'analysis'
run: PYTHONPATH=python python3 -m lean_pool.documentation batch --seconds 5400 --lake /home/runner/.elan/bin/lake
- name: Save completed analysis batches
if: inputs.phase == 'analysis'
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
path: |-
docbuild/.lake/build
.lake/packages/doc-gen4
.lake/packages/leansqlite
.lake/packages/UnicodeBasic
.lake/packages/BibtexQuery
.lake/packages/MD4Lean
key: ${{ steps.docs-cache.outputs.cache-primary-key }}
- name: Render and validate the complete local API
if: inputs.phase == 'render'
run: PYTHONPATH=python python3 -m lean_pool.documentation render --lake /home/runner/.elan/bin/lake
- name: Upload documentation artifact
if: inputs.phase == 'render'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: documentation-site
path: docbuild/.lake/build/doc
if-no-files-found: error
retention-days: 3
- name: Upload documentation progress
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: documentation-progress-${{ inputs.stage }}
path: docbuild/.lake/build/documentation-progress.json
if-no-files-found: ignore
include-hidden-files: true
retention-days: 7
receipt:
needs: build
if: always()
runs-on: ubuntu-latest
outputs:
complete: ${{ steps.result.outputs.complete }}
steps:
- id: result
name: Report completed or reused analysis
env:
RESULT: ${{ needs.build.result }}
PREVIOUS: ${{ inputs.previous_complete }}
PHASE: ${{ inputs.phase }}
COMPLETE: ${{ needs.build.outputs.complete }}
run: |
set -euo pipefail
if [ "$RESULT" = skipped ]; then
test "$PHASE" = analysis
test "$PREVIOUS" = true
COMPLETE=true
else
test "$RESULT" = success
fi
echo "complete=${COMPLETE:-false}" >> "$GITHUB_OUTPUT"