Skip to content

Commit 0f85318

Browse files
authored
Merge pull request #691 from zeromq/arm-linux [skip ci]
2 parents 0afa859 + 65c8e08 commit 0f85318

File tree

4 files changed

+201
-20
lines changed

4 files changed

+201
-20
lines changed

.github/workflows/CI.yml

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
Build:
1010
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
1111
runs-on: ${{ matrix.os }}
12+
# prettier-ignore
13+
name: ${{ matrix.os }}-${{ matrix.node_arch }}-${{ matrix.dockerfile }}-${{ matrix.distro }}
1214
strategy:
1315
fail-fast: false
1416
matrix:
@@ -21,11 +23,16 @@ jobs:
2123
- x64
2224
dockerfile:
2325
- ""
26+
distro:
27+
- ""
28+
native:
29+
- true
2430

2531
include:
2632
- os: windows-2019
2733
node_arch: ia32
2834
cpp_arch: amd64_x86
35+
native: true
2936

3037
# - os: windows-2022
3138
# node_arch: x64
@@ -35,16 +42,33 @@ jobs:
3542
- os: macos-13
3643
node_arch: x64
3744
cpp_arch: x64
45+
native: true
3846

3947
- os: macos-14
4048
node_arch: arm64
4149
cpp_arch: amd64_arm64
50+
native: true
4251

43-
# Alpine
44-
- os: ubuntu-22.04
52+
# Musl Alpine
53+
- os: ubuntu-24.04
4554
dockerfile: docker/alpine.dockerfile
4655
node_arch: x64
4756
cpp_arch: x64
57+
native: false
58+
59+
# Debian Arm
60+
- os: ubuntu-24.04
61+
node_arch: arm64
62+
cpp_arch: amd64_arm64
63+
distro: bookworm
64+
native: false
65+
66+
# Musl Alpine Arm
67+
- os: ubuntu-24.04
68+
node_arch: arm64
69+
cpp_arch: amd64_arm64
70+
distro: alpine_latest
71+
native: false
4872

4973
env:
5074
npm_config_arch: ${{ matrix.node_arch }}
@@ -59,9 +83,8 @@ jobs:
5983
path: |
6084
./node_modules/
6185
~/vcpkg
62-
key:
63-
# prettier-ignore
64-
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch}}-${{hashFiles('./pnpm-lock.yaml', './vcpkg.json', './CMakeLists.txt') }}"
86+
# prettier-ignore
87+
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch}}-${{hashFiles('./pnpm-lock.yaml', './vcpkg.json', './CMakeLists.txt') }}"
6588
restore-keys: |
6689
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-"
6790
@@ -73,7 +96,7 @@ jobs:
7396
shell: bash
7497

7598
- name: Setup Cpp
76-
if: ${{ !matrix.dockerfile }}
99+
if: ${{ matrix.native }}
77100
uses: aminya/setup-cpp@v1
78101
with:
79102
vcvarsall: ${{ contains(matrix.os, 'windows') }}
@@ -89,34 +112,34 @@ jobs:
89112
brew install gnutls autoconf automake libtool
90113
91114
- uses: pnpm/action-setup@v4
92-
if: ${{ !matrix.dockerfile }}
115+
if: ${{ matrix.native }}
93116
with:
94117
version: 9
95118

96119
- name: Install Node 20
97-
if: ${{ !matrix.dockerfile }}
120+
if: ${{ matrix.native }}
98121
uses: actions/setup-node@v4
99122
with:
100123
node-version: 20
101124
architecture: ${{ env.setup_node_arch }}
102125

103126
- name: Install and Build Native
104-
if: ${{ !matrix.dockerfile }}
127+
if: ${{ matrix.native }}
105128
run: pnpm install
106129

107130
- name: Build JavaScript
108-
if: ${{ !matrix.dockerfile }}
131+
if: ${{ matrix.native }}
109132
run: pnpm run build.js
110133

