-
Notifications
You must be signed in to change notification settings - Fork 3
95 lines (78 loc) · 2.77 KB
/
Copy pathtests.yml
File metadata and controls
95 lines (78 loc) · 2.77 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
88
89
90
91
92
93
94
95
name: Tests
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
# Cancel superseded runs on the same ref (saves CI minutes on rapid pushes).
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
# The installable project lives in the tsapython/ subdirectory (the one with
# pyproject.toml, the pytest config, and the `hardware` marker).
working-directory: tsapython
jobs:
test:
name: pytest (${{ matrix.os }}, py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# The library is pyserial-based and developed on Windows, lightly
# tested on Linux -- so both matter; macOS is cheap to include.
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Sync environment (deps + dev group, editable install)
run: uv sync
- name: Run test suite (hardware tests deselected)
run: uv run pytest -m "not hardware" --cov=tsapython --cov-report=xml --cov-report=term-missing
- name: Upload coverage to Codecov
# Optional: only does anything once the repo is linked at
# https://codecov.io. Tokenless for public repos. Safe to leave in
# before linking -- it soft-fails.
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v5
with:
files: tsapython/coverage.xml
fail_ci_if_error: false
lint:
name: ruff + mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: "3.12"
- name: Sync environment
run: uv sync
- name: Ruff lint
# Blocking ruleset is E9 + F only (see [tool.ruff.lint] in
# pyproject.toml); style rules are a planned follow-up cleanup.
run: uv run ruff check .
- name: Mypy
# Blocking. The package ships a py.typed marker, which promises
# downstream type-checkers that these annotations are real; this gate
# is what keeps that promise true.
run: uv run mypy
build:
name: package builds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build sdist + wheel
# Catches packaging breakage on every push instead of at release time.
# release.yml does the same build when publishing.
run: uv build