Skip to content

Commit

Permalink
Build static
Browse files Browse the repository at this point in the history
  • Loading branch information
the2pizza committed Jan 16, 2025
1 parent 0626368 commit 57f45d8
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,29 @@ jobs:
default: true
override: true

- name: Install protobuf-compiler
run: sudo apt-get install -y protobuf-compiler
- name: Install protobuf-compiler
run: sudo apt-get install -y protobuf-compiler

- name: Install musl-tools
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Install musl-tools
run: sudo apt-get update && sudo apt-get install -y musl-tools

- name: Link musl-g++
run: sudo ln -sf "/usr/bin/musl-gcc" "/usr/bin/musl-g++"

- name: Add musl target
run: rustup target add x86_64-unknown-linux-musl

- name: Set environment variables for musl
run: |
echo "export CC=musl-gcc" >> $GITHUB_ENV
echo "export CXX=musl-g++" >> $GITHUB_ENV
- name: Build statically linked binary
env:
CC: musl-gcc
CXX: musl-g++
run: cargo build --release --no-default-features --features agent --target x86_64-unknown-linux-musl

- name: Link g++ musl
run: sudo ln -s "/usr/bin/g++" "/usr/bin/musl-g++"

- name: Add musl target
run: rustup target add x86_64-unknown-linux-musl

- name: Build statically linked binary
run: cargo build --release --target x86_64-unknown-linux-musl

build-api:
runs-on: ubuntu-latest
Expand All @@ -54,5 +63,5 @@ jobs:
override: true

- name: Build
run: cargo build --bin api --no-default-features --features api
run: cargo build --release --bin api --no-default-features --features api

0 comments on commit 57f45d8

Please sign in to comment.