-
Notifications
You must be signed in to change notification settings - Fork 17
282 lines (239 loc) · 9.8 KB
/
antsibull-docs.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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# This workflow will run antsibull-docs tests
name: antsibull-docs tests
on:
push:
branches:
- main
- stable-*
pull_request:
branches:
- main
- stable-*
# Run once per week (Monday at 04:00 UTC)
schedule:
- cron: '0 4 * * 1'
jobs:
build-simple-docsite:
name: 'Build simple docsite (extra options: ${{ matrix.options }})'
runs-on: ubuntu-latest
strategy:
matrix:
options:
- '--use-current --sphinx-theme sphinx_rtd_theme'
- '--no-indexes --squash-hierarchy --intersphinx ansible7:https://docs.ansible.com/ansible/6/ community.crypto --collection-version 2.0.0'
python:
- '3.12'
antsibull_core_ref:
- main
- "stable-2"
antsibull_docs_parser_ref:
- main
antsibull_changelog_ref:
- main
include:
- options: '--use-current --use-html-blobs --no-breadcrumbs community.crypto community.docker --extra-conf antsibull_ext_color_scheme=none'
python: '3.9'
- options: '--use-current --output-format simplified-rst community.crypto community.docker'
python: '3.11'
steps:
- name: Check out antsibull-docs
uses: actions/checkout@v4
with:
path: antsibull-docs
- name: Check out dependent project antsibull-core
uses: actions/checkout@v4
with:
repository: ansible-community/antsibull-core
path: antsibull-core
ref: ${{ matrix.antsibull_core_ref }}
- name: Check out dependent project antsibull-docs-parser
uses: actions/checkout@v4
with:
repository: ansible-community/antsibull-docs-parser
path: antsibull-docs-parser
ref: ${{ matrix.antsibull_docs_parser_ref }}
- name: Check out dependent project antsibull-changelog
uses: actions/checkout@v4
with:
repository: ansible-community/antsibull-changelog
path: antsibull-changelog
ref: ${{ matrix.antsibull_changelog_ref }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[coverage] ../antsibull-core ../antsibull-docs-parser
working-directory: antsibull-docs
- name: Use antsibull-docs sphinx-init
run: |
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs sphinx-init --lenient --dest-dir . ${{ matrix.options }}
working-directory: antsibull-docs
- name: Patch build.sh to supply code coverage
run: |
sed -i build.sh -e 's!antsibull-docs !coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs !g'
sed -i build.sh -e 's!sphinx-build !coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m sphinx.cmd.build !g'
cat build.sh
working-directory: antsibull-docs
- name: Patch requirements.txt to remove antsibull-docs requirement
run: |
sed -i requirements.txt -e '/antsibull-docs[^a-zA-Z0-9_-].*/d'
cat requirements.txt
(! grep antsibull-docs requirements.txt)
working-directory: antsibull-docs
- name: Install dependencies
run: |
pip install ansible-core -r requirements.txt
working-directory: antsibull-docs
- name: Install collections
# We install some collections using ansible-galaxy and at least one by cloning its repository,
# so we have galaxy.yml instead of MANIFEST.json present.
run: |
ansible-galaxy collection install community.docker sensu.sensu_go
git clone https://github.com/ansible-collections/community.crypto.git ~/.ansible/collections/ansible_collections/community/crypto
if: contains(matrix.options, '--use-current')
- name: Lint collection docs
run: |
coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/community/docker --plugin-docs
coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/community/crypto
coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/sensu/sensu_go
working-directory: antsibull-docs
if: contains(matrix.options, '--use-current')
- name: Build docsite
run: |
./build.sh
working-directory: antsibull-docs
- name: Validate HTML
run: |
pip install html5lib
python tests/validate-html.py build/html/
working-directory: antsibull-docs
- name: Test plugin rendering
run: |
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs plugin --plugin-type module --dest-dir . community.crypto.acme_account_info
working-directory: antsibull-docs
if: contains(matrix.options, '--use-current')
- name: Combine coverage stats
run: |
coverage combine .coverage.*
coverage report
coverage xml -i
working-directory: antsibull-docs
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
working-directory: antsibull-docs
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build-stable:
name: 'Build stable docsite'
runs-on: ubuntu-latest
steps:
- name: Check out antsibull-docs
uses: actions/checkout@v4
with:
path: antsibull-docs
- name: Check out dependent project antsibull-core
uses: actions/checkout@v4
with:
repository: ansible-community/antsibull-core
path: antsibull-core
- name: Check out dependent project antsibull-docs-parser
uses: actions/checkout@v4
with:
repository: ansible-community/antsibull-docs-parser
path: antsibull-docs-parser
- name: Check out dependent project antsibull-changelog
uses: actions/checkout@v4
with:
repository: ansible-community/antsibull-changelog
path: antsibull-changelog
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[coverage] ../antsibull-core ../antsibull-docs-parser
working-directory: antsibull-docs
- name: Get hold of deps file
run: |
curl https://raw.githubusercontent.com/ansible-community/ansible-build-data/main/9/ansible-9.0.0.deps --output ansible.deps
working-directory: antsibull-docs
- name: Build stable docs RST files
run: |
mkdir stable-docs
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs stable --deps-file ansible.deps --dest-dir stable-docs --no-breadcrumbs --no-indexes
working-directory: antsibull-docs
- name: Combine coverage stats
run: |
coverage combine .coverage.*
coverage report
coverage xml -i
working-directory: antsibull-docs
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
working-directory: antsibull-docs
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build-devel:
name: 'Build devel docsite'
runs-on: ubuntu-latest
steps:
- name: Check out antsibull-docs
uses: actions/checkout@v4
with:
path: antsibull-docs
- name: Check out dependent project antsibull-core
uses: actions/checkout@v4
with:
repository: ansible-community/antsibull-core
path: antsibull-core
- name: Check out dependent project antsibull-docs-parser
uses: actions/checkout@v4
with:
repository: ansible-community/antsibull-docs-parser
path: antsibull-docs-parser
- name: Check out dependent project antsibull-changelog
uses: actions/checkout@v4
with:
repository: ansible-community/antsibull-changelog
path: antsibull-changelog
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[coverage] ../antsibull-core ../antsibull-docs-parser
working-directory: antsibull-docs
- name: Get hold of ansible.in file
run: |
curl https://raw.githubusercontent.com/ansible-community/ansible-build-data/main/10/ansible.in --output ansible.in
working-directory: antsibull-docs
- name: Build devel docs RST files
run: |
mkdir devel-docs
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs devel --pieces-file ansible.in --dest-dir devel-docs
working-directory: antsibull-docs
- name: Combine coverage stats
run: |
coverage combine .coverage.*
coverage report
coverage xml -i
working-directory: antsibull-docs
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
working-directory: antsibull-docs
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}