Skip to content

Commit c8e40a3

Browse files
authored
Improves github actions (#32)
* add action * doc * doc * doc * doc2 * black * doc3 * fix doc * clean
1 parent 1be44a7 commit c8e40a3

33 files changed

+364
-116
lines changed

.github/workflows/check_urls.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Check URLs
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
schedule:
7+
# ┌───────────── minute (0 - 59)
8+
# │ ┌───────────── hour (0 - 23)
9+
# │ │ ┌───────────── day of the month (1 - 31)
10+
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
11+
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
12+
# │ │ │ │ │
13+
# │ │ │ │ │
14+
# │ │ │ │ │
15+
# * * * * *
16+
- cron: '30 1 * * 0'
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: urls-checker-code
26+
uses: urlstechie/urlchecker-action@master
27+
with:
28+
subfolder: onnx_array_api
29+
file_types: .md,.py,.rst,.ipynb
30+
print_all: false
31+
timeout: 2
32+
retry_count# : 2
33+
# exclude_urls: https://dumps.wikimedia.org/other/pageviews/%Y/%Y-%m/pageviews-%Y%m%d-%H0000.gz,https://dumps.wikimedia.org/frwiki/latest/latest-all-titles-in-ns0.gz
34+
exclude_patterns: https://dumps.wikimedia.org/
35+
# force_pass : true
36+
37+
- name: urls-checker-docs
38+
uses: urlstechie/urlchecker-action@master
39+
with:
40+
subfolder: _doc
41+
file_types: .md,.py,.rst,.ipynb
42+
print_all: false
43+
timeout: 2
44+
retry_count# : 2
45+
exclude_urls: https://hal.archives-ouvertes.fr/hal-00990252/document
46+
exclude_patterns: https://www.data.gouv.fr/fr/datasets/r/e3d83ab3-dc52-4c99-abaf-8a38050cc68c,https://dev.azure.com/
47+
# force_pass : true

.github/workflows/documentation.yml

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
name: Documentation
1+
name: Documentation and Code Coverage
22

33
on:
44
push:
5-
branches: [main]
65
pull_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

2011
jobs:
21-
build_wheels:
12+
run:
2213
name: Build documentation on ${{ matrix.os }}
2314
runs-on: ${{ matrix.os }}
2415
strategy:
@@ -33,17 +24,65 @@ jobs:
3324
with:
3425
python-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
3733
run: python -m pip install -r requirements.txt
3834

39-
- name: Install requirements-dev.txt
35+
- name: Install requirements dev
4036
run: 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
4988
with:

CHANGELOGS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ Change Logs
88
an array to a TensorProto, including bfloat16 and float 8 types
99
* :pr:`24`: add ExtendedReferenceEvaluator to support scenario
1010
for the Array API onnx does not support
11-
* :pr:`22`: support OrtValue in function :func:`ort_profile`
11+
* :pr:`22`: support OrtValue in function *ort_profile*
1212
* :pr:`17`: implements ArrayAPI
1313
* :pr:`3`: fixes Array API with onnxruntime and scikit-learn

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ onnx-array-api: (Numpy) Array API for ONNX
2626
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
2727
:target: https://github.com/psf/black
2828

29+
.. image:: https://codecov.io/gh/sdpython/onnx-array-api/branch/main/graph/badge.svg?token=Wb9ZGDta8J
30+
:target: https://codecov.io/gh/sdpython/onnx-array-api
31+
2932
**onnx-array-api** implements a numpy API for ONNX.
3033
It gives the user the ability to convert functions written
3134
following the numpy API to convert that function into ONNX as

_doc/api/array_api.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ onnx_array_api.array_api
33

44
.. toctree::
55

6-
array_api_onnx_numpy
7-
array_api_onnx_ort
6+
array_api_numpy
7+
array_api_ort
8+
npx_array_api

_doc/api/index.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ API
77
:maxdepth: 1
88

99
array_api
10+
npx_core_api
1011
npx_functions
11-
npx_jit
12+
npx_jit_eager
1213
npx_numpy
14+
npx_tensors
1315
npx_types
1416
npx_var
1517
onnx_tools
1618
ort
1719
plotting
1820
reference
1921
tools
22+
profiling

_doc/api/npx_array_api.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
onnx_array_api.npx.npx_array_api
2+
================================
3+
4+
.. automodule:: onnx_array_api.npx.npx_array_api.BaseArrayApi
5+
:members:
Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
npx, jit and eager mode
2-
=======================
1+
============
2+
npx_core_api
3+
============
34

4-
5-
API
6-
+++
7-
8-
.. autofunction:: onnx_array_api.npx.npx_core_api.var
5+
cst
6+
===
97

108
.. autofunction:: onnx_array_api.npx.npx_core_api.cst
119

12-
.. autofunction:: onnx_array_api.npx.npx_jit_eager.eager_onnx
13-
14-
.. autofunction:: onnx_array_api.npx.npx_jit_eager.jit_onnx
10+
make_tuple
11+
==========
1512

1613
.. autofunction:: onnx_array_api.npx.npx_core_api.make_tuple
1714

15+
tuple_var
16+
=========
17+
1818
.. autofunction:: onnx_array_api.npx.npx_core_api.tuple_var
1919

20+
npxapi_inline
21+
=============
22+
2023
.. autofunction:: onnx_array_api.npx.npx_core_api.npxapi_inline
2124

22-
.. autofunction:: onnx_array_api.npx.npx_core_api.npxapi_function
25+
npxapi_function
26+
===============
2327

24-
JIT, Eager
25-
++++++++++
28+
.. autofunction:: onnx_array_api.npx.npx_core_api.npxapi_function
2629

27-
.. autoclass:: onnx_array_api.npx.npx_jit_eager.JitEager
28-
:members:
30+
var
31+
===
2932

30-
.. autoclass:: onnx_array_api.npx.npx_jit_eager.JitOnnx
31-
:members:
33+
.. autofunction:: onnx_array_api.npx.npx_core_api.var

_doc/api/npx_jit_eager.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
=============
2+
npx_jit_eager
3+
=============
4+
5+
eager_onnx
6+
==========
7+
8+
.. autofunction:: onnx_array_api.npx.npx_jit_eager.eager_onnx
9+
10+
EagerOnnx
11+
=========
12+
13+
.. autoclass:: onnx_array_api.npx.npx_jit_eager.EagerOnnx
14+
:members:
15+
16+
JitEager
17+
========
18+
19+
.. autoclass:: onnx_array_api.npx.npx_jit_eager.JitEager
20+
:members:
21+
22+
jit_onnx
23+
========
24+
25+
.. autofunction:: onnx_array_api.npx.npx_jit_eager.jit_onnx
26+
27+
JitOnnx
28+
=======
29+
30+
.. autoclass:: onnx_array_api.npx.npx_jit_eager.JitOnnx
31+
:members:

_doc/api/npx_numpy.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
npx.npx_numpy_tensors
22
=====================
33

4+
EagerNumpyTensor
5+
++++++++++++++++
6+
47
.. autoclass:: onnx_array_api.npx.npx_numpy_tensors.EagerNumpyTensor
58
:members:
69

10+
JitNumpyTensor
11+
++++++++++++++
12+
713
.. autoclass:: onnx_array_api.npx.npx_numpy_tensors.JitNumpyTensor
814
:members:
915

16+
NumpyTensor
17+
+++++++++++
18+
1019
.. autoclass:: onnx_array_api.npx.npx_numpy_tensors.NumpyTensor
1120
:members:

_doc/api/npx_tensors.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
===========
2+
npx_tensors
3+
===========
4+
5+
6+
EagerTensor
7+
===========
8+
9+
.. autoclass:: onnx_array_api.npx.npx_tensors.EagerTensor
10+
:members:

_doc/api/ort.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
11
ort
22
===
33

4-
Optimization
5-
++++++++++++
4+
ort_optimized_model
5+
+++++++++++++++++++
66

77
.. autofunction:: onnx_array_api.ort.ort_optimizers.ort_optimized_model
88

9-
OrtTensor
10-
+++++++++
9+
EagerOrtTensor
10+
++++++++++++++
1111

1212
.. autoclass:: onnx_array_api.ort.ort_tensors.EagerOrtTensor
1313
:members:
1414

15+
JitOrtTensor
16+
++++++++++++
17+
1518
.. autoclass:: onnx_array_api.ort.ort_tensors.JitOrtTensor
1619
:members:
1720

21+
OrtTensor
22+
+++++++++
23+
1824
.. autoclass:: onnx_array_api.ort.ort_tensors.OrtTensor
1925
:members:
2026

21-
Profiling
22-
+++++++++
27+
merge_ort_profile
28+
+++++++++++++++++
2329

2430
.. autofunction:: onnx_array_api.ort.ort_profile.merge_ort_profile
2531

26-
.. autofunction:: onnx_array_api.ort.ort_profile.ort_profile
32+
ort_profile
33+
+++++++++++
2734

35+
.. autofunction:: onnx_array_api.ort.ort_profile.ort_profile

_doc/api/profiling.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
profiling
2+
=========
3+
4+
ProfileNode
5+
+++++++++++
6+
7+
.. autoclass:: onnx_array_api.profiling.ProfileNode
8+
9+
profile
10+
+++++++
11+
12+
.. autofunction:: onnx_array_api.profiling.profile
13+
14+
profile2graph
15+
+++++++++++++
16+
17+
.. autofunction:: onnx_array_api.profiling.profile2graph

_doc/api/tools.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@ Examples
1111

1212
.. autofunction:: onnx_array_api.ext_test_case.example_path
1313

14-
Profiling
15-
+++++++++
16-
17-
.. autofunction:: onnx_array_api.profiling.profile
18-
19-
.. autofunction:: onnx_array_api.profiling.profile2graph
20-
21-
.. autofunction:: onnx_array_api.profiling.profile2df
22-
23-
2414
Unit tests
2515
++++++++++
2616

0 commit comments

Comments
 (0)