-
Notifications
You must be signed in to change notification settings - Fork 3
219 lines (187 loc) · 7.33 KB
/
pytest.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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
---
name: Test and lint
on:
push:
merge_group:
schedule:
- cron: '0 10 * * 2'
#pull_request:
workflow_dispatch:
repository_dispatch:
types: [trigger_checks]
jobs:
lint:
name: Format, lint, and type check
runs-on: macos-15
env:
RUFF_OUTPUT_FORMAT: "github"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
- name: Cache cargo and rust build
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
rust/target/
key: pytest-rust-target-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-${{ github.run_id }}
restore-keys: |
pytest-rust-target-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-
pytest-rust-target-${{ runner.os }}-
- name: Setup uv
uses: astral-sh/setup-uv@v5
- name: Install artistools
run: |
rustup update stable
uv sync --frozen
source .venv/bin/activate
uv pip install --compile-bytecode --editable .[dev]
- name: Run Ruff
if: always()
run: |
uv run --frozen -- ruff check --exit-non-zero-on-fix --no-fix
- name: Run Ruff Format
if: always()
uses: astral-sh/ruff-action@v3
with:
args: "format --check"
- name: Run mypy
if: always()
run: uv run --frozen -- mypy --install-types --non-interactive
- name: Run pyright
if: always()
run: uv run --frozen -- pyright
- name: Run pylint
if: always()
run: uv run --frozen -- pylint --output-format=github artistools
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
run: |
source .venv/bin/activate
uv run --frozen -- pre-commit run --all-files --show-diff-on-failure --color=always
superlinter:
name: Super linter
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
- name: Lint Code Base
uses: github/super-linter/slim@v7
env:
LINTER_RULES_PATH: ./
LOG_LEVEL: WARN
VALIDATE_JSON_PRETTIER: false
VALIDATE_GITHUB_ACTIONS: false
VALIDATE_GITLEAKS: false
VALIDATE_JSCPD: false
VALIDATE_PYTHON_BLACK: false
VALIDATE_CHECKOV: false
VALIDATE_MARKDOWN_PRETTIER: false
VALIDATE_PYTHON_FLAKE8: false
VALIDATE_PYTHON_ISORT: false
VALIDATE_PYTHON_PYINK: false
VALIDATE_PYTHON_PYLINT: false
VALIDATE_PYTHON_MYPY: false
VALIDATE_PYTHON_RUFF: false
VALIDATE_YAML_PRETTIER: false
YAML_ERROR_ON_WARNING: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pytest:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-15, ubuntu-24.04]
python-version: ['3.10', '3.11', '3.12', '3.13']
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
name: pytest ${{ matrix.os }} python ${{ matrix.python-version }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Show python version
run: python3 --version --version && which python3
- name: Cache cargo and rust build
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
rust/target/
key: pytest-rust-target-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-${{ github.run_id }}
restore-keys: |
pytest-rust-target-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-
pytest-rust-target-${{ runner.os }}-
- name: Setup uv
uses: astral-sh/setup-uv@v5
- name: Install artistools (no dev deps)
run: |
rustup update stable
uv sync --frozen --no-dev
uv pip install .
- name: Check artistools command line tool
run: |
uv run --frozen -- artistools --help
uv run --frozen -- artistools completions
- name: Cache test data
uses: actions/cache@v4
with:
enableCrossOsArchive: true
path: tests/data/*.tar.xz
key: testdata20231114
- name: Download/extract test data
working-directory: tests/data/
run: source ./setuptestdata.sh
- name: Install artistools[dev]
run: |
uv sync --frozen
uv pip install --compile-bytecode --editable .[dev]
- name: Test with pytest
run: uv run --frozen -- python3 -m pytest --cov=./ --cov-report=xml
- name: Report coverage
run: uv run --frozen -- python3 -m coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
# directory: ./coverage/reports/
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
# path_to_write_report: ./coverage/codecov_report.txt
verbose: true
- name: Upload output files
uses: actions/upload-artifact@v4
with:
name: testoutput-${{ matrix.os }}-py${{ matrix.python-version }}
path: tests/output/