# This name appears as the text in the build badge: https://github.com/jab/bidict/actions/workflows/test.yml/badge.svg name: tests "on": workflow_dispatch: schedule: - cron: "15 16 * * *" push: branches: - main - dev - deps pull_request: branches: - main env: FORCE_COLOR: "1" PYTEST_ADDOPTS: "--hypothesis-show-statistics" 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" - pyversion: "3.9" - pyversion: "3.8" - pyversion: "pypy-3.10" deps_subdir: "pypy3.10" - pyversion: "pypy-3.9" deps_subdir: "pypy3.9" steps: - name: check out source uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: set up Python ${{ matrix.pyversion }} uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c with: python-version: ${{ matrix.pyversion }} cache: pip cache-dependency-path: dev-deps/${{ matrix.deps_subdir || format('python{0}', matrix.pyversion) }}/test.txt - name: install dependencies run: | python -m pip install -U pip setuptools wheel python -m pip install -r dev-deps/${{ matrix.deps_subdir || format('python{0}', matrix.pyversion) }}/test.txt - name: cache .mypy_cache dir uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: .mypy_cache key: mypy - name: run mypy run: python -m mypy bidict tests - name: maybe set --hypothesis-profile=more-examples # See tests/conftest.py if: ${{ github.event_name == 'schedule' }} run: | echo PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --hypothesis-profile=more-examples" >> "${GITHUB_ENV}" - name: cache .hypothesis dir uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: .hypothesis key: hypothesis|${{ runner.os }}|${{ matrix.pyversion }} - name: maybe enable coverage if: matrix.enable_coverage run: | echo COVERAGE_PROCESS_START="$(pwd)/.coveragerc" >> "${GITHUB_ENV}" echo RUN_PYTEST_CMD="coverage run" >> "${GITHUB_ENV}" - name: set COVERAGE_CORE=sysmon if py3.12 if: matrix.pyversion == '3.12' run: | echo COVERAGE_CORE=sysmon >> "${GITHUB_ENV}" - name: run pytest run: ${RUN_PYTEST_CMD:-python} -m pytest - name: combine and show any collected coverage if: matrix.enable_coverage run: | coverage combine coverage debug data coverage report - name: maybe upload to Codecov # https://github.com/codecov/codecov-action if: matrix.enable_coverage uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: verbose: true fail_ci_if_error: false # https://github.com/codecov/codecov-action/issues/557 permissions: contents: read