Debian Codegraph @

.github/workflows/test.yml

raw
1 # This name appears as the text in the build badge: https://github.com/jab/bidict/actions/workflows/test.yml/badge.svg
2 name: tests
3
4 "on":
5 workflow_dispatch:
6 schedule:
7 - cron: "15 16 * * *"
8 push:
9 branches:
10 - main
11 - dev
12 - deps
13 pull_request:
14 branches:
15 - main
16
17 env:
18 FORCE_COLOR: "1"
19 PYTEST_ADDOPTS: "--hypothesis-show-statistics"
20
21 jobs:
22 test-all:
23 name: ${{ matrix.pyversion }}
24 runs-on: ubuntu-latest
25 strategy:
26 fail-fast: false
27 matrix:
28 include:
29 # https://github.com/actions/python-versions/blob/main/versions-manifest.json
30 - pyversion: "3.12"
31 enable_coverage: true
32 - pyversion: "3.11"
33 - pyversion: "3.10"
34 - pyversion: "3.9"
35 - pyversion: "3.8"
36 - pyversion: "pypy-3.10"
37 deps_subdir: "pypy3.10"
38 - pyversion: "pypy-3.9"
39 deps_subdir: "pypy3.9"
40 steps:
41 - name: check out source
42 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
43 - name: set up Python ${{ matrix.pyversion }}
44 uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
45 with:
46 python-version: ${{ matrix.pyversion }}
47 cache: pip
48 cache-dependency-path: dev-deps/${{ matrix.deps_subdir || format('python{0}', matrix.pyversion) }}/test.txt
49 - name: install dependencies
50 run: |
51 python -m pip install -U pip setuptools wheel
52 python -m pip install -r dev-deps/${{ matrix.deps_subdir || format('python{0}', matrix.pyversion) }}/test.txt
53 - name: cache .mypy_cache dir
54 uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2
55 with:
56 path: .mypy_cache
57 key: mypy
58 - name: run mypy
59 run: python -m mypy bidict tests
60 - name: maybe set --hypothesis-profile=more-examples # See tests/conftest.py
61 if: ${{ github.event_name == 'schedule' }}
62 run: |
63 echo PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --hypothesis-profile=more-examples" >> "${GITHUB_ENV}"
64 - name: cache .hypothesis dir
65 uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2
66 with:
67 path: .hypothesis
68 key: hypothesis|${{ runner.os }}|${{ matrix.pyversion }}
69 - name: maybe enable coverage
70 if: matrix.enable_coverage
71 run: |
72 echo COVERAGE_PROCESS_START="$(pwd)/.coveragerc" >> "${GITHUB_ENV}"
73 echo RUN_PYTEST_CMD="coverage run" >> "${GITHUB_ENV}"
74 - name: set COVERAGE_CORE=sysmon if py3.12
75 if: matrix.pyversion == '3.12'
76 run: |
77 echo COVERAGE_CORE=sysmon >> "${GITHUB_ENV}"
78 - name: run pytest
79 run: ${RUN_PYTEST_CMD:-python} -m pytest
80 - name: combine and show any collected coverage
81 if: matrix.enable_coverage
82 run: |
83 coverage combine
84 coverage debug data
85 coverage report
86 - name: maybe upload to Codecov # https://github.com/codecov/codecov-action
87 if: matrix.enable_coverage
88 uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044
89 env:
90 CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
91 with:
92 verbose: true
93 fail_ci_if_error: false # https://github.com/codecov/codecov-action/issues/557
94
95
96 permissions:
97 contents: read