-
-
Notifications
You must be signed in to change notification settings - Fork 63
99 lines (94 loc) · 3.18 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# 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-latest
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@692973e3d937129bcbf40652eb9f2f61becf3332
- name: set up Python ${{ matrix.pyversion }}
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: ${{ matrix.pyversion }}
- name: set up cached uv
uses: hynek/setup-cached-uv@4b4bfa932036976749a9653b0fa4fa10b1a7092b
- name: create and activate virtualenv
run: |
uv sync --extra=test
source .venv/bin/activate
echo PATH="$PATH" >> "$GITHUB_ENV"
- name: cache .mypy_cache dir
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
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@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
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