111134
- name: Install Node 10
112-
if: ${{ !matrix.dockerfile && matrix.os != 'macos-14' }}
135+
if: ${{ matrix.native && matrix.os != 'macos-14' }}
113136
uses: actions/setup-node@v4
114137
with:
115138
node-version: 10
116139
architecture: ${{ env.setup_node_arch }}
117140

118141
- name: Build Native
119-
if: ${{ !matrix.dockerfile && matrix.node_arch != 'ia32' }}
142+
if: ${{ matrix.native && matrix.node_arch != 'ia32' }}
120143
run: npm run build.native
121144

122145
- name: Build Native Windows 32
@@ -126,7 +149,7 @@ jobs:
126149
windows-x86
127150

128151
- name: Use Node 20
129-
if: ${{ !matrix.dockerfile }}
152+
if: ${{ matrix.native }}
130153
uses: actions/setup-node@v4
131154
with:
132155
node-version: 20
@@ -137,9 +160,39 @@ jobs:
137160
run: |
138161
docker build -t zeromq -f ${{ matrix.dockerfile }} .
139162
docker create --name zeromq-temp zeromq
140-
docker cp zeromq-temp:/app/build ./build
163+
mkdir -p ./build
164+
docker cp zeromq-temp:/app/build ./
141165
docker rm -f zeromq-temp
142166
167+
- name: Read Installer Script
168+
if: ${{ matrix.distro }}
169+
id: read-installer-script
170+
run: |
171+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
172+
echo "install_deps<<$EOF" >> $GITHUB_OUTPUT
173+
cat ./script/install-deps.sh >> $GITHUB_OUTPUT
174+
echo "$EOF" >> $GITHUB_OUTPUT
175+
176+
- name: Build Linux Arm64
177+
if: ${{ matrix.distro }}
178+
uses: uraimo/[email protected]
179+
with:
180+
arch: aarch64
181+
distro: ${{ matrix.distro }}
182+
githubToken: ${{ github.token }}
183+
setup: |
184+
mkdir -p "${PWD}/build"
185+
dockerRunArgs: |
186+
--volume "${PWD}/build:/build"
187+
env: |
188+
VCPKG_FORCE_SYSTEM_BINARIES: 1
189+
install: |
190+
${{ steps.read-installer-script.outputs.install_deps }}
191+
192+
run: |
193+
pnpm install && \
194+
pnpm run build
195+
143196
- name: Upload build
144197
uses: actions/upload-artifact@v4
145198
with:
@@ -148,11 +201,11 @@ jobs:
148201
overwrite: true
149202

150203
- name: Lint
151-
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.dockerfile }}"
204+
if: "${{ contains(matrix.os, 'ubuntu') && matrix.native }}"
152205
run: pnpm run lint-test
153206

154207
- name: Test
155-
if: ${{ !matrix.dockerfile }}
208+
if: ${{ matrix.native }}
156209
uses: nick-fields/retry@v3
157210
with:
158211
timeout_minutes: 5
@@ -163,7 +216,7 @@ jobs:
163216
rm -rf ./tmp && mkdir -p ./tmp
164217
165218
- name: Test Electron Windows/MacOS
166-
if: "${{ !contains(matrix.os, 'ubuntu') && !matrix.dockerfile }}"
219+
if: "${{ !contains(matrix.os, 'ubuntu') && matrix.native }}"
167220
uses: nick-fields/retry@v3
168221
with:
169222
timeout_minutes: 5
@@ -173,7 +226,7 @@ jobs:
173226
continue-on-error: true
174227

175228
- name: Test Electron Linux
176-
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.dockerfile }}"
229+
if: "${{ contains(matrix.os, 'ubuntu') && matrix.native }}"
177230
uses: nick-fields/retry@v3
178231
with:
179232
timeout_minutes: 5

docker/alpine.dockerfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
FROM node:18-alpine
1+
FROM node:18-alpine AS builder
22

