From 875385609ed3fc5d3b1f2d1529fd4b642f1dcdc0 Mon Sep 17 00:00:00 2001 From: jregan Date: Wed, 13 Nov 2019 21:19:30 -0800 Subject: [PATCH] Simplify precommit. --- travis/pre-commit.sh | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/travis/pre-commit.sh b/travis/pre-commit.sh index 0b4aeec2b..57e2d61e7 100755 --- a/travis/pre-commit.sh +++ b/travis/pre-commit.sh @@ -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..."