Skip to content

Commit

Permalink
Merge pull request #6193 from terraform-providers/f/travis-lintrest
Browse files Browse the repository at this point in the history
travis: conditionally running the `make lintrest` step
  • Loading branch information
tombuildsstuff authored Mar 20, 2020
2 parents a251f1f + 6e7d4db commit 854f760
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
4 changes: 1 addition & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ lintunused:
golangci-lint run ./... -v --no-config --concurrency 1 --deadline=30m10s --disable-all --enable=unused; ES=$$?; kill -9 $$PID; exit $$ES

lintrest:
@echo "==> Checking source code against linters..."
(while true; do sleep 300; echo "(I'm still alive and linting!)"; done) & PID=$$!; echo $$PID; \
golangci-lint run ./... -v --concurrency 1 --config .golangci-travis.yml ; ES=$$?; kill -9 $$PID; exit $$ES
./scripts/run-lint-rest.sh

depscheck:
@echo "==> Checking source code with go mod tidy..."
Expand Down
27 changes: 27 additions & 0 deletions scripts/run-lint-rest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

function checkForConditionalRun {
if [ "$TRAVIS" == "ci" ];
then
echo "Checking if this should be conditionally run.."
result=$(git diff --name-only HEAD | grep azurerm/)
if [ "$result" = "" ];
then
echo "No changes committed to ./azurerm - nothing to lint - exiting"
exit 0
fi
fi
}

function runLinters {
echo "==> Checking source code against linters..."
(while true; do sleep 300; echo "(I'm still alive and linting!)"; done) & PID=$$!; echo $$PID; \
golangci-lint run ./... -v --concurrency 1 --config .golangci-travis.yml ; ES=$$?; kill -9 $$PID; exit $$ES
}

function main {
checkForConditionalRun
runLinters
}

main

0 comments on commit 854f760

Please sign in to comment.