33
WORKDIR /app
44
COPY ./ ./
55
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
6-
RUN apk add --no-cache \
6+
RUN \
7+
# system dependencies
8+
apk add --no-cache \
79
bash \
810
build-base \
911
curl \
@@ -23,6 +25,16 @@ RUN apk add --no-cache \
2325
autoconf \
2426
libtool && \
2527
cp /usr/lib/ninja-build/bin/ninja /usr/bin/ninja && \
28+
# build
2629
npm i -g pnpm && \
2730
pnpm install && \
2831
pnpm run build
32+
33+
FROM node:18-alpine
34+
WORKDIR /app
35+
36+
COPY ./ ./
37+
COPY --from=builder /app/build ./build
38+
COPY --from=builder /app/node_modules ./node_modules
39+
40+

docker/debian.dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM node:18 AS builder
2+
3+
WORKDIR /app
4+
COPY ./ ./
5+
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
6+
RUN \
7+
# system dependencies
8+
apt-get update -y && \
9+
apt-get install --no-install-recommends -y \
10+
bash \
11+
build-essential \
12+
curl \
13+
git \
14+
g++ \
15+
make \
16+
ninja-build \
17+
pkg-config \
18+
unzip \
19+
zip \
20+
python3 \
21+
tar \
22+
cmake \
23+
ninja-build \
24+
automake \
25+
autoconf \
26+
libtool && \
27+
# build
28+
npm i -g pnpm && \
29+
pnpm install && \
30+
pnpm run build
31+
32+
FROM node:18
33+
WORKDIR /app
34+
35+
COPY ./ ./
36+
COPY --from=builder /app/build ./build
37+
COPY --from=builder /app/node_modules ./node_modules

script/install-deps.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/sh
2+
3+
set -x
4+
5+
# Ubuntu/Debian
6+
apt=$(command -v apt-get || true)
7+
if [ -n "$apt" ]; then
8+
apt-get update -q -y
9+
apt-get install --no-install-recommends -y \
10+
bash \
11+
build-essential \
12+
curl \
13+
git \
14+
g++ \
15+
make \
16+
ninja-build \
17+
pkg-config \
18+
unzip \
19+
zip \
20+
python3 \
21+
tar \
22+
cmake \
23+
ninja-build \
24+
automake \
25+
autoconf \
26+
libtool \
27+
nodejs \
28+
npm
29+
fi
30+
31+
# Alpine Linux
32+
apk=$(command -v apk || true)
33+
if [ -n "$apk" ]; then
34+
apk update
35+
apk add --no-cache bash build-base curl git g++ make ninja-build pkgconfig unzip zip python3 tar cmake musl-dev automake autoconf libtool nodejs npm
36+
cp /usr/lib/ninja-build/bin/ninja /usr/bin/ninja
37+
fi
38+
39+
# Fedora/RHEL
40+
dnf=$(command -v dnf || true)
41+
if [ -n "$dnf" ]; then
42+
dnf update -q -y
43+
dnf install -y \
44+
bash \
45+
build-essential \
46+
curl \
47+
git \
48+
g++ \
49+
make \
50+
ninja-build \
51+
pkg-config \
52+
unzip \
53+
zip \
54+
python3 \
55+
tar \
56+
cmake \
57+
ninja-build \
58+
automake \
59+
autoconf \
60+
libtool \
61+
nodejs
62+
fi
63+
64+
# pnpm
65+
npm i -g pnpm
66+
67+
export VCPKG_FORCE_SYSTEM_BINARIES=1
68+
69+
# vcpkg
70+
git clone https://github.com/microsoft/vcpkg.git ~/vcpkg
71+
cd ~/vcpkg || exit 1
72+
git checkout "ee2d2a100103e0f3613c60655dcf15be7d5157b8"
73+
~/vcpkg/bootstrap-vcpkg.sh
74+
cd - || exit 1
75+
76+
# zeromq
77+
cd ~/vcpkg || exit 1
78+
~/vcpkg/vcpkg install 'zeromq[draft,curve,sodium]' || (cd - || exit 1)
79+
cd - || exit 1

0 commit comments

Comments
 (0)