-
Notifications
You must be signed in to change notification settings - Fork 240
152 lines (127 loc) · 4.57 KB
/
build-and-docs.yml
File metadata and controls
152 lines (127 loc) · 4.57 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
# Copyright 2025 The Formal Conjectures Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Build Lean project and deploy docs
on:
push:
branches:
- main
pull_request:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
name: Build project
steps:
- name: Checkout project
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install elan
run: |
set -o pipefail
curl -sSfL https://github.com/leanprover/elan/releases/download/v1.4.2/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
./elan-init -y --default-toolchain none
echo "$HOME/.elan/bin" >> $GITHUB_PATH
- name: Generate All.lean
run: |
lake exe mk_all --lib FormalConjectures || true
# Avoid including Test files from `Util/` to avoid inflating the
# stats. This stop-gap should be removed after doing the TODO at
# `fetchStatsMarkdown` in `docbuild/overwrite-index.lean`.
grep -v "FormalConjectures\.Util\." FormalConjectures.lean > FormalConjectures/All.lean
- name: Restore ~/.cache/mathlib
uses: actions/cache/restore@v3
with:
path: ~/.cache/mathlib
key: oleans-${{ hashFiles('lake-manifest.json') }}-${{ hashFiles('**/*.lean') }}
restore-keys: |
oleans-${{ hashFiles('lake-manifest.json') }}-
oleans-
- name: Get olean cache
run: |
lake exe cache unpack
lake exe cache get
- name: Build project
run: |
lake build
- name: Pack olean cache
run: |
lake exe cache pack
ls ~/.cache/mathlib
- name: Save ~/.cache/mathlib
uses: actions/cache/save@v3
with:
path: ~/.cache
key: oleans-${{ hashFiles('lake-manifest.json') }}-${{ hashFiles('**/*.lean') }}
- name: Prepare documentation
run: |
cd docbuild
export MATHLIB_NO_CACHE_ON_UPDATE=1 # avoids "Failed to prune ProofWidgets cloud release: no such file or directory"
lake update formal_conjectures
- name: Cache documentation
uses: actions/cache@v5
with:
path: docbuild/.lake/build/doc
key: MathlibDoc-${{ hashFiles('docbuild/lake-manifest.json') }}-${{ hashFiles('**/*.lean') }}
restore-keys: |
MathlibDoc-${{ hashFiles('docbuild/lake-manifest.json') }}-
MathlibDoc-
- name: Build documentation
run: |
cd docbuild
lake build FormalConjectures:docs
- name: Extract documentation
run: |
cd docbuild
mkdir out
lake query FormalConjectures:docs > out-files.txt
sed -i 's|^.*\.lake/build/doc/||' out-files.txt
echo "::group::Generated files"
cat out-files.txt
echo "::endgroup::"
rsync -a --files-from=out-files.txt --relative .lake/build/doc ./out
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12.9'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pandas==2.2.3 numpy==2.2.3 plotly==5.20.0
- name: Run plotting script
run: |
python docbuild/scripts/plot_growth.py
- name: Inject stats into index.html
shell: bash
run: |
cd docbuild
lake exe overwrite_index ./out/index.html ./out/file_counts.html | tee -a "$GITHUB_STEP_SUMMARY"
- name: Upload docs
id: deployment
uses: actions/upload-pages-artifact@v4
with:
path: docbuild/out
# Deployment job
deploy:
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4