Repository navigation
61 lines (52 loc) · 1.58 KB
/
Copy pathtest-reusable.yml
File metadata and controls
61 lines (52 loc) · 1.58 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
name: Test (Reusable)
on:
workflow_call:
inputs:
python-versions:
description: 'JSON array of Python versions to test'
required: false
type: string
default: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ fromJson(inputs.python-versions) }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Install dependencies
run: |
uv sync --all-groups --python ${{ matrix.python-version }}
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
uv run ruff check --output-format=github --select=E9,F63,F7,F82 .
# default set of ruff rules with GitHub Annotations
uv run ruff check --output-format=github .
- name: Test with pytest
run: |
uv run pytest
test-summary:
name: Test Suite Status
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: Check test matrix status
run: |
if [[ "${{ needs.test.result }}" == "success" ]]; then
echo "All tests passed successfully!"
exit 0
else
echo "Tests failed or were cancelled"
exit 1
fi