Skip to content

tests

tests #364

Workflow file for this run

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"
# Skip PyPY while crashing due to https://foss.heptapod.net/pypy/pypy/-/issues/3904
# - pyversion: pypy-3.9
# - pyversion: pypy-3.8
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435
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.2.0
- name: cache .hypothesis dir
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
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