Skip to content

Commit

Permalink
Reduce the size of published artifacts. (bytecodealliance#166)
Browse files Browse the repository at this point in the history
This commit attempts to minimize the size of published artifacts by enabling
LTO, aborting on panic, and stripping debug information.
  • Loading branch information
peterhuene authored Oct 26, 2023
1 parent d9c7730 commit d0744fb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/publish-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -66,14 +71,18 @@ jobs:
os: macos-latest
- rust-target: x86_64-pc-windows-gnu
os: windows-latest

permissions:
contents: write
steps:
- uses: actions/checkout@v4
- 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 }}
Expand Down

0 comments on commit d0744fb

Please sign in to comment.