-
Notifications
You must be signed in to change notification settings - Fork 2
112 lines (99 loc) · 3.12 KB
/
ci.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
100
101
102
103
104
105
106
107
108
109
110
111
112
name: CI
on:
pull_request:
paths-ignore:
- gallery/**
- README.md
push:
branches:
- main
workflow_dispatch:
concurrency:
# auto-cancel any in-progress job *on the same branch*
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-tests:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
include:
- os: macos-latest
python-version: '3.13'
- os: windows-latest
python-version: '3.13'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup uv
uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Test
shell: bash # windows compat
run: |
uv run --frozen --group test --group covcheck --dev \
coverage run -m pytest --color=yes
- name: Upload coverage data
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wxc_coverage_data-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage.*
if-no-files-found: ignore
include-hidden-files: true
coverage:
name: Combine & check coverage
runs-on: ubuntu-latest
needs: unit-tests
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup uv
uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0
with:
python-version: '3.13'
- run: uv sync --only-group covcheck
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: wxc_coverage_data-*
merge-multiple: true
- name: Check coverage
run: |
uv run --frozen --only-group covcheck coverage combine
uv run --frozen --only-group covcheck coverage html --skip-covered --skip-empty
uv run --frozen --only-group covcheck coverage report --fail-under=95
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wxc_coverage_report
path: htmlcov
if: ${{ failure() }}
type-check:
runs-on: ubuntu-latest
name: type check
strategy:
matrix:
os:
- ubuntu-latest
python-version:
# Match minimal supported Python version
# to make sure we're not using unparseable syntax,
# and also run on the most recent version possible to make sure
# the code typechecks also there
- '3.10'
- '3.13'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup uv
uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Run mypy
run: uv run --frozen --group typecheck mypy src