-
-
Notifications
You must be signed in to change notification settings - Fork 60
114 lines (112 loc) · 3.43 KB
/
tests.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
include:
- {name: Python 3.8, python: '3.8', os: ubuntu}
- {name: Python 3.9, python: '3.9', os: ubuntu}
- {name: Python 3.10, python: '3.10', os: ubuntu}
- {name: Python 3.11, python: '3.11', os: ubuntu}
- {name: Python 3.12, python: '3.12-dev', os: ubuntu}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install libxml2
if: startsWith(matrix.python, 'pypy')
run: |
sudo apt-get install libxml2-dev libxslt-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install .[lxml,cli,test,soap]
- name: Test
run: |
pytest --cov=./xsdata --cov-report=xml --cov-branch --doctest-glob="docs/*.rst"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
w3c-tests:
name: W3C ${{ matrix.mode }} tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mode: [xsd, json, xml]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: tefra/xsdata-w3c-tests
ref: main
submodules: true
path: w3c-tests
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools pytest pytest-xdist xmlschema
python -m pip install .[lxml,cli]
- name: Test
run: |
pytest -n auto --mode ${{ matrix.mode }} w3c-tests/tests
benchmark:
name: Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install .[lxml,cli,test]
- name: Benchmark
run: |
pytest --benchmark-only --benchmark-columns=min,max,mean,median tests/integration/benchmarks
minimum:
name: Minimum Installation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install pip install .
run: |
pip install -e .[test]
- name: Verify
run: |
python benchmark.py -c XmlEventWriter
python benchmark.py -c XmlEventHandler
python benchmark.py -c JsonParser
python benchmark.py -c JsonSerializer
xsdata | xargs -0 python -c "import sys; assert 'Install cli' in sys.argv[1]"
pre-commit:
name: Pre-commit Hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]
check-package:
name: Build & Inspect Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hynek/build-and-inspect-python-package@v1