-
Notifications
You must be signed in to change notification settings - Fork 0
202 lines (183 loc) Β· 6.15 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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: ci
on:
# trigger if default branch contents change
push:
branches: [main, master]
# trigger on pull requests that target the default branch
pull_request:
branches: [main, master]
# allow triggering manually
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup variables
uses: ./.github/actions/setup-variables
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install Python ${{ env.LOWEST_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.LOWEST_PYTHON_VERSION }}
- name: Install Python dependencies
run: make dev.python
- name: Save cache base key for Python
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- name: Use pre-commit hook cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit hooks
run: make dev.hooks
- name: Run lint
run: make lint
test:
name: test / ${{ matrix.os }} / ${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, python-version: '3.8' }
- { os: ubuntu-latest, python-version: '3.9' }
- { os: ubuntu-latest, python-version: '3.10' }
- { os: ubuntu-latest, python-version: '3.11' }
- { os: ubuntu-latest, python-version: '3.12' }
- { os: ubuntu-latest, python-version: '3.13' }
# - {os: macos-latest, python-version: '3.13'}
# - {os: windows-latest, python-version: '3.13'}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup variables
uses: ./.github/actions/setup-variables
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: make dev.python
- name: Run tests with coverage
run: make test.coverage
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage.*
include-hidden-files: true
coverage:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup variables
uses: ./.github/actions/setup-variables
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install Python ${{ env.LOWEST_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.LOWEST_PYTHON_VERSION }}
- run: uv pip install --upgrade coverage[toml]
- uses: actions/download-artifact@v4
- name: Check for coverage threshold
run: |
python -m coverage combine coverage-data-*
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
- name: Upload coverage report if check failed
uses: actions/upload-artifact@v4
with:
name: html-report
path: htmlcov
if: ${{ failure() }}
test-outdated:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup variables
uses: ./.github/actions/setup-variables
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install Python ${{ env.LOWEST_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.LOWEST_PYTHON_VERSION }}
- name: Install valid but outdated Python dependencies
run: make dev.python dev.python.outdated
- name: Run tests
run: make test
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup variables
uses: ./.github/actions/setup-variables
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install Python ${{ env.LOWEST_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.LOWEST_PYTHON_VERSION }}
- name: Install Python dependencies
run: make dev.python
- name: Build package (wheel)
run: make build
- name: Install package (wheel)
run: pip install dist/*.whl
- name: Run console smoke test (wheel)
run: myproject -h
- name: Uninstall (wheel)
run: make uninstall
- name: Install package (editable)
run: make install
- name: Run console smoke test (editable)
run: myproject -h
- name: Uninstall (editable)
run: make uninstall
- name: Install pipx
run: pip install pipx
- name: Install package (pipx)
run: pipx install .
- name: Run console smoke test (pipx)
run: myproject -h
- name: Uninstall (pipx)
run: pipx uninstall myproject
# -->
convert:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup variables
uses: ./.github/actions/setup-variables
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install Python ${{ env.LOWEST_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.LOWEST_PYTHON_VERSION }}
- name: Convert the template to a project
run: python -m magic --name="artproject" --author="Arthur" --email="arthur@example.com"
- name: Install Python dependencies
run: make dev.python dev.hooks
- name: Run tests
run: make test
- name: Run lint
run: make lint
- name: Install package
run: make install
- name: Smoke test console interface
run: artproject -h
# <--