-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add a github workflow to build for musl
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Build MUSL Binary | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build MUSL Binary | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Rust toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: x86_64-unknown-linux-musl | ||
|
||
- name: Install musl tools | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y musl-tools musl-dev | ||
- name: Install OpenSSL | ||
run: | | ||
wget https://www.openssl.org/source/openssl-3.0.8.tar.gz | ||
tar xf openssl-3.0.8.tar.gz | ||
cd openssl-3.0.8 | ||
CC="musl-gcc -fPIC" ./Configure no-shared no-async linux-x86_64 | ||
make -j$(nproc) | ||
sudo make install | ||
- name: Rust Cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Build binary | ||
env: | ||
OPENSSL_DIR: /usr/local | ||
OPENSSL_STATIC: true | ||
PKG_CONFIG_ALLOW_CROSS: true | ||
run: cargo build --release --target x86_64-unknown-linux-musl | ||
|
||
- name: Upload binary | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: binary-musl | ||
path: target/x86_64-unknown-linux-musl/release/* | ||
if-no-files-found: error |