-
Notifications
You must be signed in to change notification settings - Fork 2
175 lines (154 loc) · 6.07 KB
/
wheels.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
name: Build and test wheels, release on new tag
env:
librepo: polyline-ffi
rustlib: polylineffi
wheelname: pypolyline
on: [push, pull_request]
jobs:
get_latest_lib_tag:
name: Get latest Rust lib tag
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.latest-tag.outputs.tag}}
steps:
- id: latest-tag
uses: oprypin/find-latest-tag@v1
with:
repository: urschrei/${{ env.librepo }} # The repository to scan.
releases-only: true # We know that all relevant tags have a GitHub release for them.
- run: echo "Latest lib tag ${{ steps.latest-tag.outputs.tag }}"
build_wheels:
name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }}
needs: get_latest_lib_tag
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
pybuilds: cp3{7,8,9,10,11,12}-manylinux_x86_64
arch: x86_64
id: linux
- os: ubuntu-latest
pybuilds: cp3{7,8,9,10,11,12}-manylinux_aarch64
arch: aarch64
id: linux_arm64
- os: macos-latest
pybuilds: cp3{7,8,9,10,11,12}-macosx_x86_64
arch: x86_64
id: macos_x86
- os: macos-latest
pybuilds: cp3{8,9,10,11,12}-macosx_arm64
arch: arm64
id: macos_arm64
- os: windows-latest
pybuilds: cp3{7,8,9,10,11,12}-win_amd64
arch: x86_64
id: windows
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules
name: Check out repo
- name: Set up QEMU
if: matrix.id == 'linux_arm64'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- id: set-filename
name: Set compressed Rust lib filename to retrieve based on OS
run: |
if [ "${{ matrix.id }}" == "linux" ]; then
echo "filename=${{ env.rustlib }}-${{ needs.get_latest_lib_tag.outputs.tag }}-x86_64-unknown-linux-gnu.tar.gz" >> $GITHUB_ENV
elif [ "${{ matrix.id }}" == "linux_arm64" ]; then
echo "filename=${{ env.rustlib }}-${{ needs.get_latest_lib_tag.outputs.tag }}-aarch64-unknown-linux-gnu.tar.gz" >> $GITHUB_ENV
elif [ "${{ matrix.id }}" == "windows" ]; then
echo "filename=${{ env.rustlib }}-${{ needs.get_latest_lib_tag.outputs.tag }}-x86_64-pc-windows-msvc.tar.gz" >> $GITHUB_ENV
elif [ "${{ matrix.id }}" == "macos_arm64" ]; then
echo "filename=${{ env.rustlib }}-${{ needs.get_latest_lib_tag.outputs.tag }}-aarch64-apple-darwin.tar.gz" >> $GITHUB_ENV
elif [ "${{ matrix.id }}" == "macos_x86" ]; then
echo "filename=${{ env.rustlib }}-${{ needs.get_latest_lib_tag.outputs.tag }}-x86_64-apple-darwin.tar.gz" >> $GITHUB_ENV
fi
shell: bash
- id: get-rust-lib
uses: robinraju/[email protected]
name: Download latest Rust lib release
with:
token: ${{ secrets.POLYLINE_RETRIEVAL }}
repository: urschrei/${{ env.librepo }}
tag: ${{ needs.get_latest_lib_tag.outputs.tag }}
fileName: ${{ env.filename }}
out-file-path: rustlib
- name: Extract downloaded lib
run: |
tar -xvf "rustlib/${{ env.filename }}" -C src/${{ env.wheelname }}
mkdir wheelhouse
git status
shell: bash
- name: Build and Test Wheels
uses: pypa/[email protected]
env:
CIBW_BEFORE_BUILD_MACOS: pip install numpy cython
CIBW_BEFORE_BUILD: pip install numpy cython
CIBW_TEST_REQUIRES: setuptools pytest numpy cython
CIBW_TEST_COMMAND: 'pytest {package}'
CIBW_BUILD: ${{ matrix.pybuilds }}
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
CIBW_ARCHS_LINUX: "auto aarch64"
CIBW_TEST_SKIP: "*:arm64"
- uses: actions/upload-artifact@v3
name: Upload repaired wheels as artifact
with:
name: wheels-${{ matrix.os }}
path: |
./wheelhouse/*.whl
./wheelhouse/*.so
./wheelhouse/*.dylib
./wheelhouse/*.lib
./wheelhouse/*.dll
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
release_artifacts:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
name: Release repaired and tested wheels
needs: build_wheels
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules
- name: Download compressed artifacts
id: download
uses: actions/download-artifact@v3
with:
path: ./artifacts
- name: 'List downloaded files'
run: ls ${{ steps.download.outputs.download-path }}/**/*.*
- name: Create release and upload wheels
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "${{ steps.download.outputs.download-path }}/**/*.whl,${{ steps.download.outputs.download-path }}/**/*.gz,${{ steps.download.outputs.download-path }}/**/*.so,${{ steps.download.outputs.download-path }}/**/*.dylib,${{ steps.download.outputs.download-path }}/**/*.lib,${{ steps.download.outputs.download-path }}/**/*.dll"
token: ${{ secrets.GITHUB_TOKEN }}
- name: PyPI Publish
uses: pypa/[email protected]
with:
packages-dir: ${{ steps.download.outputs.download-path }}/**/