-
-
Notifications
You must be signed in to change notification settings - Fork 25
236 lines (202 loc) · 6.43 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
name: Release
on:
push:
branches:
- main # just build the sdist & wheel, skip release
tags:
- "v*"
pull_request: # also build on PRs touching files that affect building sdist / wheels
paths:
- ".github/workflows/release.yml"
- "ci/*"
- "MANIFEST.in"
- "pyproject.toml"
- "setup.py"
workflow_dispatch:
jobs:
build-sdist:
name: Build pyogrio sdist
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Build a source tarball
run: |
python -m pip install --upgrade pip
python -m pip install build setuptools
python -m build --sdist
- uses: actions/upload-artifact@v2
with:
path: ./dist/*.tar.gz
retention-days: 5
build-wheels-linux:
name: Build wheels on Linux
runs-on: "ubuntu-20.04"
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Build Docker image with vcpkg and gdal
# using build-push-action (without push) to make use of cache arguments
uses: docker/build-push-action@v2
with:
context: .
file: ci/manylinux2014_x86_64-vcpkg-gdal.Dockerfile
tags: manylinux-vcpkg-gdal:latest
push: false
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build wheels
uses: pypa/[email protected]
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build-wheels-mac-win:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: "macos-10.15"
triplet: "x64-osx-dynamic"
- os: "windows-2019"
triplet: "x64-windows"
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache vcpkg
uses: actions/cache@v2
id: vcpkgcache
with:
path: |
/Users/runner/.cache/vcpkg/archives
C:\vcpkg\installed
key: ${{ matrix.os }}-x86_64-vcpkg-gdal3.4.2-1
# MacOS build requires aclocal, which is part of automake, but appears
# to be missing in default image
- name: Reinstall automake
if: runner.os == 'macOS'
run: |
brew reinstall automake
echo $(which aclocal)
- name: Install GDAL
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
run: |
vcpkg install gdal[core] --overlay-triplets=./ci/custom-triplets
- name: Upload vcpkg build logs
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
path: $VCPKG_INSTALLATION_ROOT/buildtrees/gdal/*.log
- name: Build wheels
uses: pypa/[email protected]
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
test-wheels:
name: Test wheels on ${{ matrix.os }} (Python ${{ matrix.python-version }})
needs: [build-wheels-linux, build-wheels-mac-win]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04", "windows-latest", "macos-latest", "macos-10.15"]
python-version: ["3.8", "3.9"]
include:
# TODO macOS is failing on py 3.10 because of shapely failure
- os: "ubuntu-20.04"
python-version: "3.10"
- os: "windows-latest"
python-version: "3.10"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "ci/requirements-wheel-test.txt"
- name: Download wheels from artifacts
uses: actions/download-artifact@v2
with:
path: wheelhouse
- name: Install dependencies and pyogrio wheel
shell: bash
run: |
python -m pip install -r ci/requirements-wheel-test.txt
python -m pip install --no-deps geopandas
python -m pip install --find-links wheelhouse/artifact pyogrio
python -m pip list
# TODO temporary set env variable for curl certificate for Linux
- name: Set CURL_CA_BUNDLE environment variable
if: runner.os == 'Linux'
run: |
echo "CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt" >> $GITHUB_ENV
- name: Run tests
shell: bash
run: |
cd ..
python -m pytest --pyargs pyogrio.tests -v
publish:
name: Publish pyogrio to GitHub / PyPI
needs: [build-sdist, test-wheels]
runs-on: ubuntu-latest
# release on every tag
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Get Asset name
run: |
export PKG=$(ls dist/ | grep tar)
set -- $PKG
echo "name=$1" >> $GITHUB_ENV
- name: Upload Release Asset (sdist) to GitHub
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ env.name }}
asset_name: ${{ env.name }}
asset_content_type: application/zip