🔧 Fix: Build Static MUSL Binaries for Universal Linux Support #6
Workflow file for this run
This file contains hidden or 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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # Step 1: Run tests before building | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "test" | |
| cache-on-failure: true | |
| - name: Run clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Run tests | |
| run: cargo test --all-features | |
| # Step 2: Build release binaries (parallel) | |
| build: | |
| name: Build ${{ matrix.name }} | |
| needs: test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux x86_64 (Static MUSL - works on all Linux distros) | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-latest | |
| name: rust-strom-linux-x86_64 | |
| cross: false | |
| # Linux ARM64 (Static MUSL - works on all Linux distros) | |
| - target: aarch64-unknown-linux-musl | |
| os: ubuntu-latest | |
| name: rust-strom-linux-aarch64 | |
| cross: true | |
| # macOS Intel | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| name: rust-strom-macos-x86_64 | |
| cross: false | |
| # macOS Apple Silicon | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| name: rust-strom-macos-aarch64 | |
| cross: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install MUSL tools | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools | |
| - name: Install cross-compilation tools (ARM64 MUSL) | |
| if: matrix.cross && matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| rustup target add aarch64-unknown-linux-musl | |
| - name: Configure cross-compilation (ARM64 MUSL) | |
| if: matrix.cross && matrix.os == 'ubuntu-latest' | |
| run: | | |
| mkdir -p .cargo | |
| cat >> .cargo/config.toml <<EOF | |
| [target.aarch64-unknown-linux-musl] | |
| linker = "aarch64-linux-gnu-gcc" | |
| EOF | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| shared-key: "release" | |
| cache-on-failure: true | |
| - name: Build release binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Strip binary (Linux) | |
| if: matrix.os == 'ubuntu-latest' && !matrix.cross | |
| run: strip target/${{ matrix.target }}/release/rust-strom | |
| - name: Strip binary (Linux ARM64 cross-compile) | |
| if: matrix.cross && matrix.os == 'ubuntu-latest' | |
| run: aarch64-linux-gnu-strip target/${{ matrix.target }}/release/rust-strom | |
| - name: Strip binary (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: strip target/${{ matrix.target }}/release/rust-strom | |
| - name: Verify binary | |
| if: ${{ !matrix.cross }} | |
| run: | | |
| ls -lh target/${{ matrix.target }}/release/rust-strom | |
| file target/${{ matrix.target }}/release/rust-strom | |
| target/${{ matrix.target }}/release/rust-strom --version || echo "Version check skipped" | |
| - name: Prepare binary for upload | |
| run: | | |
| mkdir -p artifacts | |
| cp target/${{ matrix.target }}/release/rust-strom artifacts/${{ matrix.name }} | |
| chmod +x artifacts/${{ matrix.name }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.name }} | |
| path: artifacts/${{ matrix.name }} | |
| if-no-files-found: error | |
| # Step 3: Create GitHub Release and upload all binaries | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -R artifacts/ | |
| - name: Create Release with all binaries | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: RustStrom ${{ github.ref_name }} | |
| body: | | |
| ## RustStrom ${{ github.ref_name }} | |
| High-Performance Load Balancer built with Rust | |
| ### Installation | |
| **Linux & macOS:** | |
| ```bash | |
| curl -sSL https://raw.githubusercontent.com/ismoilovdevml/RustStrom/main/install.sh | bash | |
| ``` | |
| **Or download binary directly:** | |
| - Linux x86_64: `rust-strom-linux-x86_64` | |
| - Linux ARM64: `rust-strom-linux-aarch64` | |
| - macOS Intel: `rust-strom-macos-x86_64` | |
| - macOS Apple Silicon: `rust-strom-macos-aarch64` | |
| ### What's New | |
| - 🚀 Pre-built binaries for all platforms | |
| - ⚡ Fast installation (seconds instead of minutes) | |
| - 🔧 Automatic systemd service setup | |
| - 📊 Dashboard support | |
| See [README](https://github.com/ismoilovdevml/RustStrom#readme) for full documentation. | |
| files: | | |
| artifacts/rust-strom-linux-x86_64/rust-strom-linux-x86_64 | |
| artifacts/rust-strom-linux-aarch64/rust-strom-linux-aarch64 | |
| artifacts/rust-strom-macos-x86_64/rust-strom-macos-x86_64 | |
| artifacts/rust-strom-macos-aarch64/rust-strom-macos-aarch64 | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Step 4: Publish to crates.io (optional, only if CARGO_TOKEN exists) | |
| publish: | |
| name: Publish to crates.io | |
| needs: release | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Publish to crates.io | |
| run: cargo publish --token ${{ secrets.CARGO_TOKEN }} | |
| continue-on-error: true |