-
Notifications
You must be signed in to change notification settings - Fork 14
98 lines (80 loc) · 2.77 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
name: CI
on:
pull_request:
push:
jobs:
build:
if: endsWith(github.head_ref || github.ref_name, '.changes') == false
runs-on: ubuntu-latest
strategy:
matrix:
# Builds are failing with py3.9+ because sphinx templates are different.
# python: ['3.7', '3.8', '3.9', '3.10', '3.11']
python: ['3.7', '3.8']
fail-fast: false
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install tools
run: |
sudo apt -y install libxml2-utils
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test/requirements.txt
pip install .
- name: Build Unit Tests
run: |
cd test
find . -name '*.html' -exec rm {} \;
sed -i 's~, "log\.md"~~' conf.py
make html SPHINXOPTS='' 2>&1 | tee log.txt
git restore conf.py
(cd _build/html && rm genindex.html index.html search.html php-modindex.html)
(cd _build/html && find . -name '*.html' -exec sh -c 'xmllint {} --xpath '"'"'//div[@role="main"]'"'"' | xmllint --format - > ../../{}' \;)
sed -i -r 's~.*/(test/)~\1~;t;d' log.txt
- name: Apply Coding Style
if: matrix.python == '3.11'
run: |
pip install black
python -m black .
- name: Diff Unit Tests Output and Coding Style
run: |
cd test
rm -r _build
git add . -N && git diff --exit-code
- name: Push Unit Tests Output
if: failure() && github.repository_owner != 'markstory' && matrix.python == '3.11'
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.head_ref || github.ref_name }}.changes
create_branch: true
push_options: '--force'
commit_message: Unit Tests Changes
commit_user_name: Bot
commit_user_email: [email protected]
commit_author: Bot <[email protected]>
- name: Build Unit Tests with '-W' option
run: |
cd test
make html SPHINXOPTS='-W'
sed -i 's~, "log\.md"~~' conf.py
! make html SPHINXOPTS='-W' || (echo 'Unexpected zero exit code'; false)
git restore conf.py
- name: Build Unit Tests with toc show_parents=hide
run: |
cd test
make html SPHINXOPTS='-W -D toc_object_entries_show_parents=hide'
- name: Build Unit Tests with toc show_parents=domain
run: |
cd test
make html SPHINXOPTS='-W -D toc_object_entries_show_parents=domain'
- name: Build Unit Tests with toc show_parents=all
run: |
cd test
make html SPHINXOPTS='-W -D toc_object_entries_show_parents=all'