Simplify precommit.

This commit is contained in:
jregan
2019-11-13 21:19:30 -08:00
parent 24f3d7556f
commit 875385609e

View File

@@ -12,9 +12,8 @@ function removeBin {
}
function installTools {
make install-tools
MDRIP=$(go env GOPATH)/bin/mdrip
ls -l $(go env GOPATH)/bin
make install-tools
ls -C1 -g -G -h $(go env GOPATH)/bin
}
function runFunc {
@@ -50,16 +49,16 @@ function testExamplesAgainstLatestKustomizeRelease {
echo "Installing latest kustomize from $latest"
(cd ~; GO111MODULE=on go install $latest)
$MDRIP --mode test \
mdrip --mode test \
--label testAgainstLatestRelease examples
# TODO: make work for non-linux
if onLinuxAndNotOnTravis; then
if onLinuxAndNotOnTravis; then
echo "On linux, and not on travis, so running the notravis example tests."
# Requires helm.
make $(go env GOPATH)/bin/helm
$MDRIP --mode test \
mdrip --mode test \
--label helmtest examples/chart.md
fi
echo "Example tests passed against $latest"
@@ -74,32 +73,31 @@ function testExamplesAgainstLocalHead {
# To test examples of unreleased features, add
# examples with code blocks annotated with some
# label _other than_ @testAgainstLatestRelease.
$MDRIP --mode test \
mdrip --mode test \
--label testAgainstLatestRelease examples
echo "Example tests passed against HEAD"
}
# Having this set might contradict the Makefile,
# so assure it's unset.
# Don't override go's notion of where to
# install stuff.
unset GOPATH
# With GOPATH now undefined, this most likely
# puts $HOME/go/bin on the path. Regardless,
# subsequent go tool installs will be placing
# binaries in this location.
# Ease running the tooling installed by 'go';
# mdrip, pluginator, stringer, etc.
PATH=$(go env GOPATH)/bin:$PATH
# Make sure we run in the root of the repo and
# therefore run the tests on all packages
# Assure that this script runs from the repo
# root, since some tests might rely on it.
base_dir="$( cd "$(dirname "$0")/.." && pwd )"
cd "$base_dir" || {
echo "Cannot cd to '$base_dir'. Aborting." >&2
exit 1
}
echo "HOME=$HOME"
echo "PATH=$PATH"
echo pwd=`pwd`
echo "HOME = $HOME"
echo "PATH = $PATH"
echo " PWD = $PWD"
echo " "
echo "Working..."