-
Notifications
You must be signed in to change notification settings - Fork 3
257 lines (228 loc) · 7.28 KB
/
release.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
256
257
name: release-please
on: [push, pull_request]
permissions:
contents: write
pull-requests: write
jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black ruff
- name: Autoformat with black
run: |
black .
- name: Lint with ruff
run: |
ruff check . --fix
- name: Check for local changes
run: |
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "style: style fixes by ruff and autoformatting by black"
fi
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: style fixes by ruff and autoformatting by black"
pip-build-sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: |
pip install build
python -m build
- uses: actions/upload-artifact@v4
with:
name: loopprojectfile-dist
path: dist/*.tar.gz
compression-level: 0
pip-test-sdist:
name: Test sdist
needs: pip-build-sdist
runs-on: ubuntu-latest
steps:
- name: Download sdist from artifacts
uses: actions/download-artifact@v4
with:
name: loopprojectfile-dist
path: dist
- name: Build LPF from sdist and install test dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install --no-cache dist/*.tar.gz
pip install netCDF4>=1.5.4 numpy pandas pytest
pip list
pip-build-wheels:
needs: pip-test-sdist
name: Build Wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Wheels
run: |
python -m pip install --upgrade pip
pip install netCDF4>=1.5.4 --only-binary :all:
pip install build numpy pandas pytest
python -m build --wheel
- uses: actions/upload-artifact@v4
with:
name: loopprojectfile-wheels-${{ matrix.os }}
path: dist/*.whl
compression-level: 0
pip-test-wheels:
name: Test wheels on ${{ matrix.os }} (Python ${{ matrix.python-version }})
needs: pip-build-wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version: ["3.9", "3.10", "3.11", "3.12"]
include:
- os: "ubuntu-latest"
artifact: loopprojectfile-wheels-ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Download wheels from artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist
- name: Install dependencies and LoopProjectFile wheel
shell: bash
run: |
pip install --upgrade pip
pip install netCDF4>=1.5.4 --only-binary :all:
pip install numpy pandas pytest
pip install --no-cache --pre --no-index --find-links dist loopprojectfile
pip list
conda-build:
name: Conda Build-Deploy ${{ matrix.os }} - Python Version-${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: anaconda-client-env
use-only-tar-bz2: true
# need to add cygwin action to remove cygpath warnings
- name: Installing Dependencies
shell: bash -l {0}
run: |
conda install -c conda-forge conda-build anaconda-client conda-verify -y
conda install -c conda-forge -c loop3d --file requirements.txt -y
- name: Building and install
shell: bash -l {0}
run: |
pip install . --user
- name: update submodules
shell: bash
run: |
git submodule update --init --recursive
- name: Conda Build
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
path: ~/conda_pkgs_dir
shell: bash -l {0}
run: |
conda build -c anaconda -c conda-forge -c loop3d --output-folder conda conda --python ${{ matrix.python-version }}
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: loopprojectfile-conda-${{ matrix.os }}-${{ matrix.python-version }}
path: conda
release-please:
needs: [pip-test-wheels, conda-build]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: 'release-please-config.json'
manifest-file: '.release-please-manifest.json'
outputs:
release_created: ${{ steps.release.outputs.release_created }}
#if a release is created then run the deploy scripts for github.io, conda, pypi and docker
conda-upload:
needs: [release-please, conda-build]
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version: ["3.9", "3.10", "3.11", "3.12"]
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/download-artifact@v4
with:
name: loopprojectfile-conda-${{ matrix.os }}-${{ matrix.python-version }}
path: conda
- uses: conda-incubator/setup-miniconda@v3
- name: upload all files to conda-forge
shell: bash -l {0}
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
with:
skip-existing: true
verbose: true
run: |
conda install -c anaconda anaconda-client -y
anaconda upload --label main conda/*/*.tar.bz2
pypi-upload:
needs: [release-please, pip-test-wheels]
runs-on:
- ubuntu-latest
- macos-latest
- windows-latest
if: ${{ needs.release-please.outputs.release_created }}
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: loopprojectfile-dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true