-
Notifications
You must be signed in to change notification settings - Fork 13
87 lines (76 loc) · 2.6 KB
/
test.yaml
File metadata and controls
87 lines (76 loc) · 2.6 KB
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
name: "🔬 Test"
on:
pull_request: null
push:
branches:
- "main"
- "releases"
jobs:
test:
name: "Test (${{ matrix.os.name }})"
strategy:
matrix:
os:
- name: "Linux"
runner: "ubuntu-latest"
- name: "macOS"
runner: "macos-latest"
- name: "Windows"
runner: "windows-latest"
# Each operating system should test all Python interpreters simultaneously.
# This nested-list syntax accomplishes that goal
# without creating cross-products of every possible OS and interpreter.
#
# Note: The CPython interpreter versions should be in ascending order
# because the last-listed version will be the default CPython version.
#
cpythons:
- - "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
cpython-beta:
- "3.13"
fail-fast: false
runs-on: "${{ matrix.os.runner }}"
steps:
- name: "Checkout the repository"
uses: "actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3" # v6.0.0
- name: "Setup Pythons"
uses: "actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548" # v6.1.0
env:
# Disable pip upgrade warnings while setting up Python versions.
PIP_DISABLE_PIP_VERSION_CHECK: "1"
with:
python-version: "${{
format(
'{0}\n{1}',
matrix.cpython-beta,
join(matrix.cpythons, '\n')
)
}}"
allow-prereleases: true
- name: "Detect Pythons"
uses: "kurtmckee/detect-pythons@4a7b361b5ee27eb35c8b5026ac757d02751d6688" # v1.1.1
- name: "Restore cache"
id: "restore-cache"
uses: "actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830" # v4.3.0
with:
path: |
.mypy_cache/
.tox/
.venv/
key: "test-os=${{ runner.os }}-hash=${{ hashFiles('.python-identifiers', 'pyproject.toml', 'tox.ini', 'requirements/**/*.txt') }}"
- name: "Identify venv path"
shell: "bash"
run: |
echo "venv-path=.venv/${{ runner.os == 'Windows' && 'Scripts' || 'bin' }}" >> "$GITHUB_ENV"
- name: "Create a virtual environment"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
${{ env.venv-path }}/python -m pip install --upgrade pip setuptools wheel
${{ env.venv-path }}/pip install tox
- name: "Run the test suite"
run: "${{ env.venv-path }}/tox"