Skip to content

Commit 849ae63

Browse files
committed
chore: update release workflow to support ARM64 builds on Ubuntu
1 parent c973571 commit 849ae63

File tree

3 files changed

+132
-15
lines changed

3 files changed

+132
-15
lines changed

.github/workflows/release.yml

Lines changed: 68 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@ jobs:
1212
strategy:
1313
matrix:
1414
include:
15-
# - os: ubuntu-latest
16-
# target: x86_64-unknown-linux-gnu
17-
# asset_name: linux-amd64
18-
- os: windows-latest
19-
target: x86_64-pc-windows-msvc
20-
asset_name: windows-amd64
21-
# - os: macos-latest
22-
# target: aarch64-apple-darwin
23-
# asset_name: darwin-arm64
24-
# - os: macos-latest
25-
# target: x86_64-apple-darwin
26-
# asset_name: darwin-amd64
15+
- os: ubuntu-latest
16+
target: aarch64-unknown-linux-gnu
17+
asset_name: linux-arm64
18+
# - os: windows-latest
19+
# target: x86_64-pc-windows-msvc
20+
# asset_name: windows-amd64
21+
# - os: ubuntu-latest
22+
# target: x86_64-unknown-linux-gnu
23+
# asset_name: linux-amd64
24+
# - os: macos-latest
25+
# target: aarch64-apple-darwin
26+
# asset_name: darwin-arm64
27+
# - os: macos-latest
28+
# target: x86_64-apple-darwin
29+
# asset_name: darwin-amd64
2730
fail-fast: false
2831

2932
runs-on: ${{ matrix.os }}
@@ -44,12 +47,24 @@ jobs:
4447
submodules: recursive
4548
path: slipstream-rust
4649

50+
- name: Set up QEMU
51+
if: runner.os == 'Linux' && matrix.target == 'aarch64-unknown-linux-gnu'
52+
uses: docker/setup-qemu-action@v3
53+
54+
- name: Set up Docker Buildx
55+
if: runner.os == 'Linux' && matrix.target == 'aarch64-unknown-linux-gnu'
56+
uses: docker/setup-buildx-action@v3
57+
with:
58+
platforms: linux/arm64,linux/amd64
59+
4760
- name: Install Rust
61+
if: runner.os != 'Linux' || matrix.target != 'aarch64-unknown-linux-gnu'
4862
uses: dtolnay/rust-toolchain@stable
4963
with:
5064
targets: ${{ matrix.target }}
5165

