Files
regorus/scripts/pre-commit
Anand Krishnamoorthi e93b33ea05 Support build on non Linux platforms
cargo config
1. MUSL is no longer the default target. This allows building on Mac and Windows.
2. On Linux, code coverage compiler options are supplied by default.

pre-commit, pre-push
- Coverage is turned on only on Linux
- clippy is run on all platforms

github
- MUSL build is tested to ensure that stand alone executables can be created

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
2023-03-01 15:45:44 +05:30

26 lines
747 B
Bash
Executable File

#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
set -eo pipefail
if [ -f Cargo.toml ]; then
# Ensure that all targets can be built.
cargo build --all-targets
#Ensure that code is correctly formatted.
cargo fmt --check || (echo "Run cargo fmt to fix formatting" && exit 1)
# Ensure that clippy warnings are addressed.
cargo clippy --all-targets --no-deps -- -Dwarnings
# Ensure that all modifications are included.
# TODO refine status checking.
if git status -s | grep -e "MM " -e "??" -e "AM " -e " M " > /dev/null; then
printf "\nUnstaged changes found:\n"
git status -s | grep -e "MM " -e "??" -e "AM " -e " M "
echo "Stage them and try again"
exit 1
fi
fi