-
Notifications
You must be signed in to change notification settings - Fork 3
151 lines (135 loc) · 4.52 KB
/
code-quality.yaml
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
name: Code Quality
on:
pull_request: {}
push:
branches: [main]
jobs:
code-quality:
name: Code Quality
strategy:
matrix:
platform: [ubuntu-latest]
python-version: ["3.10"]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Linting
uses: pre-commit/action@v3.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
test-core:
name: Test Core
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
pipx install poetry # setup-python action requires installing poetry with pipx
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
# setup-python uses by default poetry.lock hash as part of the cache key.
# Since we run test-core and test-extras we need to make sure they store different caches.
# Adding an extra file (e.g. pyproject.toml) to the extra cache-dependency-path will ensure that we
# create a different cache key than the one generated for test-extras.
# We can then be sure that test-core will run using only core dependencies.
cache-dependency-path: |
poetry.lock
pyproject.toml # Force a different cache key for extras vs core above
- name: Install Core Dependencies
run: |
poetry install
- name: Run Core Tests
run: poetry run pytest -m core --cov-report=xml --junitxml=test-results.xml
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Unit Test Results (Python ${{ matrix.python-version }} - ${{ matrix.platform }})
path: test-results.xml
- name: Upload Coverage Reports
uses: codecov/codecov-action@v4
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
test-extras:
name: Test Extras
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
pipx install poetry # setup-python action requires installing poetry with pipx
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
cache-dependency-path: |
poetry.lock
- name: Install Extras Dependencies
run: |
poetry install --all-extras
- name: Run Extras Tests
env:
NUMBA_DISABLE_JIT: 1
run: poetry run pytest --cov-report=xml --junitxml=test-results.xml
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Unit Test Extras Results (Python ${{ matrix.python-version }} - ${{ matrix.platform }})
path: test-results.xml
- name: Upload Coverage Reports
uses: codecov/codecov-action@v4
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
run-examples:
name: Run Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.11'
- name: Install dependencies
run: |
pipx install poetry # setup-python action requires installing poetry with pipx
poetry install --with docs
- name: Run Examples
run: |
cd docs-source
poetry run make html
publish-test-results:
name: "Unit Test Results"
needs: [test-core, test-extras]
runs-on: ubuntu-latest
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: artifacts/**/test-results.xml
check_name: Unit Test Results