generated from readthedocs/tutorial-template
-
Notifications
You must be signed in to change notification settings - Fork 38
191 lines (154 loc) · 5.67 KB
/
pull-request.yaml
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
name: "Pull Request Docs Check"
on:
- pull_request
jobs:
build-pdf:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Refresh Packages
run: sudo apt-fast -y update
- name: Install Dependencies
run: xargs -a dependencies sudo apt-fast install -y
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Python Install Dependencies
run: pip install -r docs/requirements.txt
- name: Build PDF
env:
SPHINXOPTS: "-D html_context.commit=${{ github.sha }} -D version=latest -A display_github=true -A github_user=${{ github.repository_owner }} -A github_repo=${{ github.event.repository.name }} -A github_version=${{ github.ref_name }} -A conf_py_path=/docs/source/"
run: make -C docs/ latexpdf
- name: Archive PDF
env:
PR_NUMBER: ${{ github.event.number }}
ID: ${{ github.run_attempt }}
uses: actions/upload-artifact@v4
with:
name: FTCDOCS-PDF
path: |
docs/build/latex/*.pdf
FTCDOCS-PR-${{ env.PR_NUMBER }}-${{ env.ID }}
if-no-files-found: error
build-html:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Refresh Packages
run: sudo apt-fast -y update
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Python Install Dependencies
run: pip install -r docs/requirements.txt
- name: Build Site
env:
SPHINXOPTS: "-D html_context.commit=${{ github.sha }} -D version=latest -A display_github=true -A github_user=${{ github.repository_owner }} -A github_repo=${{ github.event.repository.name }} -A github_version=${{ github.ref_name }} -A conf_py_path=/docs/source/"
run: make -C docs/ html
- name: Archive Site
uses: actions/upload-artifact@v4
with:
name: FTCDOCS-HTML
path: 'docs/build/html'
if-no-files-found: error
spelling-check:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- uses: reviewdog/action-misspell@v1
with:
locale: "US"
reporter: "github-check"
link-check:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Python Install Dependencies
run: pip install -r docs/requirements.txt
- name: Install additional dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq unzip
- name: Download previous artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -s -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/actions/artifacts?per_page=100" > artifacts.json
DOWNLOAD_URL=$(jq -r '.artifacts[] | select(.name | startswith("LINKCHECK--")) | .archive_download_url' artifacts.json | head -n 1)
if [ -z "$DOWNLOAD_URL" ]; then
echo "No previous LINKCHECK artifact found"
exit 0
fi
curl -L \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-o linkcheck.zip "$DOWNLOAD_URL"
if [ $? -ne 0 ]; then
echo "Failed to download the zip file"
exit 0
fi
if unzip -t linkcheck.zip >/dev/null 2>&1; then
unzip -q linkcheck.zip -d linkcheck_contents
echo "Successfully downloaded and unzipped previous LINKCHECK artifact"
mv linkcheck_contents/output.json docs/main-output.json
else
echo "Downloaded file is not a valid zip. Skipping unzip."
rm linkcheck.zip
mkdir -p linkcheck_contents
fi
- name: link-check
run: |
make -C docs/ linkcheckdiff SPHINXOPTS="-W --keep-going -n -q"
- name: Archive Log
if: always()
uses: actions/upload-artifact@v4
with:
name: LINKCHECK-PR-${{ github.event.number }}-${{ github.run_attempt }}
path: docs/build/linkcheckdiff/output.json
retention-days: 7
image-check:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Python Install Dependencies
run: pip install -r docs/requirements.txt
- name: image-check
run: make -C docs/ imagecheck
check-redirect:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Fetch origin/main
run: git fetch origin main --depth=1
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Python Install Dependencies
run: pip install -r docs/requirements.txt
- name: check-redirect
run: make -C docs/ rediraffecheckdiff