From d0744fb1044ade77dbcbbf209542946ac4e80d2c Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Thu, 26 Oct 2023 10:50:54 -0700 Subject: [PATCH] Reduce the size of published artifacts. (#166) This commit attempts to minimize the size of published artifacts by enabling LTO, aborting on panic, and stripping debug information. --- .github/workflows/publish-binaries.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-binaries.yml b/.github/workflows/publish-binaries.yml index 67ba40c6..dd793f87 100644 --- a/.github/workflows/publish-binaries.yml +++ b/.github/workflows/publish-binaries.yml @@ -44,6 +44,11 @@ jobs: - name: Install Rust run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.rust-target }} - run: cargo build --release --target ${{ matrix.rust-target }} + env: + CARGO_PROFILE_RELEASE_PANIC: abort + CARGO_PROFILE_RELEASE_LTO: true + CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1 + CARGO_PROFILE_RELEASE_STRIP: debuginfo - run: mv ./target/${{ matrix.rust-target }}/release/cargo-component.exe ./target/${{ matrix.rust-target }}/release/cargo-component-${{ matrix.rust-target }} if: matrix.os == 'windows-latest' - run: mv ./target/${{ matrix.rust-target }}/release/cargo-component ./target/${{ matrix.rust-target }}/release/cargo-component-${{ matrix.rust-target }} @@ -66,7 +71,6 @@ jobs: os: macos-latest - rust-target: x86_64-pc-windows-gnu os: windows-latest - permissions: contents: write steps: @@ -74,6 +78,11 @@ jobs: - name: Install Rust run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.rust-target }} - run: cargo build --release --target ${{ matrix.rust-target }} + env: + CARGO_PROFILE_RELEASE_PANIC: abort + CARGO_PROFILE_RELEASE_LTO: true + CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1 + CARGO_PROFILE_RELEASE_STRIP: debuginfo - run: mv ./target/${{ matrix.rust-target }}/release/cargo-component.exe ./target/${{ matrix.rust-target }}/release/cargo-component-${{ matrix.rust-target }} if: matrix.os == 'windows-latest' - run: mv ./target/${{ matrix.rust-target }}/release/cargo-component ./target/${{ matrix.rust-target }}/release/cargo-component-${{ matrix.rust-target }}