-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6193 from terraform-providers/f/travis-lintrest
travis: conditionally running the `make lintrest` step
- Loading branch information
Showing
2 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |