-
-
Notifications
You must be signed in to change notification settings - Fork 132
158 lines (147 loc) · 4 KB
/
ci.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
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
name: Napkin CI
on:
push:
branches: ["main"]
pull_request:
branches: ["*"]
permissions:
contents: read
jobs:
spellcheck:
runs-on: ubuntu-latest
name: "Spellcheck"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade codespell
- name: Run spellcheck
run: |
codespell $(git ls-files '*.tex')
build:
runs-on: ubuntu-latest
name: "Compile document"
permissions:
actions: write
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install TeX Live
run: |
sudo apt update
sudo apt install -y biber texlive-base texlive-latex-recommended texlive-latex-extra texlive-science
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install more packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: |
latexmk asymptote ghostscript qpdf
- name: Restore cache
uses: actions/cache/restore@v4
with:
key: "napkin-cache"
path: |
**/*.aux
**/*.out
Napkin.bbl
Napkin.bcf
Napkin.blg
Napkin.fdb_latexmk
Napkin.fls
Napkin.log
Napkin.maf
Napkin.mtc
Napkin.mtc0
Napkin.pre
Napkin.ptc*
Napkin.run.xml
Napkin.synctex.gz
Napkin.toc
asy/Napkin-*.asy
asy/Napkin-*.pdf
- name: Compile document
run: latexmk -pdflatex -interaction=nonstopmode -file-line-error Napkin.tex
- name: Save cache
uses: actions/cache/save@v4
with:
key: "napkin-cache"
path: |
**/*.aux
**/*.out
Napkin.bbl
Napkin.bcf
Napkin.blg
Napkin.fdb_latexmk
Napkin.fls
Napkin.log
Napkin.maf
Napkin.mtc
Napkin.mtc0
Napkin.pre
Napkin.ptc*
Napkin.run.xml
Napkin.synctex.gz
Napkin.toc
asy/Napkin-*.asy
asy/Napkin-*.pdf
- name: Compile flowchart
run: |
./export-flowchart.sh
- name: Extract table of contents
run: |
python3 print-toc.py --parts --chapters --numbers > toc.txt
- name: Extract per-part PDF's
run: |
python3 print-toc.py --qpdf | bash
- name: Create dist folder
run: |
mkdir -p dist
mkdir -p dist/figures
mkdir -p dist/Parts/
cp Napkin.log dist/
cp Napkin.pdf dist/
cp asy/*.asy dist/figures/
cp asy/*.pdf dist/figures/
mv flowchart.png dist/
mv toc.txt dist/
mv part-*.pdf dist/Parts
cd dist
tree -H '.' -I "index.html" -D --charset utf-8 --filesfirst -T "An Infinitely Large Napkin: All Generated Files" >index.html
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload PDF artifact
uses: actions/upload-artifact@v4
with:
path: Napkin.pdf
name: Napkin.pdf
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist/
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push'
name: "Deploy to GitHub Pages"
needs: build
permissions:
actions: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4