5266
- name: Install cross toolchain
67+
if: runner.os != 'Linux' || matrix.target != 'aarch64-unknown-linux-gnu'
5368
uses: taiki-e/setup-cross-toolchain-action@v1
5469
with:
5570
target: ${{ env.TARGET }}
@@ -63,6 +78,7 @@ jobs:
6378
echo "short_commit=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT
6479
6580
- name: Cache Rust dependencies
81+
if: runner.os != 'Linux' || matrix.target != 'aarch64-unknown-linux-gnu'
6682
uses: actions/cache@v4
6783
with:
6884
path: |
@@ -77,10 +93,13 @@ jobs:
7793
${{ runner.os }}-rust-
7894
7995
- name: Install build dependencies (Linux)
80-
if: runner.os == 'Linux'
96+
if: runner.os == 'Linux' && matrix.target != 'aarch64-unknown-linux-gnu'
8197
run: |
8298
sudo apt-get update
83-
sudo apt-get install -y cmake pkg-config libssl-dev gcc g++ perl
99+
sudo apt-get install -y cmake pkg-config gcc g++ perl
100+
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" ]]; then
101+
sudo apt-get install -y libssl-dev
102+
fi
84103
85104
- name: Install build dependencies (macOS)
86105
if: runner.os == 'macOS'
@@ -167,8 +186,41 @@ jobs:
167186
echo "OPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl@3" >> $GITHUB_ENV
168187
fi
169188
189+
- name: Build with Docker buildx (Linux ARM64)
190+
if: runner.os == 'Linux' && matrix.target == 'aarch64-unknown-linux-gnu'
191+
run: |
192+
# Create a temporary directory for the build output
193+
mkdir -p docker-build-output
194+
195+
mkdir -p slipstream-rust/target/aarch64-unknown-linux-gnu/release
196+
197+
# Build the image for linux/arm64 and load it using a pipe
198+
# This works around the --load limitation with cross-platform builds
199+
docker buildx build \
200+
--platform linux/arm64 \
201+
--file Dockerfile.arm64 \
202+
--tag slipstream-build:arm64 \
203+
--output type=docker,dest=- \
204+
. | docker load
205+
206+
# Run the container with --platform flag to use QEMU emulation
207+
# Mount slipstream-rust as read-write so build artifacts can be written
208+
docker run --rm \
209+
--platform linux/arm64 \
210+
-v "${{ github.workspace }}/slipstream-rust:/workspace/slipstream-rust" \
211+
-v "${{ github.workspace }}/docker-build-output:/workspace/output" \
212+
slipstream-build:arm64
213+
214+
sudo chown -R $(id -u):$(id -g) slipstream-rust/target/ 2>/dev/null || true
215+
216+
cp docker-build-output/slipstream-client slipstream-rust/target/aarch64-unknown-linux-gnu/release/
217+
cp docker-build-output/slipstream-server slipstream-rust/target/aarch64-unknown-linux-gnu/release/
218+
219+
# Verify binaries exist
220+
ls -lh slipstream-rust/target/aarch64-unknown-linux-gnu/release/
221+
170222
- name: Build picoquic (Linux)
171-
if: runner.os == 'Linux'
223+
if: runner.os == 'Linux' && matrix.target != 'aarch64-unknown-linux-gnu'
172224
working-directory: slipstream-rust
173225
run: |
174226
bash scripts/build_picoquic.sh
@@ -418,6 +470,7 @@ jobs:
418470
fi
419471
420472
- name: Build slipstream binaries
473+
if: runner.os != 'Linux' || matrix.target != 'aarch64-unknown-linux-gnu'
421474
working-directory: slipstream-rust
422475
shell: bash
423476
env:

Dockerfile.arm64

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Dockerfile for building slipstream-rust for linux/arm64
2+
FROM ubuntu:24.04
3+
4+
# Install build dependencies
5+
RUN apt-get update && apt-get install -y \
6+
curl \
7+
cmake \
8+
pkg-config \
9+
gcc \
10+
g++ \
11+
perl \
12+
libssl-dev \
13+
git \
14+
ca-certificates \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
# Install Rust
18+
ENV RUSTUP_HOME=/usr/local/rustup \
19+
CARGO_HOME=/usr/local/cargo \
20+
PATH=/usr/local/cargo/bin:$PATH
21+
22+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
23+
&& rustup target add aarch64-unknown-linux-gnu
24+
25+
WORKDIR /workspace
26+
27+
# Copy the build script
28+
COPY build-docker.sh /workspace/build-docker.sh
29+
RUN chmod +x /workspace/build-docker.sh
30+
31+
CMD ["/workspace/build-docker.sh"]

build-docker.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# This script runs inside the Docker container to build the project
5+
cd /workspace
6+
7+
# slipstream-rust should be mounted as a volume
8+
if [ ! -d "slipstream-rust" ]; then
9+
echo "ERROR: slipstream-rust directory not found. It should be mounted as a volume."
10+
exit 1
11+
fi
12+
13+
cd slipstream-rust
14+
15+
# Build picoquic
16+
echo "Building picoquic..."
17+
bash scripts/build_picoquic.sh
18+
19+
export PICOQUIC_DIR=/workspace/slipstream-rust/vendor/picoquic
20+
export PICOQUIC_BUILD_DIR=/workspace/slipstream-rust/.picoquic-build
21+
export PICOQUIC_FETCH_PTLS=ON
22+
export PICOQUIC_AUTO_BUILD=1
23+
24+
# Build the Rust binaries
25+
echo "Building slipstream binaries..."
26+
cargo build --release --target aarch64-unknown-linux-gnu -p slipstream-client -p slipstream-server
27+
28+
# Copy binaries to output directory
29+
mkdir -p /workspace/output
30+
cp target/aarch64-unknown-linux-gnu/release/slipstream-client /workspace/output/
31+
cp target/aarch64-unknown-linux-gnu/release/slipstream-server /workspace/output/
32+
33+
echo "Build complete! Binaries are in /workspace/output/"

0 commit comments

Comments
 (0)