diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6262170..a90324b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/test-freebsd.yml b/.github/workflows/test-freebsd.yml index 22b656f..9b186b9 100644 --- a/.github/workflows/test-freebsd.yml +++ b/.github/workflows/test-freebsd.yml @@ -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 diff --git a/Cross.toml b/Cross.toml index 9c92ddc..74cca66 100644 --- a/Cross.toml +++ b/Cross.toml @@ -15,8 +15,7 @@ pre-build = [ ] [target.x86_64-unknown-freebsd] -pre-build = [ - # FreeBSD uses pkg as package manager - "pkg install -y libpcap", -] +# FreeBSD cross-compilation uses a Linux container with FreeBSD sysroot +# The sysroot should already contain libpcap +# No pre-build steps needed as we can't run FreeBSD package manager in Linux container