-
Notifications
You must be signed in to change notification settings - Fork 24
187 lines (159 loc) · 4.46 KB
/
build.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
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
name: build
on:
push:
branches: [ main ]
# tags: ['*']
pull_request:
branches: [ main ]
release:
types:
- published
env:
FORCE_COLOR: 1
jobs:
tests:
runs-on: ubuntu-latest
strategy:
max-parallel: 8
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13-dev']
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
# NOTE: pdm caching unsupported
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "pdm.lock"
- name: Install dependencies
run: |
python --version
python -m pip install --upgrade pip nox nox-pdm pdm
- name: Run tests
run: |
nox --session tests-cov -- -v --cov-report=xml
nox --session tests-cov-vtk --no-error-on-missing-interpreters -- -v --cov-report=xml
- name: Run mypy
run: |
nox --session types
- name: Upload coverage
if: ${{ success() && matrix.python-version == '3.7' }}
run: |
pip install coveralls coverage[toml]
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
needs: [tests, tests-miniforge, docs]
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox nox-pdm pdm
- name: Package
run: nox --session release-build
- name: Publish package
if: |
(
( github.event_name == 'release' && github.event.action == 'published' ) ||
( github.event_name == 'push' && startsWith(github.ref, 'refs/tags') )
)
env:
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
run: nox --session release-upload -- --repository testpypi
tests-miniforge:
name: test (${{ matrix.os }}, ${{ matrix.miniforge-variant }})
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [
# "ubuntu",
"macos",
"windows"
]
include:
# - os: ubuntu
# environment-file: .github/environment_pypy.yml
# miniforge-variant: Mambaforge-pypy3
- os: macos
environment-file: .github/environment.yml
- os: windows
environment-file: .github/environment.yml
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache conda
uses: actions/cache@v4
env:
# Increase this value to reset cache if environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
- uses: conda-incubator/setup-miniconda@v3
with:
environment-file: ${{ matrix.environment-file }}
condarc-file: .github/condarc.yml
# use-mamba: true
- name: Verify Python environment
shell: bash -l {0}
run: |
conda list
python --version
- name: Install dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
python -m pip install .[tests]
- name: Run tests
shell: bash -l {0}
run: |
python -m pytest -v -n auto
docs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
# This is required because asv (air speed velocity) needs this
- name: Fetch main
if: github.ref != 'refs/heads/main'
run: git fetch origin $GITHUB_BASE_REF:main $GITHUB_REF:pr
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: "requirements/docs.txt"
- name: Verify Python environment
run: |
pip list
pip cache list
pip check
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox nox-pdm pdm
- name: Build docs
run: |
nox --session docs -- -W