Skip to content

Commit 37ba102

Browse files
authored
1 parent ebab014 commit 37ba102

File tree

5 files changed

+63
-40
lines changed

5 files changed

+63
-40
lines changed

.github/workflows/push.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,10 @@ jobs:
5959
- name: Cache API docs
6060
uses: actions/cache@v4
6161
with:
62-
path: |
63-
docbuild/.lake/build/doc
64-
key: LakeBuildDoc-${{ runner.os }}-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}
62+
path: docbuild/.lake/build/doc
63+
key: LakeBuildDoc-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}
6564
restore-keys: LakeBuildDoc-
6665

67-
- name: Build project documentation
68-
working-directory: docbuild
69-
run: |
70-
MATHLIB_NO_CACHE_ON_UPDATE=1 ~/.elan/bin/lake update carleson || true
71-
~/.elan/bin/lake build Carleson:docs
72-
7366
- name: Build blueprint and copy to `docs/blueprint`
7467
uses: xu-cheng/texlive-action@v2
7568
with:
@@ -93,15 +86,8 @@ jobs:
9386
- name: Check declarations
9487
run: ~/.elan/bin/lake exe checkdecls blueprint/lean_decls
9588

96-
- name: Copy documentation to `docs/docs`
97-
run: |
98-
sudo chown -R runner docs
99-
cp -r docbuild/.lake/build/doc docs/docs
100-
101-
# - name: Remove lake files from documentation in `docs/docs`
102-
# run: |
103-
# find docs/docs -name "*.trace" -delete
104-
# find docs/docs -name "*.hash" -delete
89+
- name: Build project API documentation
90+
run: scripts/build_docs.sh
10591

10692
- name: Bundle dependencies
10793
uses: ruby/setup-ruby@v1

.github/workflows/push_pr.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ jobs:
2929
- name: Build project
3030
run: ~/.elan/bin/lake build Carleson
3131

32-
- name: Test carleson update in docbuild
33-
working-directory: docbuild
34-
run: |
35-
MATHLIB_NO_CACHE_ON_UPDATE=1 ~/.elan/bin/lake update carleson || true
32+
- name: Cache API docs
33+
uses: actions/cache@v4
34+
with:
35+
path: docbuild/.lake/build/doc
36+
key: LakeBuildDoc-${{ hashFiles('lean-toolchain') }}-${{ hashFiles('lake-manifest.json') }}
37+
restore-keys: LakeBuildDoc-
3638

3739
- name: Build blueprint and copy to `docs/blueprint`
3840
uses: xu-cheng/texlive-action@v2
@@ -54,3 +56,6 @@ jobs:
5456
5557
- name: Check declarations
5658
run: ~/.elan/bin/lake exe checkdecls blueprint/lean_decls
59+
60+
- name: Build project API documentation
61+
run: scripts/build_docs.sh

docbuild/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

docbuild/lakefile.toml

Lines changed: 0 additions & 15 deletions
This file was deleted.

scripts/build_docs.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
3+
# Exit immediately if a command exits with a non-zero status,
4+
# treat unset variables as an error, and ensure errors in pipelines are not masked.
5+
set -euo pipefail
6+
7+
# Build HTML documentation for Carleson
8+
# The output will be located in docs/docs
9+
10+
# Template lakefile.toml
11+
template() {
12+
cat <<EOF
13+
name = "docbuild"
14+
reservoir = false
15+
version = "0.1.0"
16+
packagesDir = "../.lake/packages"
17+
18+
[[require]]
19+
name = "carleson"
20+
path = "../"
21+
22+
[[require]]
23+
scope = "leanprover"
24+
name = "doc-gen4"
25+
rev = "TOOLCHAIN"
26+
EOF
27+
}
28+
29+
# Create a temporary docbuild folder
30+
mkdir -p docbuild
31+
32+
# Equip docbuild with the template lakefile.toml
33+
template > docbuild/lakefile.toml
34+
35+
# Substitute the toolchain from lean-toolchain into docbuild/lakefile.toml
36+
sed -i s/TOOLCHAIN/`grep -oP 'v4\..*' lean-toolchain`/ docbuild/lakefile.toml
37+
38+
# Initialise docbuild as a Lean project
39+
cd docbuild
40+
41+
# Disable an error message due to a non-blocking bug. See Zulip
42+
MATHLIB_NO_CACHE_ON_UPDATE=1 ~/.elan/bin/lake update carleson
43+
44+
# Build the docs
45+
~/.elan/bin/lake build Carleson:docs
46+
47+
# Copy documentation to `docs/docs`
48+
cd ../
49+
sudo chown -R runner docs
50+
cp -r docbuild/.lake/build/doc docs/docs

0 commit comments

Comments
 (0)