34 lines
989 B
Bash
Executable File
34 lines
989 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
|
|
pushd () {
|
|
command pushd "$@" > /dev/null
|
|
}
|
|
|
|
popd () {
|
|
command popd "$@" > /dev/null
|
|
}
|
|
|
|
for workspace in rtchallenge rtiow; do
|
|
pushd ${workspace:?}
|
|
cargo fmt -- --check || (echo "To fix, run: cd ${workspace:?} && cargo fmt" && false)
|
|
popd
|
|
done
|
|
|
|
RT=rtchallenge
|
|
AFFECTED="$(git diff-index --cached --name-only HEAD)"
|
|
#echo "AFFECTED $AFFECTED"
|
|
RT_AFFECTED=$(echo "${AFFECTED:?}" | grep ${RT:?} || true)
|
|
NO_FEATURES_TARGET_DIR="${SCRIPT_DIR:?}/../../rtchallenge/target/no-default-features"
|
|
if [ ! -z "$RT_AFFECTED" ]; then
|
|
echo "Files for the rt challenge were touched, running tests"
|
|
cd ${RT:?} && \
|
|
cargo build --examples && \
|
|
cargo test && \
|
|
cargo build --target-dir=${NO_FEATURES_TARGET_DIR:?} --no-default-features --examples && \
|
|
cargo test --target-dir=${NO_FEATURES_TARGET_DIR:?} --no-default-features
|
|
fi
|
|
# Uncomment to debug presubmit.
|
|
#exit 1
|