-
Notifications
You must be signed in to change notification settings - Fork 17
255 lines (247 loc) · 7.45 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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
lint:
name: lint and style checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black black[jupyter] ruff
- name: Black style check
run: |
black --check .
- name: Lint with ruff
run: |
ruff check .
build_0:
name: xradar unit tests - linux
runs-on: ubuntu-latest
needs: [lint]
defaults:
run:
shell: bash -l {0}
env:
CONDA_ENV_FILE: ci/unittests.yml
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.12"]
numpy-version: ["1", "2"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install micromamba environment
uses: mamba-org/setup-micromamba@v1
with:
environment-name: xradar-unit-tests
environment-file: ${{env.CONDA_ENV_FILE}}
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
create-args: >-
python=${{matrix.python-version}}
numpy=${{matrix.numpy-version}}
conda
- name: Install xradar
run: |
python -m pip install . --no-deps
- name: Version Info
run: |
python -c "import xradar; print(xradar.version.version)"
- name: Test with pytest
run: |
pytest -n auto --dist loadfile --verbose --durations=15 --cov-report xml:coverage_unit.xml --cov=xradar --pyargs tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage_unit.xml
flags: unittests
env_vars: RUNNER_OS,PYTHON_VERSION
name: codecov-gha
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN}}
build_1:
name: xradar notebook tests - linux
runs-on: ubuntu-latest
needs: [lint]
defaults:
run:
shell: bash -l {0}
env:
CONDA_ENV_FILE: ci/notebooktests.yml
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
numpy-version: ["2"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install micromamba environment
uses: mamba-org/setup-micromamba@v1
with:
environment-name: xradar-notebook-tests
environment-file: ${{env.CONDA_ENV_FILE}}
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
create-args: >-
python=${{matrix.python-version}}
numpy=${{matrix.numpy-version}}
conda
- name: Install xradar
run: |
python -m pip install . --no-deps
- name: Version Info
run: |
python -c "import xradar; print(xradar.version.version)"
- name: Test with pytest
run: |
pytest -n auto --dist loadscope --verbose --durations=15 --cov-report xml:coverage_notebook.xml --cov=xradar --pyargs examples/notebooks
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage_notebook.xml
flags: notebooktests
env_vars: RUNNER_OS,PYTHON_VERSION
name: codecov-gha
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN}}
build_2:
name: xarray nightly tests - linux
runs-on: ubuntu-latest
needs: [ lint ]
continue-on-error: true
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: [ "3.12" ]
numpy-version: [ "2" ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install micromamba environment
uses: mamba-org/setup-micromamba@v1
with:
environment-name: xradar-unit-tests
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
create-args: >-
python=${{matrix.python-version}}
cmweather
dask
fsspec
h5netcdf
h5py
lat_lon_parser
netCDF4
open-radar-data>=0.3.0
packaging
pandas
pip
pyproj
pytest
pytest-doctestplus
pytest-sugar
pytest-xdist
scipy
setuptools
wheel
xmltodict
numpy=${{matrix.numpy-version}}
conda
- name: Install xarray
run: |
python -m pip install --no-deps --ignore-installed --no-cache-dir -vvv \
git+https://github.com/pydata/xarray.git@main
- name: Install xradar
run: |
python -m pip install --no-deps .
- name: Version Info
run: |
python -c "import xradar; print(xradar.version.version)"
- name: Test with pytest
run: |
pytest -n auto --dist loadscope --verbose --durations=15 --pyargs tests
test_build_distribution_testpypi:
name: test build distribution for testpypi
needs: [lint, build_0]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build setuptools wheel twine toml-cli
- name: Package
run: |
toml set --toml-path pyproject.toml tool.setuptools_scm.local_scheme "no-local-version"
git update-index --assume-unchanged pyproject.toml
python -m build
cp dist/xradar*.gz dist/xradar1.gz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: xradar-1-${{github.event.number}}
path: dist/xradar1.gz
- name: Upload to TestPyPI
if: ${{ github.event_name == 'push' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TESTPYPI_API_TOKEN }}
run: |
rm -f dist/xradar1.gz
twine upload --repository testpypi dist/*
test_build_distribution_pypi:
name: test build distribution
needs: [lint, build_0, test_build_distribution_testpypi]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build setuptools wheel
- name: Package
run: |
python -m build
cp dist/xradar*.gz dist/xradar0.gz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: xradar-0-${{github.event.number}}
path: dist/xradar0.gz