Skip to content

Commit

Permalink
chore: use new Cargo profile in CI for shorter compilation
Browse files Browse the repository at this point in the history
new profile is called `fast` and it's not as fast as `release`, but
should be fast enough for CI and compiles faster
  • Loading branch information
marcospb19 committed Nov 20, 2024
1 parent 162dfbd commit 97b4608
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build-artifacts-and-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 97b4608

Please sign in to comment.