Skip to content

Commit

Permalink
add lto and strip (#57)
Browse files Browse the repository at this point in the history
* enable lto and strip in profile

* remove strip from workflow

* test publish

* fix publish test

* fix publish test

* fix publish test

* remove test publish
  • Loading branch information
achristmascarl authored Sep 6, 2024
1 parent 5735a39 commit c49d8be
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,6 @@ jobs:
toolchain: stable
args: --release --target ${{ matrix.target }} --features ${{ matrix.features }}

- name: install strip command
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
shell: bash
run: |
sudo apt update
sudo apt-get install -y binutils-aarch64-linux-gnu
- name: Strip binary
if: ${{ matrix.target != 'aarch64-linux-android' }}
shell: bash
run: |
cd target/${{ matrix.target }}/release
####### reduce binary size by removing debug symbols #######
BINARY_NAME=${{ matrix.binary-name }}${{ matrix.binary-postfix }}
if [[ ${{ matrix.target }} == aarch64-unknown-linux-gnu ]]; then
GCC_PREFIX="aarch64-linux-gnu-"
else
GCC_PREFIX=""
fi
"$GCC_PREFIX"strip $BINARY_NAME
cd ../../../
- name: Packaging final binary
shell: bash
run: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,3 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Clippy check
run: cargo clippy --all-targets --all-features --workspace -- -D warnings

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ exclude = [".github/*", "demo.gif", "demo.tape", "00_init.sql", ".git/*", "Makef
[profile.dev]
opt-level = 2 # very slow on 1, basically as fast as --release on 2

[profile.release]
strip = "debuginfo"
lto = "fat"

[dependencies]
better-panic = "0.3.0"
clap = { version = "4.4.5", features = ["derive", "cargo", "wrap_help", "unicode", "string", "unstable-styles"] }
Expand Down

0 comments on commit c49d8be

Please sign in to comment.