Skip to content

Commit f163def

Browse files
committed
fix: use buildjet to build ARM images
1 parent 1a28872 commit f163def

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

.cargo/config.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
# Postgres symbols won't be available until runtime
33
rustflags = ["-Clink-arg=-Wl,-undefined,dynamic_lookup"]
44

5-
[target.'cfg(target_arch = "x86_64")']
5+
# Apparently we're not able to use target-feature on macs with ARM, so we shouldn't specify that
6+
[target.'cfg(not(all(target_os = "macos", target_arch = "aarch64")))']
67
rustflags = ["-C", "target-feature=+aes"]

.github/workflows/release.yaml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ jobs:
2020
fail-fast: false # We want all of them to run, even if one fails
2121
matrix:
2222
pg_version: [12, 13, 14, 15, 16]
23-
os: [ubuntu-latest, macos-latest]
24-
arch: [amd64, arm64]
25-
exclude:
26-
- os: macos-latest
27-
arch: amd64
23+
os: [buildjet-4vcpu-ubuntu-2204, buildjet-4vcpu-ubuntu-2204-arm, macos-latest]
2824

2925
runs-on: ${{ matrix.os }}
3026

@@ -76,21 +72,31 @@ jobs:
7672
7773
- name: Format OS name for release
7874
run: |
79-
LOWERCASE_OS=$(echo ${{ runner.os }} | tr '[:upper:]' '[:lower:]')
80-
if [ "$LOWERCASE_OS" = "macos" ]; then
81-
LOWERCASE_OS="darwin"
82-
fi
75+
LOWERCASE_OS=$(uname -s | tr '[:upper:]' '[:lower:]')
76+
8377
echo "LOWERCASE_OS=$LOWERCASE_OS" >> $GITHUB_ENV
8478
79+
- name: Format arch
80+
run: |
81+
ARCH=$(uname -m)
82+
83+
if [ "$ARCH" = "x86_64" ]; then
84+
ARCH="amd64"
85+
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
86+
ARCH="arm64"
87+
fi
88+
89+
echo "ARCH=$ARCH" >> $GITHUB_ENV
90+
8591
- name: Package Extension
8692
run: |
8793
mkdir -p release
88-
tar -czvf release/${{ env.EXTENSION_NAME }}-pg${{ matrix.pg_version }}-${{ env.LOWERCASE_OS }}-${{ matrix.arch }}.tar.gz -C target/release/${{ env.EXTENSION_NAME }}-pg${{ matrix.pg_version }} .
94+
tar -czvf release/${{ env.EXTENSION_NAME }}-pg${{ matrix.pg_version }}-${{ env.LOWERCASE_OS }}-${{ env.ARCH }}.tar.gz -C target/release/${{ env.EXTENSION_NAME }}-pg${{ matrix.pg_version }} .
8995
9096
- name: Upload Release Asset
9197
uses: softprops/action-gh-release@v1
9298
with:
93-
files: release/${{ env.EXTENSION_NAME }}-pg${{ matrix.pg_version }}-${{ env.LOWERCASE_OS }}-${{ matrix.arch }}.tar.gz
99+
files: release/${{ env.EXTENSION_NAME }}-pg${{ matrix.pg_version }}-${{ env.LOWERCASE_OS }}-${{ env.ARCH }}.tar.gz
94100

95101
build-and-push-docker:
96102
needs: build-and-publish
@@ -99,6 +105,7 @@ jobs:
99105
steps:
100106
- uses: actions/checkout@v4
101107

108+
# It's fine to use QEMU here because we're not building the extension inside the Dockerfile
102109
- name: Set up QEMU
103110
uses: docker/setup-qemu-action@v3
104111

0 commit comments

Comments
 (0)