From 97b46086934a0a60188a328d4f6e3446bee55485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marcos=20P=2E=20Bezerra?= Date: Wed, 20 Nov 2024 04:58:02 -0300 Subject: [PATCH] chore: use new Cargo profile in CI for shorter compilation new profile is called `fast` and it's not as fast as `release`, but should be fast enough for CI and compiles faster --- .github/workflows/build-artifacts-and-run-tests.yml | 9 +++++---- Cargo.toml | 9 +++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-artifacts-and-run-tests.yml b/.github/workflows/build-artifacts-and-run-tests.yml index 83d5984..cb3bf30 100644 --- a/.github/workflows/build-artifacts-and-run-tests.yml +++ b/.github/workflows/build-artifacts-and-run-tests.yml @@ -126,17 +126,18 @@ jobs: # there's no way to run tests for ARM64 Windows for now if: matrix.target != 'aarch64-pc-windows-msvc' run: | - ${{ env.CARGO }} +stable test --release --target ${{ matrix.target }} $EXTRA_CARGO_FLAGS + ${{ env.CARGO }} +stable test --profile fast --target ${{ matrix.target }} $EXTRA_CARGO_FLAGS - - name: Build artifacts (binary and completions) + - name: Build release artifacts (binary and completions) + if: ${{ inputs.upload_artifacts }} run: | ${{ env.CARGO }} +stable build --release --target ${{ matrix.target }} $EXTRA_CARGO_FLAGS env: OUCH_ARTIFACTS_FOLDER: artifacts - - name: Upload artifacts - uses: actions/upload-artifact@v4 + - name: Upload release artifacts if: ${{ inputs.upload_artifacts }} + uses: actions/upload-artifact@v4 with: name: ouch-${{ matrix.target }}-${{ steps.concat-features.outputs.FEATURES }} path: | diff --git a/Cargo.toml b/Cargo.toml index e280682..c9459ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,8 +73,17 @@ default = ["use_zlib", "use_zstd_thin", "unrar"] use_zlib = ["flate2/zlib", "gzp/deflate_zlib", "zip/deflate-zlib"] use_zstd_thin = ["zstd/thin"] +# For generating binaries for releases [profile.release] lto = true codegen-units = 1 opt-level = 3 strip = true + +# When we need a fast binary that compiles slightly faster `release` (useful for CI) +[profile.fast] +inherits = "release" +lto = false +opt-level = 2 +incremental = true +codegen-units = 16