Rearchitecting testing to have extended tests in pre-commit & minimal tests during CI/CD

This commit is contained in:
2023-10-03 13:01:50 -05:00
parent d53fd90185
commit fb9de15de0
4 changed files with 27 additions and 6 deletions

21
maat
View File

@@ -83,7 +83,8 @@ function BuildRepo() {
git clone "$repo"
fi
cd "$repodir"
git reset --hard origin &>/dev/null
git clean -fd
git clean -fx
output="$(git pull 2>&1)"
if [ -n "$incremental" ] && [ $( echo "$output" | grep -c 'Already up to date.' ) -eq 1 ]; then
return;
@@ -150,12 +151,26 @@ timeout="90s"
# Stat tracking
starttime=`date +%s`
function usage() {
### Show helptext
# param retcode: what to exit
retcode="$1"
cat <<EOM
Usage: $0
$0 -T # Extended testing
$0 -b homedir -c aurconf -u user -t timeout
Add -s to skip patching or -v for verbosity.
EOM
exit $retcode
}
# Parse arguments
while getopts 'b:c:hil:st:Tu:v' OPTION; do
case "${OPTION}" in
b) homedir="${OPTARG}" ;;
c) aurconf="${OPTARG}" ;;
h) Usage; exit 0 ;;
h) usage; exit 0 ;;
i) incremental=1 ;;
l) cmdstring="$0"; for arg in $@; do if [ "$arg" != "-l" ] && [ "$arg" != "${OPTARG}" ]; then cmdstring="$cmdstring \"${arg}\""; fi; done; exec /bin/bash -c "$cmdstring | tee -a \"${OPTARG}\""; ;;
s) skipPatching=1 ;;
@@ -163,7 +178,7 @@ while getopts 'b:c:hil:st:Tu:v' OPTION; do
T) export MAATTESTINGVAR=1; exec $0 -l ./testing.log -u "$deprivuser" -v -s -c <(echo https://aur.archlinux.org/ascii-invaders.git) -b . ;;
u) deprivuser="${OPTARG}" ;;
v) set -x ;;
*) usage; exit 1 ;;
*) echo "Internal GitOps CI/CD Pipeline"; usage 1 ;;
esac
done