1- name :Documentation
1+ name :Documentation and Code Coverage
22
33on :
44push :
5- branches :[main]
65pull_request :
7- branches :[main]
8- schedule :
9- # ┌───────────── minute (0 - 59)
10- # │ ┌───────────── hour (0 - 23)
11- # │ │ ┌───────────── day of the month (1 - 31)
12- # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
13- # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
14- # │ │ │ │ │
15- # │ │ │ │ │
16- # │ │ │ │ │
17- # * * * * *
18- -cron :' 30 1 * * 0'
6+ types :
7+ -closed
8+ branches :
9+ -main
1910
2011jobs :
21- build_wheels :
12+ run :
2213name :Build documentation on ${{ matrix.os }}
2314runs-on :${{ matrix.os }}
2415strategy :
@@ -33,17 +24,65 @@ jobs:
3324with :
3425python-version :' 3.11'
3526
27+ -uses :tlylt/install-graphviz@v1
28+
29+ -name :Install pandoc
30+ run :sudo apt-get install -y pandoc
31+
3632 -name :Install requirements
3733run :python -m pip install -r requirements.txt
3834
39- -name :Install requirements- dev.txt
35+ -name :Install requirements dev
4036run :python -m pip install -r requirements-dev.txt
4137
38+ -name :Cache pip
39+ uses :actions/cache@v2
40+ with :
41+ path :~/.cache/pip
42+ key :${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
43+ restore-keys :|
44+ ${{ runner.os }}-pip-
45+ ${{ runner.os }}-
46+
47+ -name :Generate coverage report
48+ run :|
49+ pip install pytest
50+ pip install pytest-cov
51+ export PYTHONPATH=.
52+ pytest --cov=./onnx_array_api/ --cov-report=xml --durations=10 --ignore-glob=**LONG*.py --ignore-glob=**notebook*.py
53+ export PYTHONPATH=
54+
55+ -name :Upload coverage reports to Codecov
56+ uses :codecov/codecov-action@v3
57+ env :
58+ CODECOV_TOKEN :${{ secrets.CODECOV_TOKEN }}
59+
4260 -name :Install
43- run :python -m pip install -e .
61+ run :python setup.py install
62+
63+ -name :Copy license, changelogs
64+ run :|
65+ cp LICENSE* ./_doc
66+ cp CHANGELOGS* ./_doc
4467
4568 -name :Documentation
46- run :python -m sphinx ./_doc ./dist/html
69+ run :python -m sphinx ./_doc ./dist/html -n -w doc.txt
70+
71+ -name :Summary
72+ run :cat doc.txt
73+
74+ -name :Check for errors and warnings
75+ run :|
76+ if [[ $(grep ERROR doc.txt) ]]; then
77+ echo "Documentation produces errors."
78+ grep ERROR doc.txt
79+ exit 1
80+ fi
81+ if [[ $(grep WARNING doc.txt) ]]; then
82+ echo "Documentation produces warnings."
83+ grep WARNING doc.txt
84+ exit 1
85+ fi
4786
4887 -uses :actions/upload-artifact@v3
4988with :