git-hooks: build and test with --no-default-features too.

Stores output in separate target/ subdir, so it shouldn't get clobbered.
This commit is contained in:
Bill Thiede 2021-07-18 20:16:34 -07:00
parent 7a8ed15017
commit c4f10126e3

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
pushd () { pushd () {
command pushd "$@" > /dev/null command pushd "$@" > /dev/null
} }
@ -18,9 +20,14 @@ RT=rtchallenge
AFFECTED="$(git diff-index --cached --name-only HEAD)" AFFECTED="$(git diff-index --cached --name-only HEAD)"
#echo "AFFECTED $AFFECTED" #echo "AFFECTED $AFFECTED"
RT_AFFECTED=$(echo "${AFFECTED:?}" | grep ${RT:?} || true) RT_AFFECTED=$(echo "${AFFECTED:?}" | grep ${RT:?} || true)
NO_FEATURES_TARGET_DIR="${SCRIPT_DIR:?}/../../rtchallenge/target/no-default-features"
if [ ! -z "$RT_AFFECTED" ]; then if [ ! -z "$RT_AFFECTED" ]; then
echo "Files for the rt challenge were touched, running tests" echo "Files for the rt challenge were touched, running tests"
cd ${RT:?} && cargo build --examples && cargo test 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 fi
# Uncomment to debug presubmit. # Uncomment to debug presubmit.
#exit 1 #exit 1