Skip to content

Commit

Permalink
support mac M1 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
asg017 committed Aug 5, 2023
1 parent d191d98 commit 4ed110c
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
62 changes: 60 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,38 @@ jobs:
with:
name: sqlite-http-macos-wheels
path: dist/wheels/*.whl

build-macos-arm-extension:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
# using actions/setup-go@v1 is the only way to get macos build to work.
# otherwise, with v2, would get this cgo error: 'cgo-generated-wrappers:13:13: error: redefinition of 'free' as different kind of symbol'
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.20
- run: GOOS=darwin GOARCH=arm64 CC="gcc -target arm64-apple-macos11" make loadable
- uses: actions/upload-artifact@v3
with:
name: sqlite-http-macos-arm
path: dist/http0.dylib
build-macos-arm-python:
runs-on: macos-latest
needs: [build-macos-arm-extension]
steps:
- uses: actions/checkout@v3
- name: Download workflow artifacts
uses: actions/download-artifact@v3
with:
name: sqlite-http-macos-arm
path: dist/
- uses: actions/setup-python@v3
- run: pip install wheel
- run: make python IS_MACOS_ARM=1
- uses: actions/upload-artifact@v3
with:
name: sqlite-http-macos-arm-wheels
path: dist/wheels/*.whl
build-windows-extension:
name: Building windows extension
runs-on: windows-latest
Expand Down Expand Up @@ -113,6 +144,7 @@ jobs:
needs:
[
build-macos-extension,
build-macos-arm-extension,
build-linux_x86-extension,
build-windows-extension,
]
Expand All @@ -130,12 +162,14 @@ jobs:
platforms: |
linux-x86_64: sqlite-http-linux_x86/*
macos-x86_64: sqlite-http-macos/*
macos-aarch64: sqlite-http-macos-arm/*
windows-x86_64: sqlite-http-windows/*
upload-deno:
name: Upload Deno release assets
needs:
[
build-macos-extension,
build-macos-arm-extension,
build-linux_x86-extension,
build-windows-extension,
]
Expand All @@ -156,6 +190,7 @@ jobs:
needs:
[
build-macos-extension,
build-macos-arm-extension,
build-linux_x86-extension,
build-windows-extension,
]
Expand Down Expand Up @@ -183,6 +218,11 @@ jobs:
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish NPM sqlite-http-darwin-arm64
working-directory: npm/sqlite-http-darwin-arm64
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish NPM sqlite-http-windows-x64
working-directory: npm/sqlite-http-windows-x64
run: npm publish --access public
Expand All @@ -194,7 +234,13 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
upload_pypi:
needs: [build-linux_x86-python, build-macos-python, build-windows-python]
needs:
[
build-linux_x86-python,
build-macos-python,
build-macos-arm-python,
build-windows-python,
]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
Expand All @@ -209,6 +255,10 @@ jobs:
with:
name: sqlite-http-macos-wheels
path: dist
- uses: actions/download-artifact@v3
with:
name: sqlite-http-macos-arm-wheels
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
Expand All @@ -217,6 +267,7 @@ jobs:
needs:
[
build-macos-extension,
build-macos-arm-extension,
build-linux_x86-extension,
build-windows-extension,
]
Expand All @@ -241,6 +292,12 @@ jobs:
gem -C bindings/ruby build -o ${{ env.PLATFORM }}.gem sqlite_http.gemspec
env:
PLATFORM: x86_64-darwin
- run: |
rm bindings/ruby/lib/*.{dylib,so,dll} || true
cp sqlite-http-macos-arm/*.dylib bindings/ruby/lib
gem -C bindings/ruby build -o ${{ env.PLATFORM }}.gem sqlite_http.gemspec
env:
PLATFORM: arm64-darwin
- run: |
rm bindings/ruby/lib/*.{dylib,so,dll} || true
cp sqlite-http-windows/*.dll bindings/ruby/lib
Expand All @@ -250,6 +307,7 @@ jobs:
- run: |
gem push bindings/ruby/x86_64-linux.gem
gem push bindings/ruby/x86_64-darwin.gem
gem push bindings/ruby/arm64-darwin.gem
gem push bindings/ruby/x64-mingw32.gem
env:
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
4 changes: 4 additions & 0 deletions .github/workflows/upload-deno-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ const compiled_extensions = [
path: "sqlite-http-macos/http0.dylib",
name: "deno-darwin-x86_64.http0.dylib",
},
{
path: "sqlite-http-macos-arm/http0.dylib",
name: "deno-darwin-aarch64.http0.dylib",
},
{
path: "sqlite-http-linux_x86/http0.so",
name: "deno-linux-x86_64.http0.so",
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ else
PYTHON=python3
endif

ifdef IS_MACOS_ARM
RENAME_WHEELS_ARGS=--is-macos-arm
else
RENAME_WHEELS_ARGS=
endif

prefix=dist

TARGET_LOADABLE=$(prefix)/http0.$(LOADABLE_EXTENSION)
Expand Down
1 change: 1 addition & 0 deletions scripts/npm_generate_platform_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ envsubst < npm/$PACKAGE_NAME_BASE/package.json.tmpl > npm/$PACKAGE_NAME_BASE/pac
echo "✅ generated npm/$PACKAGE_NAME_BASE"

generate darwin x64
generate darwin arm64
generate linux x64
generate windows x64

0 comments on commit 4ed110c

Please sign in to comment.