Files
anki/ninja
Abdo 3c9b1daf35 CI: Apply a consistent Cargo profile (#5133)
## Linked issue

Related:
https://github.com/ankitects/anki/pull/5102#issuecomment-4923922894

## Summary / motivation


This adds a new Cargo profile (`ci`) for use in all Rust build commands
on CI. The goal is to reduce unnecessary recompilation of the same
crates in dev/release profiles.

## Steps to reproduce (before)

View the logs of the last CI run on main and notice that some crates are
getting compiled with the `release` profile, e.g. compilation ends with
"Finished `release` profile [optimized]".

## How to test (after)

View the logs of the last CI run in this PR and confirm all Rust
compilation commands end with "Finished `ci` profile [unoptimized]",
indicating that only a single profile is being used.

### Checklist (minimum)

- [x] I ran `./ninja check` or an equivalent relevant check locally.
- [ ] I added or updated tests when the change is non-trivial or
behavior changed.

## Scope

- [x] This PR is focused on one change (no unrelated edits).
2026-08-12 10:17:29 +03:00

25 lines
509 B
Bash
Executable File

#!/usr/bin/env bash
set -e
if [ "$BUILD_ROOT" == "" ]; then
out=$(pwd)/out
else
out="$BUILD_ROOT"
fi
export CARGO_TARGET_DIR=$out/rust
export RECONFIGURE_KEY="${MAC_X86};${LIN_ARM64};${SOURCEMAP};${HMR};${CI}"
if [ "$CI" = "true" ] && [ -z "$RELEASE" ]; then
runner_profile=ci
else
runner_profile=release
fi
if [ "$SKIP_RUNNER_BUILD" = "1" ]; then
echo "Runner not rebuilt."
else
cargo build -p runner --profile $runner_profile
fi
exec $out/rust/$runner_profile/runner build -- $*