mirror of
https://github.com/domcyrus/rustnet.git
synced 2026-01-05 21:40:01 -06:00
Use FreeBSD VM for native builds instead of cross-compilation
- Removed freebsd-x64 from cross-compilation matrix - Added dedicated build-freebsd job using vmactions/freebsd-vm - Builds natively on actual FreeBSD using pkg and native toolchain - Updated test-freebsd workflow to use VM as well - Avoids all cross-compilation sysroot/libpcap issues
This commit is contained in:
47
.github/workflows/release.yml
vendored
47
.github/workflows/release.yml
vendored
@@ -39,7 +39,6 @@ jobs:
|
||||
- linux-aarch64-gnu
|
||||
- linux-armv7-gnueabihf
|
||||
- linux-x64-gnu
|
||||
- freebsd-x64
|
||||
- macos-aarch64
|
||||
- macos-x64
|
||||
- windows-x64-msvc
|
||||
@@ -55,9 +54,6 @@ jobs:
|
||||
cargo: cross
|
||||
- build: linux-x64-gnu
|
||||
target: x86_64-unknown-linux-gnu
|
||||
- build: freebsd-x64
|
||||
target: x86_64-unknown-freebsd
|
||||
cargo: cross
|
||||
- build: macos-aarch64
|
||||
os: macos-14
|
||||
target: aarch64-apple-darwin
|
||||
@@ -145,10 +141,51 @@ jobs:
|
||||
path: ${{ env.ASSET }}
|
||||
if-no-files-found: error
|
||||
|
||||
build-freebsd:
|
||||
name: build-freebsd
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Build on FreeBSD
|
||||
uses: vmactions/freebsd-vm@v1
|
||||
with:
|
||||
usesh: true
|
||||
prepare: |
|
||||
pkg install -y curl libpcap rust
|
||||
run: |
|
||||
# Build release binary (without eBPF - not available on FreeBSD)
|
||||
cargo build --verbose --release --no-default-features
|
||||
|
||||
# Create release archive
|
||||
mkdir -p "rustnet-${{ github.ref_name }}-x86_64-unknown-freebsd"
|
||||
cp target/release/rustnet "rustnet-${{ github.ref_name }}-x86_64-unknown-freebsd/"
|
||||
|
||||
# Copy assets if available
|
||||
if [ -d "assets" ]; then
|
||||
mkdir -p "rustnet-${{ github.ref_name }}-x86_64-unknown-freebsd/assets"
|
||||
cp -r assets/* "rustnet-${{ github.ref_name }}-x86_64-unknown-freebsd/assets/" || true
|
||||
fi
|
||||
|
||||
# Copy documentation
|
||||
cp README.md "rustnet-${{ github.ref_name }}-x86_64-unknown-freebsd/" || true
|
||||
cp LICENSE "rustnet-${{ github.ref_name }}-x86_64-unknown-freebsd/" || true
|
||||
|
||||
# Create tarball
|
||||
tar czf "rustnet-${{ github.ref_name }}-x86_64-unknown-freebsd.tar.gz" "rustnet-${{ github.ref_name }}-x86_64-unknown-freebsd"
|
||||
|
||||
- name: Upload FreeBSD artifact
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: build-x86_64-unknown-freebsd
|
||||
path: rustnet-${{ github.ref_name }}-x86_64-unknown-freebsd.tar.gz
|
||||
if-no-files-found: error
|
||||
|
||||
create-release:
|
||||
name: create-release
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-release
|
||||
needs: [build-release, build-freebsd]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
48
.github/workflows/test-freebsd.yml
vendored
48
.github/workflows/test-freebsd.yml
vendored
@@ -15,46 +15,34 @@ env:
|
||||
jobs:
|
||||
test-freebsd-build:
|
||||
name: Test FreeBSD x64 Build
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y libpcap-dev pkg-config
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Build and test on FreeBSD
|
||||
uses: vmactions/freebsd-vm@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: x86_64-unknown-freebsd
|
||||
usesh: true
|
||||
prepare: |
|
||||
pkg install -y curl libpcap rust
|
||||
run: |
|
||||
echo "Building for FreeBSD without default features (no eBPF)"
|
||||
cargo build --verbose --release --no-default-features
|
||||
|
||||
- name: Install cross
|
||||
run: cargo install cross@0.2.5
|
||||
|
||||
- name: Build for FreeBSD (without eBPF)
|
||||
env:
|
||||
RUSTFLAGS: "-C strip=symbols"
|
||||
run: |
|
||||
echo "Building for FreeBSD target without default features (no eBPF)"
|
||||
cross build --verbose --release --target x86_64-unknown-freebsd --no-default-features
|
||||
|
||||
- name: Verify binary was created
|
||||
run: |
|
||||
if [ -f "target/x86_64-unknown-freebsd/release/rustnet" ]; then
|
||||
echo "✅ FreeBSD binary successfully built"
|
||||
ls -lh target/x86_64-unknown-freebsd/release/rustnet
|
||||
else
|
||||
echo "❌ FreeBSD binary not found"
|
||||
exit 1
|
||||
fi
|
||||
echo "Verifying binary was created"
|
||||
if [ -f "target/release/rustnet" ]; then
|
||||
echo "✅ FreeBSD binary successfully built"
|
||||
ls -lh target/release/rustnet
|
||||
else
|
||||
echo "❌ FreeBSD binary not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Upload binary as artifact
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: rustnet-freebsd-x64
|
||||
path: target/x86_64-unknown-freebsd/release/rustnet
|
||||
path: target/release/rustnet
|
||||
if-no-files-found: error
|
||||
|
||||
Reference in New Issue
Block a user