Merge pull request #1101 from tefra/pre-commit-hooks #1748
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
tests: | |
name: ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {name: Python 3.9, python: '3.9'} | |
- {name: Python 3.10, python: '3.10'} | |
- {name: Python 3.11, python: '3.11'} | |
- {name: Python 3.12, python: '3.12'} | |
- {name: Python 3.13, python: '3.13-dev'} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install libxml2 | |
if: startsWith(matrix.python, '3.13') | |
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/*.md" | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
w3c-tests: | |
name: W3C Tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: tefra/xsdata-w3c-tests | |
ref: main | |
submodules: true | |
path: w3c-tests | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
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 xsd w3c-tests/tests | |
benchmark: | |
name: Benchmarks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
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@v4 | |
- uses: actions/setup-python@v5 | |
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@v4 | |
- uses: actions/setup-python@v5 | |
- uses: pre-commit/[email protected] | |
check-package: | |
name: Build & Inspect Package. | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: hynek/build-and-inspect-python-package@v2 |