From 386e4dd17ebc13d5f7bde37b8bb1260fbf6e53ec Mon Sep 17 00:00:00 2001 From: Arne Beer Date: Wed, 5 Jun 2024 00:19:57 +0200 Subject: [PATCH] fix: Releases pipeline --- .github/workflows/package-binary.yml | 94 +++++++++------------------- Cargo.toml | 2 + 2 files changed, 31 insertions(+), 65 deletions(-) diff --git a/.github/workflows/package-binary.yml b/.github/workflows/package-binary.yml index d75373b..26147ba 100644 --- a/.github/workflows/package-binary.yml +++ b/.github/workflows/package-binary.yml @@ -12,71 +12,31 @@ jobs: strategy: fail-fast: false matrix: - target: - - x86_64-unknown-linux-musl - - aarch64-unknown-linux-musl - - armv7-unknown-linux-musleabihf - - arm-unknown-linux-musleabihf - - x86_64-pc-windows-msvc - - x86_64-apple-darwin - - aarch64-apple-darwin include: - os: ubuntu-latest target: x86_64-unknown-linux-musl - client_artifact_name: target/x86_64-unknown-linux-musl/release/pueue - daemon_artifact_name: target/x86_64-unknown-linux-musl/release/pueued - client_release_name: pueue-linux-x86_64 - daemon_release_name: pueued-linux-x86_64 - cross: true - strip: true + compress: true - os: ubuntu-latest target: aarch64-unknown-linux-musl - client_artifact_name: target/aarch64-unknown-linux-musl/release/pueue - daemon_artifact_name: target/aarch64-unknown-linux-musl/release/pueued - client_release_name: pueue-linux-aarch64 - daemon_release_name: pueued-linux-aarch64 - cross: true - strip: false + compress: true - os: ubuntu-latest target: armv7-unknown-linux-musleabihf - client_artifact_name: target/armv7-unknown-linux-musleabihf/release/pueue - daemon_artifact_name: target/armv7-unknown-linux-musleabihf/release/pueued - client_release_name: pueue-linux-armv7 - daemon_release_name: pueued-linux-armv7 - cross: true - strip: false + compress: true - os: ubuntu-latest target: arm-unknown-linux-musleabihf - client_artifact_name: target/arm-unknown-linux-musleabihf/release/pueue - daemon_artifact_name: target/arm-unknown-linux-musleabihf/release/pueued - client_release_name: pueue-linux-arm - daemon_release_name: pueued-linux-arm - cross: true - strip: false + compress: true + - os: ubuntu-latest + target: x86_64-unknown-freebsd + compress: false - os: windows-latest target: x86_64-pc-windows-msvc - client_artifact_name: target/x86_64-pc-windows-msvc/release/pueue.exe - daemon_artifact_name: target/x86_64-pc-windows-msvc/release/pueued.exe - client_release_name: pueue-windows-x86_64.exe - daemon_release_name: pueued-windows-x86_64.exe - cross: false - strip: true + compress: false - os: macos-latest target: x86_64-apple-darwin - client_artifact_name: target/x86_64-apple-darwin/release/pueue - daemon_artifact_name: target/x86_64-apple-darwin/release/pueued - client_release_name: pueue-macos-x86_64 - daemon_release_name: pueued-macos-x86_64 - cross: false - strip: true + compress: false - os: macos-latest target: aarch64-apple-darwin - client_artifact_name: target/aarch64-apple-darwin/release/pueue - daemon_artifact_name: target/aarch64-apple-darwin/release/pueued - client_release_name: pueue-darwin-aarch64 - daemon_release_name: pueued-darwin-aarch64 - cross: false - strip: true + compress: false steps: - name: Checkout code @@ -84,9 +44,9 @@ jobs: - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@stable - with: - components: llvm-tools-preview - targets: ${{ matrix.target }} + + - run: sudo apt install musl-tools + if: startsWith(matrix.os, 'ubuntu') - name: cargo build uses: houseabsolute/actions-rust-cross@v0 @@ -95,28 +55,32 @@ jobs: args: --release --locked target: ${{ matrix.target }} + - name: Set exe extension for Windows + run: echo "EXE=.exe" >> $env:GITHUB_ENV + if: startsWith(matrix.os, 'windows') + - name: Compress client uses: svenstaro/upx-action@v2 with: - file: ${{ matrix.client_artifact_name }} - args: --lzma - strip: ${{ matrix.strip }} - if: matrix.target != 'x86_64-pc-windows-msvc' + file: target/${{ matrix.target }}/release/pueue${{ env.EXE }} + args: --best --lzma + strip: false + if: ${{ matrix.compress }} - name: Compress daemon uses: svenstaro/upx-action@v2 with: - file: ${{ matrix.daemon_artifact_name }} - args: --lzma - strip: ${{ matrix.strip }} - if: matrix.target != 'x86_64-pc-windows-msvc' + file: target/${{ matrix.target }}/release/pueued${{ env.EXE }} + args: --best --lzma + strip: false + if: ${{ matrix.compress }} - name: Upload client binaries to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ matrix.client_artifact_name }} - asset_name: ${{ matrix.client_release_name }} + file: target/${{ matrix.target }}/release/pueue${{ env.EXE }} + asset_name: pueue-${{ matrix.target }}${{ env.EXE }} tag: ${{ github.ref }} overwrite: true @@ -124,8 +88,8 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ matrix.daemon_artifact_name }} - asset_name: ${{ matrix.daemon_release_name }} + file: target/${{ matrix.target }}/release/pueued${{ env.EXE }} + asset_name: pueued-${{ matrix.target }}${{ env.EXE }} tag: ${{ github.ref }} overwrite: true diff --git a/Cargo.toml b/Cargo.toml index 95e14e5..e316f69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,4 +33,6 @@ better-panic = "0.3" pretty_assertions = "1" [profile.release] +codegen-units = 1 lto = "thin" +strip = true