Skip to content

Commit 88a3783

Browse files
committed
wip: generate docs in CI
1 parent abbf7e5 commit 88a3783

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/docs.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
pull_request:
8+
branches: ["main"]
9+
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Install elan
23+
run: |
24+
set -o pipefail
25+
curl -sSfL https://github.com/leanprover/elan/releases/download/v3.0.0/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
26+
./elan-init -y --default-toolchain leanprover/lean4:v4.4.0-rc1
27+
echo "$HOME/.elan/bin" >> $GITHUB_PATH
28+
- name: Install Rust and Cargo
29+
run: |
30+
curl --proto '=https' -sSf https://sh.rustup.rs > rustup-init.sh
31+
sh rustup-init.sh -y --default-toolchain none
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
- name: Build egg-pre-dcp and CvxLean
35+
run: |
36+
./build.sh
37+
- name: Create dummy docs project
38+
run: |
39+
# Taken from https://github.com/leanprover-community/mathlib4_docs
40+
41+
# Workaround for the lake issue
42+
elan default leanprover/lean4:nightly
43+
lake new workaround
44+
cd workaround
45+
cp -f ../mathlib4/lean-toolchain .
46+
echo 'require «doc-gen4» from git "https://github.com/leanprover/doc-gen4" @ "main"' >> lakefile.lean
47+
echo 'require CvxLean from ".." / "CvxLean"' >> lakefile.lean
48+
49+
# doc-gen4 expects to work on github repos with at least one commit
50+
git config user.email "docs@verified-optimization.github.io"
51+
git config user.name "docs CI"
52+
git add .
53+
git commit -m "workaround"
54+
git remote add origin "https://github.com/verified-optimization/workaround"
55+
56+
mkdir -p .lake/packages
57+
cp -r ../mathlib4/.lake/packages/* .lake/packages
58+
lake update
59+
- name: Build doc-gen4
60+
working-directory: workaround
61+
run: |
62+
lake build doc-gen4
63+
- name: Generate docs
64+
working-directory: workaround
65+
run: |
66+
lake build CvxLean:docs
67+
- name: Upload artifact
68+
uses: actions/upload-pages-artifact@v1
69+
with:
70+
path: 'workaround/.lake/build/doc'
71+
- name: Deploy to GitHub Pages
72+
id: deployment
73+
uses: actions/deploy-pages@v1
74+
- name: Clean up
75+
if: always()
76+
run: |
77+
rm -rf CvxLean
78+
rm -rf workaround
79+
rm -rf $HOME/.elan
80+
rm -rf $HOME/.cache/mathlib

0 commit comments

Comments
 (0)