-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (125 loc) · 3.29 KB
/
test.yaml
File metadata and controls
137 lines (125 loc) · 3.29 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
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
name: Python Tests
permissions:
contents: read
pull-requests: write
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
slow:
description: Run slow tests
required: false
default: true
type: boolean
e2e:
description: Run end-to-end tests
required: false
default: false
type: boolean
jobs:
unit:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Setup venv
uses: ./.github/actions/setup-venv
- name: Run non-ubuntu quick tests
id: run-unit-tests
if: matrix.os != 'ubuntu-latest'
shell: bash
run: >
uv run pytest \
-m "unit" \
--junitxml=pytest-quick.xml \
--cov=src tests \
--log-level=DEBUG \
--verbose
- name: Run ubuntu quick tests
id: run-quick-ubuntu-tests
if: matrix.os == 'ubuntu-latest'
shell: bash
run: >
uv run pytest \
-m "not slow and not full_pipeline" \
--runner=docker \
--junitxml=pytest-quick.xml \
--cov=src tests \
--log-level=DEBUG \
--verbose
- name: Run slow tests
if: matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' && inputs.slow == true
shell: bash
run: >
uv run pytest \
-m "slow" \
--runner=docker \
--junitxml=pytest-slow.xml \
--cov=src tests \
--cov-append \
--verbose
- name: Run full pipeline tests
if: matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' && inputs.e2e == true
shell: bash
run: >
uv run pytest \
-m "full_pipeline" \
--runner=docker \
--junitxml=pytest-full.xml \
--cov=src tests \
--cov-append \
--verbose
- name: Merge XML files
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
uv pip install junitparser
uv run python -c '
from junitparser import JUnitXml
from pathlib import Path
merged = JUnitXml()
for f in ["pytest-quick.xml", "pytest-slow.xml", "pytest-full.xml"]:
if Path(f).exists():
merged += JUnitXml.fromfile(f)
merged.write("pytest.xml")
'
- name: Pytest coverage comment
if: matrix.os == 'ubuntu-latest'
uses: MishaKav/pytest-coverage-comment@v1
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup venv
uses: ./.github/actions/setup-venv
with:
only-dev: true
- name: Ruff format
run: uv run ruff format --check
- name: Ruff check
run: uv run ruff check
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup venv
uses: ./.github/actions/setup-venv
- run: |
uv run mypy .
deptry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup venv
uses: ./.github/actions/setup-venv
- run: |-
uv run deptry ./src