Skip to content

Commit 80aaea7

Browse files
committed
ci: use musl for Linux binaries
Static linking with musl improves portability - binaries work on any Linux distro regardless of glibc version (Alpine, older systems, etc).
1 parent 263977b commit 80aaea7

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

.github/workflows/release-binaries.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ name: Release Binaries
33
on:
44
push:
55
tags:
6-
- 'elizacp-v*'
7-
- 'yopo-v*'
8-
- 'sacp-conductor-v*'
9-
- 'sacp-tee-v*'
10-
- 'sacp-trace-viewer-v*'
6+
- "elizacp-v*"
7+
- "yopo-v*"
8+
- "sacp-conductor-v*"
9+
- "sacp-tee-v*"
10+
- "sacp-trace-viewer-v*"
1111

1212
env:
1313
CARGO_TERM_COLOR: always
@@ -21,19 +21,21 @@ jobs:
2121
matrix:
2222
include:
2323
# x86_64
24-
- target: x86_64-unknown-linux-gnu
24+
- target: x86_64-unknown-linux-musl
2525
os: ubuntu-latest
2626
archive: tar.gz
27+
musl: true
2728
- target: x86_64-apple-darwin
2829
os: macos-latest
2930
archive: tar.gz
3031
- target: x86_64-pc-windows-msvc
3132
os: windows-latest
3233
archive: zip
3334
# aarch64
34-
- target: aarch64-unknown-linux-gnu
35+
- target: aarch64-unknown-linux-musl
3536
os: ubuntu-latest
3637
archive: tar.gz
38+
musl: true
3739
cross: true
3840
- target: aarch64-apple-darwin
3941
os: macos-latest
@@ -64,12 +66,19 @@ jobs:
6466
with:
6567
targets: ${{ matrix.target }}
6668

67-
- name: Install cross-compilation tools (Linux aarch64)
68-
if: matrix.cross
69+
- name: Install musl tools
70+
if: matrix.musl
6971
run: |
7072
sudo apt-get update
71-
sudo apt-get install -y gcc-aarch64-linux-gnu
72-
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
73+
sudo apt-get install -y musl-tools
74+
75+
- name: Install cross-compilation tools (Linux aarch64 musl)
76+
if: matrix.cross
77+
run: |
78+
# Install aarch64-linux-musl cross compiler
79+
curl -fsSL https://musl.cc/aarch64-linux-musl-cross.tgz | sudo tar -xzC /opt
80+
echo "/opt/aarch64-linux-musl-cross/bin" >> $GITHUB_PATH
81+
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-musl-gcc" >> $GITHUB_ENV
7382
7483
- name: Build binary
7584
run: cargo build --release --package ${{ steps.extract.outputs.binary }} --target ${{ matrix.target }}

0 commit comments

Comments
 (0)