From 36523a12032a45730cd0b7d82eac42a94f6654bc Mon Sep 17 00:00:00 2001 From: lukas-heiligenbrunner Date: Thu, 8 Dec 2022 14:22:37 +0100 Subject: [PATCH] create optimized production build fix nightly build --- .gitlab-ci.yml | 9 ++++++--- lib/Cargo.toml | 7 +++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7296b49..1a4ebef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,17 +24,20 @@ rust-latest: - mv ./lib/target/release/raid_manager ./lib/target/release/raid_manager_static - cargo build -r --manifest-path=lib/Cargo.toml - cargo test -r --manifest-path=lib/Cargo.toml + - cp ./lib/target/release/raid_manager* . artifacts: expire_in: 2 days paths: - - "./lib/target/release/raid_manager_static" - - "./lib/target/release/raid_manager" + - "./raid_manager_static" + - "./raid_manager" rust-nightly: stage: build_backend image: rustlang/rust:nightly script: - - cargo build -r --manifest-path=lib/Cargo.toml + - mkdir ./lib/webroot + - cp -r ./app/build/web/* ./lib/webroot - cargo build -r --manifest-path=lib/Cargo.toml --features static + - cargo build -r --manifest-path=lib/Cargo.toml - cargo test -r --manifest-path=lib/Cargo.toml allow_failure: true diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 2478f15..32628a4 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -12,3 +12,10 @@ rust-embed = "6.4.2" [features] static = [] + +[profile.release] +opt-level = 'z' # Optimize for size. +lto = true # Enable Link Time Optimization +codegen-units = 1 # Reduce number of codegen units to increase optimizations. +panic = 'abort' # Abort on panic +strip = true # Strip symbols from binary*