-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (171 loc) · 4.97 KB
/
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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: Documents
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
jupyter-book:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r doc/requirements.txt
- name: Build Jupyter Book
run: |
jupyter-book build doc
ERROR_LOGS=$(find doc/_build -type f -name "*.err.log")
if [ -n "$ERROR_LOGS" ]; then while IFS= read -r log; do echo "[ERROR LOG] $log" && cat "$log"; done <<< "$ERROR_LOGS" && exit 1; fi
- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: doc-jupyter-book
path: ./doc/_build/html
retention-days: 30
protobuf:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
- name: Generate API docs
run: buf generate --template buf.gen.docs.yaml
working-directory: proto
- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: doc-protobuf
path: ./doc
retention-days: 30
rust:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Check warnings in documents
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps
env:
RUSTDOCFLAGS: -D warnings
- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: doc-rust
path: ./target/doc
retention-days: 30
python:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install dependencies
run: |
pip install "python/ommx[dev]"
pip install "python/ommx-python-mip-adapter[dev]"
- name: Build Python documentation
run: |
sphinx-build -b html ./python/ommx/docs/source ./python/ommx/docs/build
- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: doc-python-ommx
path: ./python/ommx/docs/build
retention-days: 30
- name: Build Python documentation
run: |
sphinx-build -b html ./python/ommx-python-mip-adapter/docs/source ./python/ommx-python-mip-adapter/docs/build
- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: doc-python-ommx-python-mip-adapter
path: ./python/ommx-python-mip-adapter/docs/build
retention-days: 30
package:
needs: [jupyter-book, protobuf, rust, python]
runs-on: ubuntu-latest
steps:
- name: Download HTML of JupyterBook
uses: actions/download-artifact@v4
with:
name: doc-jupyter-book
path: ./doc
- name: Download HTML of protobuf
uses: actions/download-artifact@v4
with:
name: doc-protobuf
path: ./doc
- name: Download HTML of rust
uses: actions/download-artifact@v4
with:
name: doc-rust
path: ./doc/rust
- name: Download HTML of python
uses: actions/download-artifact@v4
with:
name: doc-python-ommx
path: ./doc/python/ommx
- name: Download HTML of python
uses: actions/download-artifact@v4
with:
name: doc-python-ommx-python-mip-adapter
path: ./doc/python/ommx-python-mip-adapter
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: doc
path: doc
retention-days: 30
deploy:
if: github.ref == 'refs/heads/main'
needs: package
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Download HTML
uses: actions/download-artifact@v4
with:
name: doc
path: .
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "."
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4