2020-08-24 12:04:31 -04:00
|
|
|
name: Lint
|
2020-06-19 09:19:37 -04:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-08-24 04:09:51 -04:00
|
|
|
branches: [master]
|
2020-06-19 09:19:37 -04:00
|
|
|
pull_request:
|
2020-08-24 04:09:51 -04:00
|
|
|
branches: [master]
|
2020-08-24 12:04:31 -04:00
|
|
|
types: [opened, synchronize, reopened]
|
2020-06-19 09:19:37 -04:00
|
|
|
|
|
|
|
jobs:
|
2020-08-24 04:09:51 -04:00
|
|
|
lint:
|
2020-06-19 09:19:37 -04:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-08-30 13:09:45 -04:00
|
|
|
- name: Set up Go 1.x
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ^1.14
|
|
|
|
|
|
|
|
- name: Checkout codebase
|
2020-06-19 09:19:37 -04:00
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2020-08-30 13:09:45 -04:00
|
|
|
- name: Cache go module
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: ${{ runner.os }}-go-
|
|
|
|
|
|
|
|
- name: Lint *.go files
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: |
|
|
|
|
go vet $(go list ./... | grep -v /external/)
|
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Lint other files
|
|
|
|
if: ${{ always() }}
|
2020-09-04 02:09:47 -04:00
|
|
|
uses: github/super-linter@v3.9.4
|
2020-06-19 09:19:37 -04:00
|
|
|
env:
|
2020-08-30 13:09:45 -04:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2020-06-27 08:50:41 -04:00
|
|
|
VALIDATE_ALL_CODEBASE: false
|
2020-08-30 13:09:45 -04:00
|
|
|
VALIDATE_BASH: false
|
|
|
|
VALIDATE_DOCKERFILE: false
|
|
|
|
VALIDATE_DOCKERFILE_HADOLINT: false
|
|
|
|
VALIDATE_GO: false
|
2020-06-27 08:50:41 -04:00
|
|
|
VALIDATE_JSON: false
|
2020-08-30 13:09:45 -04:00
|
|
|
VALIDATE_MD: false
|
|
|
|
VALIDATE_PROTOBUF: false
|
2020-09-02 23:33:23 -04:00
|
|
|
|
|
|
|
- name: Show if need to format code
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: |
|
|
|
|
filesNeedToFormat=$(go fmt ./...)
|
|
|
|
if [[ $filesNeedToFormat ]]; then
|
|
|
|
echo -e "\033[0;36m[Error] The following Go files need to be formatted:\033[0m"
|
|
|
|
echo -e "\033[0;31m$filesNeedToFormat\033[0m"
|
|
|
|
exit 1
|
|
|
|
fi
|