-
Notifications
You must be signed in to change notification settings - Fork 6
173 lines (143 loc) · 5.49 KB
/
Copy pathdocs.yaml
File metadata and controls
173 lines (143 loc) · 5.49 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: build and deploy mathlib4 docs
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
schedule:
- cron: '0 */8 * * *' # every 8 hours
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
name: build and deploy mathlib4 docs
runs-on: doc-gen
steps:
- name: clean up
run: |
rm -rf mathlib4_docs
rm -rf mathlib4
rm -rf workaround
rm -rf $HOME/.elan
rm -rf $HOME/.cache/mathlib
- name: Checkout repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
repository: leanprover-community/mathlib4_docs
path: mathlib4_docs
- name: Checkout mathlib
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
repository: leanprover-community/mathlib4
path: mathlib4
- 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
echo "$HOME/.elan/bin" >> $GITHUB_PATH
- name: set default toolchain
working-directory: mathlib4
run: |
elan default $(cat lean-toolchain)
- name: get cache
working-directory: mathlib4
run: lake exe cache get
- name: build mathlib
working-directory: mathlib4
run: env LEAN_ABORT_ON_PANIC=1 lake build
- name: create dummy docs project
run: |
lake new workaround lib
cd workaround
cp -f ../mathlib4/lean-toolchain .
cp -f ../mathlib4_docs/lakefile.toml .
# doc-gen4 expects to work on github repos with at least one commit
git config user.email "mathlib4_docs@leanprover-community.github.io"
git config user.name "mathlib4_docs CI"
git add .
git commit -m "workaround"
git remote add origin "https://github.com/leanprover-community/workaround"
mkdir -p .lake/packages
cp -r ../mathlib4/.lake/packages/* .lake/packages
lake update
# Copy references.bib over while doc-gen lacks support for subproject references.bib
mkdir docs/
cp ../mathlib4/docs/references.bib docs/references.bib
- name: build doc-gen4
working-directory: workaround
run: |
lake build doc-gen4
- name: build import graph
working-directory: mathlib4
run: |
lake exe graph mathlib.html
- name: generate docs
working-directory: workaround
run: |
lake build Batteries:docs Qq:docs Aesop:docs ProofWidgets:docs Mathlib:docs Archive:docs Counterexamples:docs docs:docs
lake build Mathlib:docsHeader
- name: copy extra files
run: |
cp mathlib4/docs/{100.yaml,1000.yaml,overview.yaml,undergrad.yaml} workaround/.lake/build/doc
- name: copy import graph
run: |
cp mathlib4/mathlib.html workaround/.lake/build/doc
- name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: 'workaround/.lake/build/doc'
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
- name: clean up
if: always()
run: |
rm -rf mathlib4_docs
rm -rf mathlib4
rm -rf workaround
rm -rf $HOME/.elan
rm -rf $HOME/.cache/mathlib
notify_if_failed:
runs-on: ubuntu-latest
needs: build
if: always() && github.event_name != 'pull_request'
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Get job status and URLs
id: get-status
env:
GH_TOKEN: ${{ github.token }}
run: |
JOB_NAME="build and deploy mathlib4 docs"
# Get URL and conclusion for the specific job
JOB_DATA=$(gh run view ${{ github.run_id }} --json jobs --jq \
".jobs[] | select(.name == \"$JOB_NAME\")")
JOB_URL=$(echo "$JOB_DATA" | jq -r '.url')
JOB_CONCLUSION=$(echo "$JOB_DATA" | jq -r '.conclusion')
echo "job_url=${JOB_URL}" | tee -a "$GITHUB_OUTPUT"
echo "job_conclusion=${JOB_CONCLUSION}" | tee -a "$GITHUB_OUTPUT"
- name: Post failure / cancelled message for mathlib_test_executable on Zulip
if: steps.get-status.outputs.job_conclusion != 'success'
uses: zulip/github-actions-zulip/send-message@bd8ec52de371d139ae8313661b7d8318c19266aa # v2.0.1
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: 'leanprover-community-monitor-runners-bot@leanprover.zulipchat.com'
organization-url: 'https://leanprover.zulipchat.com'
to: 'nightly-testing-mathlib'
type: 'stream'
topic: 'mathlib4_docs failure'
content: |
❌ mathlib4_docs [${{ steps.get-status.outputs.job_conclusion }}](${{ steps.get-status.outputs.job_url }}) on ${{ github.sha }}
workflow-keepalive:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: liskin/gh-workflow-keepalive@f72ff1a1336129f29bf0166c0fd0ca6cf1bcb38c # v1.2.1