From 0e1b97a7efa3328ebf478cf28c12066d765d8dc6 Mon Sep 17 00:00:00 2001 From: Antony David Date: Thu, 31 Oct 2024 09:43:17 +0100 Subject: [PATCH 1/2] build: reduce binary size --- .cargo/config.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index dd49a9b1bced..f5c6cd810572 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -37,4 +37,7 @@ lint = "clippy --workspace --all-targets -- --deny warnings" new-crate = "run -p xtask_codegen -- new-crate" [profile.release] -lto = true +codegen-units = 1 +lto = true +opt-level = 3 +strip = "symbols" From 1e85e4750f6b9c9b18c3c5e9695e164f707c0e58 Mon Sep 17 00:00:00 2001 From: Antony David Date: Thu, 31 Oct 2024 10:21:16 +0100 Subject: [PATCH 2/2] build: set flags in ci --- .cargo/config.toml | 5 +---- .github/workflows/release_cli.yml | 2 +- .github/workflows/release_knope.yml | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index f5c6cd810572..dd49a9b1bced 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -37,7 +37,4 @@ lint = "clippy --workspace --all-targets -- --deny warnings" new-crate = "run -p xtask_codegen -- new-crate" [profile.release] -codegen-units = 1 -lto = true -opt-level = 3 -strip = "symbols" +lto = true diff --git a/.github/workflows/release_cli.yml b/.github/workflows/release_cli.yml index 7673422317bc..2cd060db7ab6 100644 --- a/.github/workflows/release_cli.yml +++ b/.github/workflows/release_cli.yml @@ -126,7 +126,7 @@ jobs: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc # Strip all debug symbols from the resulting binaries - RUSTFLAGS: "-C strip=symbols" + RUSTFLAGS: "-C strip=symbols -C codegen-units=1" # Inline the version of the npm package in the CLI binary BIOME_VERSION: ${{ env.version }} diff --git a/.github/workflows/release_knope.yml b/.github/workflows/release_knope.yml index 18f82741e5b1..86ffbd67eaaa 100644 --- a/.github/workflows/release_knope.yml +++ b/.github/workflows/release_knope.yml @@ -113,7 +113,7 @@ jobs: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc # Strip all debug symbols from the resulting binaries - RUSTFLAGS: "-C strip=symbols" + RUSTFLAGS: "-C strip=symbols -C codegen-units=1" # Inline the version of the npm package in the CLI binary BIOME_VERSION: ${{ env.version }}