chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
name: 'Build RustNet'
|
||||
description: 'Build RustNet binary for a specific target'
|
||||
|
||||
inputs:
|
||||
target:
|
||||
description: 'Rust target triple (e.g., x86_64-unknown-linux-gnu)'
|
||||
required: true
|
||||
cargo-command:
|
||||
description: 'Cargo command to use (cargo or cross)'
|
||||
required: false
|
||||
default: 'cargo'
|
||||
default-features:
|
||||
description: 'Enable default features including eBPF (true/false)'
|
||||
required: false
|
||||
default: 'true'
|
||||
strip-symbols:
|
||||
description: 'Strip debug symbols from binary (true/false)'
|
||||
required: false
|
||||
default: 'true'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Build binary
|
||||
shell: bash
|
||||
env:
|
||||
RUSTFLAGS: ${{ inputs.strip-symbols == 'true' && '-C strip=symbols' || '' }}
|
||||
run: |
|
||||
mkdir -p assets # Ensure asset dir exists for build.rs
|
||||
|
||||
BUILD_CMD="${{ inputs.cargo-command }} build --verbose --release --target ${{ inputs.target }}"
|
||||
|
||||
if [[ "${{ inputs.default-features }}" != "true" ]]; then
|
||||
BUILD_CMD="$BUILD_CMD --no-default-features"
|
||||
fi
|
||||
|
||||
echo "Running: $BUILD_CMD"
|
||||
$BUILD_CMD
|
||||
@@ -0,0 +1,30 @@
|
||||
name: 'Build Static Binary'
|
||||
description: 'Build a statically-linked Linux binary using musl'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
shell: sh
|
||||
run: |
|
||||
apk add --no-cache \
|
||||
musl-dev libpcap-dev pkgconfig build-base perl \
|
||||
elfutils-dev zlib-dev zlib-static zstd-dev zstd-static \
|
||||
clang llvm linux-headers git
|
||||
rustup component add rustfmt
|
||||
|
||||
- name: Build static binary
|
||||
shell: sh
|
||||
env:
|
||||
# -C strip=symbols: Strip debug symbols for smaller binary
|
||||
# -C link-arg=-l:libzstd.a: Fix elfutils 0.189+ zstd dependency (libbpf/bpftool#152)
|
||||
RUSTFLAGS: "-C strip=symbols -C link-arg=-l:libzstd.a"
|
||||
run: cargo build --release
|
||||
|
||||
- name: Verify static linking
|
||||
shell: sh
|
||||
run: |
|
||||
file target/release/rustnet
|
||||
# Use file command to verify (ldd behaves differently inside Alpine)
|
||||
file target/release/rustnet | grep -q "static.* linked" || \
|
||||
(echo "ERROR: Binary is not statically linked" && exit 1)
|
||||
@@ -0,0 +1,11 @@
|
||||
name: 'Setup Linux Build Dependencies'
|
||||
description: 'Install dependencies required for building RustNet on Linux'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y libpcap-dev libelf-dev zlib1g-dev clang llvm pkg-config
|
||||
Reference in New Issue
Block a user