Files
regorus/scripts/pre-push
Anand Krishnamoorthi a8f5ac6117 fix: Run pre-commit tests in debug mode
Release mode uses LTO optimization for binaries.
This can take up a lot of time especially for doc tests which
create a separate binary for each test.

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
2025-12-16 09:43:57 -06:00

41 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
set -eo pipefail
if [ -f Cargo.toml ]; then
# Run precommit checks.
dir=$(dirname "${BASH_SOURCE[0]}")
"$dir/pre-commit"
# Ensure that the public API works.
cargo test --doc
# Ensure that no_std build succeeds.
# Build for a target that has no std available.
if command -v rustup > /dev/null; then
rustup target add thumbv7m-none-eabi
(cd tests/ensure_no_std; cargo build -r --target thumbv7m-none-eabi)
fi
# Ensure that we can build with only std.
cargo build --example regorus --no-default-features --features std
# Ensure that we can build with all features.
cargo build --all-features
# Ensure that all tests pass.
cargo test
cargo test --test aci
cargo test --test kata
# Ensure that all tests pass with extensions
cargo test --features rego-extensions
cargo test --test aci --features rego-extensions
cargo test --test kata --features rego-extensions
# Ensure that OPA conformance tests don't regress.
cargo test --features opa-testutil,serde_json/arbitrary_precision,rego-extensions --test opa -- $(tr '\n' ' ' < tests/opa.passing)
fi