Skip to content

Commit 70fca3a

Browse files
authored
Merge pull request #59 from mvorisek/unit_testing
Add Unit Testing
2 parents 7be44a1 + aac1a7f commit 70fca3a

File tree

21 files changed

+493
-19
lines changed

21 files changed

+493
-19
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,78 @@
11
name: CI
22

33
on:
4-
push:
5-
branches:
6-
- master
74
pull_request:
8-
branches:
9-
- '*'
5+
push:
6+
schedule:
7+
- cron: '0 0/2 * * *'
108

119
jobs:
1210
build:
11+
if: endsWith(github.head_ref || github.ref_name, '.changes') == false
1312
runs-on: ubuntu-latest
1413
strategy:
1514
matrix:
16-
python: ['3.7', '3.8', '3.9']
15+
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
1716
fail-fast: false
1817

18+
permissions:
19+
contents: write
20+
1921
steps:
20-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v3
2123

22-
- uses: actions/setup-python@v2
24+
- uses: actions/setup-python@v4
2325
with:
2426
python-version: ${{ matrix.python }}
2527

28+
- name: Install tools
29+
run: |
30+
sudo apt -y install libxml2-utils
31+
2632
- name: Install dependencies
2733
run: |
2834
python -m pip install --upgrade pip
2935
pip install -r requirements.txt
36+
pip install -r test/unit/requirements.txt
3037
pip install .
3138
32-
- name: Build test/
39+
- name: Build Test
3340
run: |
34-
cd test && make html SPHINXOPTS='-W'
41+
cd test/must-build && make html SPHINXOPTS='-W'
3542
3643
- name: Build Test with toc show_parents=hide
3744
run: |
38-
cd test && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=hide'
45+
cd test/must-build && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=hide'
3946
4047
- name: Build Test with toc show_parents=domain
4148
run: |
42-
cd test && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=domain'
49+
cd test/must-build && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=domain'
4350
4451
- name: Build Test with toc show_parents=all
4552
run: |
46-
cd test && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=all'
53+
cd test/must-build && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=all'
54+
55+
- name: Run Unit Testing
56+
run: |
57+
cd test/unit
58+
find . -name '*.html' -exec rm {} \;
59+
make html SPHINXOPTS='-W'
60+
(cd _build/html && find . -name '*.html' -exec sh -c 'xmllint {} --xpath '"'"'//div[@role="main"]'"'"' | xmllint --format - > ../../{}' \;)
61+
rm genindex.html index.html search.html php-modindex.html
62+
63+
- name: Diff Unit Outputs
64+
run: |
65+
cd test/unit
66+
rm -r _build
67+
git add . -N && git diff --exit-code
68+
69+
- name: Push Unit Changes
70+
if: failure()
71+
uses: stefanzweifel/git-auto-commit-action@v4
72+
with:
73+
branch: ${{ github.head_ref || github.ref_name }}.changes
74+
push_options: '--force'
75+
commit_message: Unit Changes
76+
commit_user_name: Bot
77+
commit_user_email: bot@example.com
78+
commit_author: Bot <bot@example.com>

.github/workflows/doc.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ concurrency:
2121
cancel-in-progress: false
2222

2323
jobs:
24-
# Build job
2524
build:
25+
if: github.repository_owner == 'markstory'
2626
runs-on: ubuntu-latest
2727
steps:
2828
- uses: actions/checkout@v3
@@ -35,15 +35,14 @@ jobs:
3535
id: pages
3636
uses: actions/configure-pages@v3
3737

38-
- name: Build doct
38+
- name: Build doc
3939
run: make -C doc html
4040

4141
- name: Upload artifact
4242
uses: actions/upload-pages-artifact@v1
4343
with:
4444
path: doc/_build/html
4545

46-
# Deployment job
4746
deploy:
4847
environment:
4948
name: github-pages

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
dist/
22
build/
33
doc/_build
4-
test/_build
4+
test/must-build/_build
5+
test/unit/_build
56
*.pyc
67
*.egg-info
78
.DS_Store

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
# Add any paths that contain custom static files (such as style sheets) here,
121121
# relative to this directory. They are copied after the builtin static files,
122122
# so a file named "default.css" will overwrite the builtin "default.css".
123-
html_static_path = ['_static']
123+
#html_static_path = ['_static']
124124

125125
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
126126
# using the given strftime format.

test/_static/.gitignore

Whitespace-only changes.
File renamed without changes.

test/conf.py renamed to test/must-build/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
# Add any paths that contain custom static files (such as style sheets) here,
121121
# relative to this directory. They are copied after the builtin static files,
122122
# so a file named "default.css" will overwrite the builtin "default.css".
123-
html_static_path = ['_static']
123+
#html_static_path = ['_static']
124124

125125
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
126126
# using the given strftime format.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)