-
Notifications
You must be signed in to change notification settings - Fork 23
158 lines (131 loc) · 3.86 KB
/
tests.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: tests
on:
push:
branches: [main]
pull_request:
schedule:
# Run every Sunday
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install nox and uv
run: |
pipx install nox
pipx install uv
- name: Lint
run: |
nox -s lint --verbose
- name: Typecheck
run: |
nox -s typecheck --verbose
tests:
name: Tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
needs: code-quality
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: ""
use-mamba: true
- name: Install nox and uv
run: |
pipx install nox
pipx install uv
- name: Run tests
run: |
nox -s tests-${{ matrix.python-version }} --verbose
- name: Upload test outputs
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-outputs-${{ matrix.os }}-python-${{ matrix.python-version }}
path: tests/_outputs
- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
if: ${{ matrix.os == 'ubuntu-latest' }}
test-build-and-install:
name: Build distribution and test installation
needs: code-quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: ""
use-mamba: true
- name: Install nox and uv
run: |
pipx install nox
pipx install uv
- name: Build distribution
run: |
nox -s build
- name: Test wheel with extras matrix
run: |
nox -s test_wheel --verbose
- name: Test sdist
run: |
nox -s test_sdist --verbose
docs:
name: Docs preview
needs: code-quality
if: github.event.pull_request != null
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: ""
use-mamba: true
- name: Install nox and uv
run: |
pipx install nox
pipx install uv
- name: Test building documentation
run: |
nox -s docs --verbose
- name: Deploy site preview to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: "./docs/site"
production-deploy: false
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: true
enable-commit-comment: false
overwrites-pull-request-comment: true
alias: deploy-preview-${{ github.event.number }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
notify:
name: Notify failed build
needs: [code-quality, tests, test-build-and-install, docs]
if: failure() && github.event.pull_request == null
runs-on: ubuntu-latest
steps:
- uses: jayqi/failed-build-issue-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}