-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.34 KB
/
python-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
name: Python Test
on:
workflow_call:
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-test-${{ steps.setup-python.outputs.python-version }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-pip-test-${{ steps.setup-python.outputs.python-version }}-
${{ runner.os }}-pip-test-
${{ runner.os }}-pip
- name: Install Hatch
run: |
pipx install hatch
hatch --version
- name: Run Tests in Python ${{ matrix.python-version }}
env:
PYTHON_VERSION: ${{ matrix.python-version }}
run: |
hatch run +py=${PYTHON_VERSION} test:pytest -v
all-tests-passed:
# Used as aggregate check for all tests being run in matrix.
name: All Tests Passed
needs: test
runs-on: ubuntu-latest
steps:
- run: echo "All tests passed!" >> $GITHUB_STEP_SUMMARY