Skip to content

Commit 8f2e646

Browse files
committed
Manually merge TryGhost#1742
1 parent bc5c11a commit 8f2e646

File tree

1 file changed

+76
-55
lines changed

1 file changed

+76
-55
lines changed

.github/workflows/ci.yml

+76-55
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ jobs:
2929
node:
3030
- 20
3131
include:
32+
- os: ubuntu-20.04
33+
node: 18
34+
host: x64
35+
target: arm64
3236
- os: windows-latest
3337
node: 20
3438
host: x64
@@ -80,15 +84,33 @@ jobs:
8084
echo "CFLAGS=${CFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV
8185
echo "CXXFLAGS=${CXXFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV
8286
87+
- name: Setup cross compilation for Linux ARM64
88+
if: contains(matrix.os, 'ubuntu') && matrix.target == 'arm64'
89+
run: |
90+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
91+
echo "AS=aarch64-linux-gnu-as" >> $GITHUB_ENV
92+
echo "STRIP=aarch64-linux-gnu-strip" >> $GITHUB_ENV
93+
echo "AR=aarch64-linux-gnu-ar" >> $GITHUB_ENV
94+
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
95+
echo "CPP=aarch64-linux-gnu-cpp" >> $GITHUB_ENV
96+
echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV
97+
echo "LD=aarch64-linux-gnu-ld" >> $GITHUB_ENV
98+
echo "FC=aarch64-linux-gnu-gfortran" >> $GITHUB_ENV
99+
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig" >> $GITHUB_ENV
100+
83101
- name: Build binaries
84102
run: yarn prebuild -a ${{ env.TARGET }}
85103

86104
- name: Print binary info
87105
if: contains(matrix.os, 'ubuntu')
88106
run: |
89-
ldd build/**/node_sqlite3.node
107+
if [ "${{ matrix.target }}" = "arm64" ]; then
108+
PREFIX=aarch64-linux-gnu-
109+
fi
110+
111+
${PREFIX}readelf -d build/**/node_sqlite3.node | grep "Shared library"
90112
echo "---"
91-
nm build/**/node_sqlite3.node | grep "GLIBC_" | c++filt || true
113+
${PREFIX}nm build/**/node_sqlite3.node | grep "GLIBC_" | ${PREFIX}c++filt || true
92114
echo "---"
93115
file build/**/node_sqlite3.node
94116
@@ -108,56 +130,55 @@ jobs:
108130
run: yarn upload --upload-all ${{ github.token }}
109131
if: matrix.node == 20 && startsWith(github.ref, 'refs/tags/')
110132

111-
# build-qemu:
112-
# runs-on: ubuntu-latest
113-
# if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
114-
# strategy:
115-
# fail-fast: false
116-
# matrix:
117-
# node:
118-
# - 20
119-
# target:
120-
# - linux/arm64
121-
# variant:
122-
# - bullseye
123-
# - alpine3.15
124-
# include:
125-
# # musl x64 builds
126-
# - target: linux/amd64
127-
# variant: alpine3.15
128-
# node: 20
129-
# name: ${{ matrix.variant }} (node=${{ matrix.node }}, target=${{ matrix.target }})
130-
# steps:
131-
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
132-
#
133-
# - name: Set up QEMU
134-
# uses: docker/setup-qemu-action@v3
135-
#
136-
# - name: Setup Docker Buildx
137-
# uses: docker/setup-buildx-action@v3
138-
#
139-
# - name: Build binaries and test
140-
# run: |
141-
# docker buildx build \
142-
# --file ./tools/BinaryBuilder.Dockerfile \
143-
# --load \
144-
# --tag sqlite-builder \
145-
# --platform ${{ matrix.target }} \
146-
# --no-cache \
147-
# --build-arg VARIANT=${{ matrix.variant }} \
148-
# --build-arg NODE_VERSION=${{ matrix.node }} \
149-
# .
150-
# CONTAINER_ID=$(docker create -it sqlite-builder)
151-
# docker cp $CONTAINER_ID:/usr/src/build/prebuilds/ ./prebuilds
152-
#
153-
# - name: Upload binaries to commit artifacts
154-
# uses: actions/upload-artifact@v4
155-
# if: matrix.node == 20
156-
# with:
157-
# name: prebuilt-binaries
158-
# path: prebuilds/*
159-
# retention-days: 7
160-
#
161-
# - name: Upload binaries to GitHub Release
162-
# run: yarn install --ignore-scripts && yarn upload --upload-all ${{ github.token }}
163-
# if: matrix.node == 20 && startsWith(github.ref, 'refs/tags/')
133+
build-qemu:
134+
runs-on: ubuntu-latest
135+
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
136+
strategy:
137+
fail-fast: false
138+
matrix:
139+
node:
140+
- 20
141+
target:
142+
- linux/arm64
143+
variant:
144+
- alpine3.15
145+
include:
146+
# musl x64 builds
147+
- target: linux/amd64
148+
variant: alpine3.15
149+
node: 20
150+
name: ${{ matrix.variant }} (node=${{ matrix.node }}, target=${{ matrix.target }})
151+
steps:
152+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
153+
154+
- name: Set up QEMU
155+
uses: docker/setup-qemu-action@v3
156+
157+
- name: Setup Docker Buildx
158+
uses: docker/setup-buildx-action@v3
159+
160+
- name: Build binaries and test
161+
run: |
162+
docker buildx build \
163+
--file ./tools/BinaryBuilder.Dockerfile \
164+
--load \
165+
--tag sqlite-builder \
166+
--platform ${{ matrix.target }} \
167+
--no-cache \
168+
--build-arg VARIANT=${{ matrix.variant }} \
169+
--build-arg NODE_VERSION=${{ matrix.node }} \
170+
.
171+
CONTAINER_ID=$(docker create -it sqlite-builder)
172+
docker cp $CONTAINER_ID:/usr/src/build/prebuilds/ ./prebuilds
173+
174+
- name: Upload binaries to commit artifacts
175+
uses: actions/upload-artifact@v4
176+
if: matrix.node == 20
177+
with:
178+
name: prebuilt-binaries
179+
path: prebuilds/*
180+
retention-days: 7
181+
182+
- name: Upload binaries to GitHub Release
183+
run: yarn install --ignore-scripts && yarn upload --upload-all ${{ github.token }}
184+
if: matrix.node == 20 && startsWith(github.ref, 'refs/tags/')

0 commit comments

Comments
 (0)