-
Notifications
You must be signed in to change notification settings - Fork 6
219 lines (182 loc) · 6.44 KB
/
arm64.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
name: ARM64_CI
on:
workflow_dispatch:
inputs:
upload_wheel:
description: 'whether/where to upload the wheel'
required: false
default: 'no'
type: 'choice'
options: ['no', 'pypi', 'testpypi']
publish_npm:
description: 'whether to publish the npm packages'
required: false
default: 'no'
type: 'choice'
options: ['no', 'yes']
push:
branches:
- arm64
pull_request:
branches:
- main
jobs:
build_wheels:
name: Build wheels on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# - name: Ubuntu x86_64
# os: ubuntu-latest
# cibw_archs: x86_64
- name: ARM64 - Emulated
os: ubuntu-latest
cibw_archs: "aarch64"
# - name: Windows
# os: windows-latest
# cibw_archs: "auto"
# - name: Macos 13
# os: macos-1
# cibw_archs: "auto"
# - name: Macos 14
# os: macos-14
# cibw_archs: "auto"
# os: [ubuntu-latest, macos-13, macos-14]
# os: [windows-latest]
steps:
- name: Set up QEMU
if: matrix.cibw_archs == 'aarch64'
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- uses: actions/checkout@v4
- uses: benjlevesque/[email protected]
id: short_sha
# Used to host cibuildwheel
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.19.2 pytest apsw numpy
- uses: ilammy/msvc-dev-cmd@v1
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.29.6'
- name: Setup Ninja
# For now this action doesn't support arm64
if: matrix.cibw_archs != 'aarch64'
uses: seanmiddleditch/gha-setup-ninja@v5
with:
version: 1.11.1
- name: Bootstrap vcpkg
run: |
git submodule update --init --recursive
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS: ${{ matrix.cibw_archs }}
- uses: actions/upload-artifact@v4
with:
name: vectorlite-wheel-${{ matrix.os }}-${{ steps.short_sha.outputs.sha }}
path: ./wheelhouse/*.whl
- name: Get release version
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/v')
shell: bash
run: |
echo "RELEASE_VERSION=$(echo ${{ github.ref_name }} | sed -E 's/^release\///')" >> $GITHUB_ENV
- name: Upload wheels to release assets
if: ${{ github.event_name == 'workflow_dispatch' && (startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/')) }}
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
gh release upload ${{ env.RELEASE_VERSION }} ./wheelhouse/*.whl --clobber
- name: Run python examples
shell: bash
run: |
for wheel in wheelhouse/*.whl; do
echo "Running examples for $wheel"
python -m pip install $wheel --force-reinstall
python -m pip install -r examples/requirements.txt
for example in examples/*.py; do
echo "Running $example"
python $example
done
done
- name: Run benchmark
working-directory: benchmark
shell: bash
run: |
python -m pip install -r requirements.txt
python benchmark.py
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results-${{ matrix.os }}-${{ steps.short_sha.outputs.sha }}
path: ./benchmark/vector*.png
upload_wheels:
name: Upload wheels
if: ${{ github.event.inputs.upload_wheel != 'no' && github.event_name != 'pull_request' }}
needs: build_wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: benjlevesque/[email protected]
id: short_sha
# Download all artifacts
- uses: actions/download-artifact@v4
with:
path: ./wheelhouse
- name: Upload to test.pypi.org
if: ${{ github.event.inputs.upload_wheel == 'testpypi' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: pipx run twine upload --repository testpypi wheelhouse/**/*.whl
- name: Upload to pypi.org
if: ${{ github.event.inputs.upload_wheel == 'pypi' && (startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/')) }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: pipx run twine upload wheelhouse/**/*.whl
- name: Fail if uploading to pypi.org without a tag
if: ${{ github.event.inputs.upload_wheel == 'pypi' && !(startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/')) }}
run: |
echo "Error: Uploading to pypi.org requires a tag"
exit 1
publish_npm_pkgs:
name: Upload npm packages
if: ${{ github.event.inputs.publish_npm == 'yes' && github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release/')) }}
needs: build_wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: benjlevesque/[email protected]
id: short_sha
# Download all artifacts
- uses: actions/download-artifact@v4
with:
path: ./wheelhouse
# extract vectorlite from wheels and copy to nodejs bindings directory
- name: unzip wheels
run: |
sh extract_wheels.sh
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: 'https://registry.npmjs.org'
- name: Test locally
working-directory: bindings/nodejs/packages/vectorlite
run: |
npm i -D
npm link ../vectorlite-linux-x64
npm run test
- name: Publish to npm
working-directory: bindings/nodejs
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
mv package.json.tpl package.json
npm publish --workspaces --access public