bidict/.github/workflows/test.yml

70 lines
2.3 KiB
YAML

name: Test
"on":
workflow_dispatch:
schedule:
- cron: "15 16 * * *"
push:
branches:
- main
- dev
- deps
pull_request:
branches:
- main
env:
FORCE_COLOR: "1"
jobs:
main:
name: ${{ matrix.pyversion }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#available-versions-of-python-and-pypy
- pyversion: "3.11"
enable_coverage: true
- pyversion: "3.10"
more_hypothesis_examples_if_cron: true
- pyversion: "3.9"
- pyversion: "3.8"
- pyversion: "3.7"
- pyversion: pypy-3.9
- pyversion: pypy-3.8
- pyversion: pypy-3.7
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912
with:
python-version: ${{ matrix.pyversion }}
cache: pip
cache-dependency-path: dev-deps/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}"
- run: python -m pip install -U pip setuptools wheel tox==4.0.16
- name: cache .hypothesis dir
uses: actions/cache@c1a5de879eb890d062a85ee0252d6036480b1fe2
with:
path: .hypothesis
key: hypothesis|${{ runner.os }}|${{ matrix.pyversion }}
- name: Configure pytest to enable coverage
if: matrix.enable_coverage
run: |
echo PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov=bidict --cov-config=.coveragerc --cov-report=xml" >> "${GITHUB_ENV}"
- run: tox -e py
- name: Upload coverage to Codecov # https://github.com/codecov/codecov-action
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
if: matrix.enable_coverage
with:
verbose: true
files: ./coverage.xml
fail_ci_if_error: false # https://github.com/codecov/codecov-action/issues/557
permissions:
contents: read