blob: 3da037b912b04170bad39951165040f18eff84e7 [file] [log] [blame]
#!/bin/bash
# Presubmit script for CI/CD
# Exit on error, print commands, and exit on unset variables.
set -eux
# Change to the rust directory to run cargo commands.
cd "$(dirname "$0")/rust"
# 1. Build the code.
# `set -e` will cause the script to exit if this fails.
cargo build
# 2. Check formatting.
# `cargo fmt -- --check` will exit with a non-zero status code if any
# files are not formatted correctly.
cargo fmt -- --check
# 3. Run tests.
# `set -e` will cause the script to exit if any tests fail.
cargo test
{ set +x; } 2>/dev/null
echo "Presubmit checks passed!";