feat(testing): allow tests to be run using pytest-xdist (#2172) #1433
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: Run tests | |
on: | |
# NOTE(vytas): Trigger the tests workflow on push or pull request | |
# (pull requests only for the master branch for now). | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- master | |
jobs: | |
run_tox: | |
name: tox -e ${{ matrix.toxenv }} (${{matrix.python-version}} on ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- "3.10" | |
os: | |
- "ubuntu-latest" | |
toxenv: | |
- "pep8" | |
- "blue" | |
- "pep8-examples" | |
- "pep8-docstrings" | |
- "mypy" | |
- "mypy_tests" | |
- "py310" | |
- "py310_sans_msgpack" | |
- "py310_cython" | |
- "docs" | |
- "towncrier" | |
- "look" | |
- "asgilook" | |
- "check_vendored" | |
- "twine_check" | |
- "daphne" | |
- "hypercorn" | |
- "e2e_chrome" | |
- "e2e_firefox" | |
- "no_optional_packages" | |
# TODO(kgriffs): Re-enable once hug has a chance to address | |
# breaking changes in Falcon 3.0 | |
# - "hug" | |
include: | |
- python-version: pypy3.9 | |
os: ubuntu-latest | |
toxenv: pypy3 | |
- python-version: "3.7" | |
os: ubuntu-latest | |
toxenv: py37 | |
- python-version: "3.8" | |
os: ubuntu-latest | |
toxenv: py38 | |
- python-version: "3.8" | |
os: ubuntu-latest | |
toxenv: py38_cython | |
- python-version: "3.9" | |
os: ubuntu-latest | |
toxenv: py39 | |
- python-version: "3.9" | |
os: ubuntu-latest | |
toxenv: py39_cython | |
- python-version: "3.10" | |
os: ubuntu-latest | |
toxenv: py310 | |
- python-version: "3.10" | |
os: ubuntu-latest | |
toxenv: py310_cython | |
- python-version: "3.11" | |
os: ubuntu-latest | |
toxenv: py311 | |
- python-version: "3.11" | |
os: ubuntu-latest | |
toxenv: py311_cython | |
- python-version: "3.10" | |
os: macos-latest | |
toxenv: py310_nocover | |
- python-version: "3.10" | |
os: windows-latest | |
toxenv: py310_nocover | |
# These env require 3.8 and 20.04, see tox.ini | |
- python-version: "3.8" | |
os: ubuntu-20.04 | |
toxenv: py38_smoke | |
- python-version: "3.8" | |
os: ubuntu-20.04 | |
toxenv: py38_smoke_cython | |
- python-version: "3.8" | |
os: ubuntu-latest | |
toxenv: "wsgi_servers" | |
# Steps to run in each job. | |
# Some are GitHub actions, others run shell commands. | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
# NOTE(vytas): Work around | |
# https://github.com/codecov/codecov-action/issues/190 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install smoke test dependencies | |
if: ${{ matrix.toxenv == 'py38_smoke' || matrix.toxenv == 'py38_smoke_cython' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libunwind-dev | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U coverage fixtures setuptools tox wheel | |
python --version | |
pip --version | |
tox --version | |
coverage --version | |
- name: Run tests | |
run: tox -e ${{ matrix.toxenv }} | |
- name: Combine coverage | |
if: ${{ matrix.toxenv == 'py310' || matrix.toxenv == 'py310_sans_msgpack' }} | |
run: | | |
coverage --version | |
coverage combine | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
if: ${{ matrix.toxenv == 'py310' || matrix.toxenv == 'py310_sans_msgpack' }} | |
with: | |
env_vars: PYTHON | |
fail_ci_if_error: true |