tests #786
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": | |
workflow_dispatch: | |
schedule: | |
- cron: "15 16 * * *" | |
push: | |
branches: | |
- main | |
- dev | |
- deps | |
pull_request: | |
branches: | |
- main | |
env: | |
FORCE_COLOR: "1" | |
jobs: | |
test-all: | |
name: ${{ matrix.pyversion }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# https://github.com/actions/python-versions/blob/main/versions-manifest.json | |
- pyversion: "3.12" | |
enable_coverage: true | |
- pyversion: "3.11" | |
- pyversion: "3.10" | |
more_hypothesis_examples_if_cron: true | |
- pyversion: "3.9" | |
- pyversion: "3.8" | |
- pyversion: "pypy-3.10" | |
deps_subdir: "pypy3.10" | |
- pyversion: "pypy-3.9" | |
deps_subdir: "pypy3.9" | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 | |
with: | |
python-version: ${{ matrix.pyversion }} | |
cache: pip | |
cache-dependency-path: dev-deps/${{ matrix.deps_subdir || format('python{0}', matrix.pyversion) }}/test.txt | |
- run: python -m pip install -U pip setuptools wheel tox==4.11.4 | |
- run: python -m pip install -r dev-deps/${{ matrix.deps_subdir || format('python{0}', matrix.pyversion) }}/test.txt | |
- name: Set --hypothesis-profile=more-examples # See tests/conftest.py | |
if: ${{ github.event_name == 'schedule' && matrix.more_hypothesis_examples_if_cron }} | |
run: | | |
echo PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --hypothesis-profile=more-examples" >> "${GITHUB_ENV}" | |
- name: cache .hypothesis dir | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 | |
with: | |
path: .hypothesis | |
key: hypothesis|${{ runner.os }}|${{ matrix.pyversion }} | |
- if: matrix.enable_coverage | |
run: | | |
echo COVERAGE_CORE=sysmon >> "${GITHUB_ENV}" | |
echo COVERAGE_PROCESS_START="$(pwd)/.coveragerc" >> "${GITHUB_ENV}" | |
echo RUN_PYTEST_CMD="coverage run" >> "${GITHUB_ENV}" | |
- run: ${RUN_PYTEST_CMD:-python} -m pytest | |
- if: matrix.enable_coverage | |
run: | | |
coverage combine | |
coverage debug data | |
coverage report | |
- name: Upload coverage to Codecov # https://github.com/codecov/codecov-action | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d | |
if: matrix.enable_coverage | |
with: | |
verbose: true | |
fail_ci_if_error: false # https://github.com/codecov/codecov-action/issues/557 | |
permissions: | |
contents: read |