Skip to content

tests

tests #1388

Workflow file for this run

# 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:
inputs:
hypothesis_profile:
type: choice
description: (optional)
options:
- default
- more-examples
schedule:
- cron: "15 16 * * *"
push:
branches:
- main
- dev
- deps
pull_request:
branches:
- main
env:
FORCE_COLOR: "1"
PYTEST_ADDOPTS: "--benchmark-disable"
jobs:
test-all:
name: ${{ matrix.pyversion }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
- pyversion: "3.13"
enable_coverage: true
- pyversion: "3.12"
- pyversion: "3.11"
- pyversion: "3.10"
- pyversion: "3.9"
- pyversion: "pypy-3.10"
steps:
- name: check out source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: set up Python ${{ matrix.pyversion }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: ${{ matrix.pyversion }}
- name: set up cached uv
uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817
- name: create and activate virtualenv
run: |
uv sync --only-group=test
source .venv/bin/activate
echo PATH="$PATH" >> "$GITHUB_ENV"
- name: cache .mypy_cache dir
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
path: .mypy_cache
key: mypy
- name: run mypy
run: mypy bidict tests
- name: set hypothesis profile
run: |
hypothesis_profile=${{ github.event.inputs.hypothesis_profile || (github.event_name == 'schedule' && 'more-examples' || 'default') }}
echo PYTEST_ADDOPTS="$PYTEST_ADDOPTS --hypothesis-profile=$hypothesis_profile" >> "$GITHUB_ENV"
- name: cache .hypothesis dir
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
path: .hypothesis
key: hypothesis|${{ runner.os }}|${{ matrix.pyversion }}
- name: maybe enable coverage
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 -m pytest" >> "$GITHUB_ENV"
- name: run pytest
run: ${RUN_PYTEST_CMD:-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@1e68e06f1dbfde0e4cefc87efeba9e4643565303
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