v2.5.0 CLI Build #18
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: Build CLI Binaries | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (e.g., v1.0.0)' | |
| required: true | |
| type: string | |
| create_release: | |
| description: 'Create a GitHub release' | |
| required: false | |
| type: boolean | |
| default: true | |
| jobs: | |
| # Build slipstream-client for each platform first | |
| build-slipstream: | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| suffix: linux-amd64 | |
| os: ubuntu-latest | |
| - target: aarch64-unknown-linux-gnu | |
| suffix: linux-arm64 | |
| os: ubuntu-latest | |
| cross: true | |
| - target: x86_64-apple-darwin | |
| suffix: darwin-amd64 | |
| os: macos-13 | |
| - target: aarch64-apple-darwin | |
| suffix: darwin-arm64 | |
| os: macos-14 | |
| - target: x86_64-pc-windows-msvc | |
| suffix: windows-amd64 | |
| ext: .exe | |
| os: windows-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.SUBMODULE_TOKEN }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross-compilation tools (Linux ARM64) | |
| if: matrix.cross | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Build slipstream-client | |
| working-directory: app/src/main/rust/slipstream-rust | |
| shell: bash | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
| CONFIG_ENCRYPTION_KEY: ${{ secrets.CONFIG_ENCRYPTION_KEY }} | |
| run: | | |
| cargo build --release --bin slipstream-client \ | |
| --target ${{ matrix.target }} \ | |
| --features openssl-vendored,picoquic-minimal-build | |
| - name: Upload slipstream binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: slipstream-${{ matrix.suffix }} | |
| path: app/src/main/rust/slipstream-rust/target/${{ matrix.target }}/release/slipstream-client${{ matrix.ext }} | |
| # Build Go CLI with embedded slipstream binary | |
| build-cli: | |
| needs: build-slipstream | |
| strategy: | |
| matrix: | |
| include: | |
| - goos: darwin | |
| goarch: amd64 | |
| suffix: darwin-amd64 | |
| slipstream_suffix: darwin-amd64 | |
| - goos: darwin | |
| goarch: arm64 | |
| suffix: darwin-arm64 | |
| slipstream_suffix: darwin-arm64 | |
| - goos: linux | |
| goarch: amd64 | |
| suffix: linux-amd64 | |
| slipstream_suffix: linux-amd64 | |
| - goos: linux | |
| goarch: arm64 | |
| suffix: linux-arm64 | |
| slipstream_suffix: linux-arm64 | |
| - goos: windows | |
| goarch: amd64 | |
| suffix: windows-amd64 | |
| slipstream_suffix: windows-amd64 | |
| ext: .exe | |
| slipstream_ext: .exe | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.SUBMODULE_TOKEN }} | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: cli/go.mod | |
| - name: Download slipstream binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: slipstream-${{ matrix.slipstream_suffix }} | |
| path: ./slipstream-download | |
| - name: Embed slipstream binary | |
| run: | | |
| cp ./slipstream-download/slipstream-client${{ matrix.slipstream_ext }} cli/embedded/slipstream-client | |
| - name: Build | |
| working-directory: cli | |
| env: | |
| CGO_ENABLED: '0' | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| VERSION="${{ github.event.inputs.version || github.ref_name }}" | |
| LDFLAGS="-s -w -X main.version=${VERSION}" | |
| if [ -n "${{ secrets.CONFIG_ENCRYPTION_KEY }}" ]; then | |
| LDFLAGS="${LDFLAGS} -X main.configKey=${{ secrets.CONFIG_ENCRYPTION_KEY }}" | |
| fi | |
| go build -tags embed_slipstream -trimpath -ldflags="${LDFLAGS}" -o ../slipnet-${{ matrix.suffix }}${{ matrix.ext }} . | |
| - name: Compress with UPX (Linux/macOS only) | |
| if: matrix.goos != 'windows' | |
| run: | | |
| sudo apt-get install -y upx-ucl > /dev/null 2>&1 | |
| upx --best --lzma slipnet-${{ matrix.suffix }} || true | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: slipnet-${{ matrix.suffix }} | |
| path: slipnet-${{ matrix.suffix }}${{ matrix.ext }} | |
| release-cli: | |
| needs: build-cli | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: slipnet-* | |
| path: ./artifacts | |
| merge-multiple: true | |
| - name: Create/Update Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.version || github.ref_name }} | |
| name: ${{ github.event.inputs.version || github.ref_name }} | |
| files: ./artifacts/slipnet-* | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |