Skip to content

Commit 4ed110c

Browse files
committed
support mac M1 builds
1 parent d191d98 commit 4ed110c

File tree

4 files changed

+71
-2
lines changed

4 files changed

+71
-2
lines changed

.github/workflows/release.yaml

+60-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,38 @@ jobs:
7373
with:
7474
name: sqlite-http-macos-wheels
7575
path: dist/wheels/*.whl
76-
76+
build-macos-arm-extension:
77+
runs-on: macos-latest
78+
steps:
79+
- uses: actions/checkout@v2
80+
# using actions/setup-go@v1 is the only way to get macos build to work.
81+
# otherwise, with v2, would get this cgo error: 'cgo-generated-wrappers:13:13: error: redefinition of 'free' as different kind of symbol'
82+
- name: Set up Go 1.20
83+
uses: actions/setup-go@v1
84+
with:
85+
go-version: 1.20
86+
- run: GOOS=darwin GOARCH=arm64 CC="gcc -target arm64-apple-macos11" make loadable
87+
- uses: actions/upload-artifact@v3
88+
with:
89+
name: sqlite-http-macos-arm
90+
path: dist/http0.dylib
91+
build-macos-arm-python:
92+
runs-on: macos-latest
93+
needs: [build-macos-arm-extension]
94+
steps:
95+
- uses: actions/checkout@v3
96+
- name: Download workflow artifacts
97+
uses: actions/download-artifact@v3
98+
with:
99+
name: sqlite-http-macos-arm
100+
path: dist/
101+
- uses: actions/setup-python@v3
102+
- run: pip install wheel
103+
- run: make python IS_MACOS_ARM=1
104+
- uses: actions/upload-artifact@v3
105+
with:
106+
name: sqlite-http-macos-arm-wheels
107+
path: dist/wheels/*.whl
77108
build-windows-extension:
78109
name: Building windows extension
79110
runs-on: windows-latest
@@ -113,6 +144,7 @@ jobs:
113144
needs:
114145
[
115146
build-macos-extension,
147+
build-macos-arm-extension,
116148
build-linux_x86-extension,
117149
build-windows-extension,
118150
]
@@ -130,12 +162,14 @@ jobs:
130162
platforms: |
131163
linux-x86_64: sqlite-http-linux_x86/*
132164
macos-x86_64: sqlite-http-macos/*
165+
macos-aarch64: sqlite-http-macos-arm/*
133166
windows-x86_64: sqlite-http-windows/*
134167
upload-deno:
135168
name: Upload Deno release assets
136169
needs:
137170
[
138171
build-macos-extension,
172+
build-macos-arm-extension,
139173
build-linux_x86-extension,
140174
build-windows-extension,
141175
]
@@ -156,6 +190,7 @@ jobs:
156190
needs:
157191
[
158192
build-macos-extension,
193+
build-macos-arm-extension,
159194
build-linux_x86-extension,
160195
build-windows-extension,
161196
]
@@ -183,6 +218,11 @@ jobs:
183218
run: npm publish --access public
184219
env:
185220
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
221+
- name: Publish NPM sqlite-http-darwin-arm64
222+
working-directory: npm/sqlite-http-darwin-arm64
223+
run: npm publish --access public
224+
env:
225+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
186226
- name: Publish NPM sqlite-http-windows-x64
187227
working-directory: npm/sqlite-http-windows-x64
188228
run: npm publish --access public
@@ -194,7 +234,13 @@ jobs:
194234
env:
195235
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
196236
upload_pypi:
197-
needs: [build-linux_x86-python, build-macos-python, build-windows-python]
237+
needs:
238+
[
239+
build-linux_x86-python,
240+
build-macos-python,
241+
build-macos-arm-python,
242+
build-windows-python,
243+
]
198244
runs-on: ubuntu-latest
199245
steps:
200246
- uses: actions/download-artifact@v3
@@ -209,6 +255,10 @@ jobs:
209255
with:
210256
name: sqlite-http-macos-wheels
211257
path: dist
258+
- uses: actions/download-artifact@v3
259+
with:
260+
name: sqlite-http-macos-arm-wheels
261+
path: dist
212262
- uses: pypa/gh-action-pypi-publish@release/v1
213263
with:
214264
password: ${{ secrets.PYPI_API_TOKEN }}
@@ -217,6 +267,7 @@ jobs:
217267
needs:
218268
[
219269
build-macos-extension,
270+
build-macos-arm-extension,
220271
build-linux_x86-extension,
221272
build-windows-extension,
222273
]
@@ -241,6 +292,12 @@ jobs:
241292
gem -C bindings/ruby build -o ${{ env.PLATFORM }}.gem sqlite_http.gemspec
242293
env:
243294
PLATFORM: x86_64-darwin
295+
- run: |
296+
rm bindings/ruby/lib/*.{dylib,so,dll} || true
297+
cp sqlite-http-macos-arm/*.dylib bindings/ruby/lib
298+
gem -C bindings/ruby build -o ${{ env.PLATFORM }}.gem sqlite_http.gemspec
299+
env:
300+
PLATFORM: arm64-darwin
244301
- run: |
245302
rm bindings/ruby/lib/*.{dylib,so,dll} || true
246303
cp sqlite-http-windows/*.dll bindings/ruby/lib
@@ -250,6 +307,7 @@ jobs:
250307
- run: |
251308
gem push bindings/ruby/x86_64-linux.gem
252309
gem push bindings/ruby/x86_64-darwin.gem
310+
gem push bindings/ruby/arm64-darwin.gem
253311
gem push bindings/ruby/x64-mingw32.gem
254312
env:
255313
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}

.github/workflows/upload-deno-assets.js

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ const compiled_extensions = [
55
path: "sqlite-http-macos/http0.dylib",
66
name: "deno-darwin-x86_64.http0.dylib",
77
},
8+
{
9+
path: "sqlite-http-macos-arm/http0.dylib",
10+
name: "deno-darwin-aarch64.http0.dylib",
11+
},
812
{
913
path: "sqlite-http-linux_x86/http0.so",
1014
name: "deno-linux-x86_64.http0.so",

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ else
3838
PYTHON=python3
3939
endif
4040

41+
ifdef IS_MACOS_ARM
42+
RENAME_WHEELS_ARGS=--is-macos-arm
43+
else
44+
RENAME_WHEELS_ARGS=
45+
endif
46+
4147
prefix=dist
4248

4349
TARGET_LOADABLE=$(prefix)/http0.$(LOADABLE_EXTENSION)

scripts/npm_generate_platform_packages.sh

+1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ envsubst < npm/$PACKAGE_NAME_BASE/package.json.tmpl > npm/$PACKAGE_NAME_BASE/pac
3434
echo "✅ generated npm/$PACKAGE_NAME_BASE"
3535

3636
generate darwin x64
37+
generate darwin arm64
3738
generate linux x64
3839
generate windows x64

0 commit comments

Comments
 (0)