#!/bin/sh

# To install:
# ln -sv $GOPATH/src/github.com/lmorg/murex/test/pre-push .git/hooks/

cd $GOPATH/src/github.com/lmorg/murex

trap ctrl_c INT

ctrl_c() {
    printf "\n\033[0;31m[PUSH CANCELLED]\033[0m\n"
    exit 1
}

echo "Running Go tests...."
go test ./... -race || exit 1

echo "Running unit tests on builtin profiles...."
go build github.com/lmorg/murex || exit 1
./murex --run-tests || exit 1

echo "Run murex flag unit tests...."
./murex -c 'source: ./flags_test.mx; try {test: run *}' || exit 1

#echo "Checking subset of alternative OS builds...."
#test/test_goos.mx || exit 1

echo "Allowing git push to proceed...."
