-
Notifications
You must be signed in to change notification settings - Fork 4
98 lines (82 loc) · 3.04 KB
/
lean_doc.yml
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
on:
push:
jobs:
build_docs:
runs-on: ubuntu-latest
name: Build docs
environment:
name: documentation
url: https://pygae.github.io/lean-ga-docs
steps:
- name: 📁 Checkout project
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 🔧 Install elan
run: |
set -o pipefail
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- --default-toolchain none -y
~/.elan/bin/lean --version
echo "$HOME/.elan/bin" >> $GITHUB_PATH
- name: 🐍 Install Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: 📁 Checkout Lean's doc-gen
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: leanprover-community/doc-gen
path: doc-gen
- name: 🐍 Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r doc-gen/requirements.txt
ls doc-gen
- name: ✏️ Mangle paths for doc-gen
run: |
lean_version="$(sed '/^lean_version/!d;s/.*"\(.*\)".*/\1/' leanpkg.toml)"
mathlib_git_hash="$(sed '/rev/!d;s/.*"\([a-z0-9]*\)".*/\1/' leanpkg.toml)"
cd doc-gen
sed -i "s/rev = \"\S*\"/rev = \"$mathlib_git_hash\"/" leanpkg.toml
# Force doc_gen project to match the Lean version used in CI.
# If they are incompatible, something in doc_gen will fail to compile,
# but this is better than trying to recompile all of mathlib.
elan override set "$lean_version"
leanproject get-mathlib-cache
echo -e "path ../src" >> leanpkg.path
cat leanpkg.path
(cd ../src;
find "." -name \*.lean -not -name all.lean \
| sed 's,^\./,,;s,\.lean$,,;s,/,.,g;s,^,import ,' \
| sort >./all.lean)
cp _target/deps/mathlib/docs/references.bib ../docs
cat ../src/all.lean
lean --path
- name: 🔧 Build the lean code
run: |
cd doc-gen
lean -v
lean --make src/entrypoint.lean
- name: 📝 Export Lean symbol information
run: |
cd doc-gen
lean --run src/entrypoint.lean > export.json
- name: 📚 Build HTML docs
run: |
cd doc-gen
python3 \
-c "import print_docs; del print_docs.extra_doc_files[:]; print_docs.copy_yaml_bib_files = lambda p: None; print_docs.library_link_roots['lean-ga'] = 'https://github.com/pygae/lean-ga/blob/$GITHUB_SHA/src/'; print_docs.main()" \
-r .. -w 'https://pygae.github.io/lean-ga-docs/' -t built-docs
- name: 🔑 Install SSH Client
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: 🚀 Deploy
uses: JamesIves/[email protected]
with:
SSH: true
SINGLE_COMMIT: true
REPOSITORY_NAME: pygae/lean-ga-docs
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: doc-gen/built-docs # The folder the action should deploy.