gogmagog/do.sh
Deepak 4801411b1d
All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good
Adds do.sh build script
2020-12-29 09:42:33 -06:00

42 lines
826 B
Bash

#!/usr/bin/env bash
# Do - The Simplest Build Tool on Earth.
# Documentation and examples see https://github.com/8gears/do
set -Eeuo pipefail # -e "Automatic exit from bash shell script on error" -u "Treat unset variables and parameters as errors"
build() {
echo "I am ${FUNCNAME[0]}ing"
go version
go build
}
test() {
echo "I am ${FUNCNAME[0]}ing"
_test
_lint
_vet
}
_test() {
echo "I am ${FUNCNAME[0]}ing"
go test -v -coverprofile=coverage.out -covermode count ./... | tee tests.out
}
_lint() {
echo "I am ${FUNCNAME[0]}ing"
golint -set_exit_status ./...
}
_vet() {
echo "I am ${FUNCNAME[0]}ing"
go vet ./...
}
all() {
test && build
}
"$@" # <- execute the task
[ "$#" -gt 0 ] || printf "Usage:\n\t./do.sh %s\n" "($(compgen -A function | grep '^[^_]' | paste -sd '|' -))"