Add gh action to build and inspect package #1257
Workflow file for this run
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: ${{ 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 |