jiff/scripts/test-only-core
Andrew Gallant 35b0c4d422 ci: break ./scripts/test into pieces...
... so that we can run each piece in its own job in CI.

This creates an obscene number of jobs, but I'm really hoping this cuts
down on the total wall clock time.
2025-03-06 16:05:00 -05:00

35 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
set -e
# cd to the directory containing this crate's Cargo.toml so that we don't need
# to pass --manifest-path to every `cargo` command.
cd "$(dirname "$0")/.."
# We test core-only mode specially. Sadly, in core-only mode, error messages
# are quite a bit worse. And this wreaks havoc with Jiff's snapshot tests on
# error messages. We could `cfg` all of them, but that's a huge pain and it's
# not clear that it's worth it.
#
# Since we use snapshot tests for more than error messages, this technique also
# risks accidentally passing a test that doesn't involve error messages. Sigh.
# We accept this risk because this still runs a lot of tests, and the tests
# that aren't covered are run in other configurations. Still, it's not ideal.
echo "===== CORE ONLY ====="
cargo build --no-default-features
INSTA_FORCE_PASS=1 INSTA_UPDATE=no cargo test --lib --no-default-features
INSTA_FORCE_PASS=1 INSTA_UPDATE=no cargo test --test integration --no-default-features
# More core-only tests, when combined with compatible features.
features=(
"serde"
"logging"
"serde logging"
"static"
)
for f in "${features[@]}"; do
echo "===== COREONLY PLUS '$f' ====="
cargo build --no-default-features --features "$f"
INSTA_FORCE_PASS=1 INSTA_UPDATE=no cargo test --lib --no-default-features --features "$f"
INSTA_FORCE_PASS=1 INSTA_UPDATE=no cargo test --test integration --no-default-features --features "$f"
done