From d0fee21c810adcba8c9f3fb145adfc2fe3079a0a Mon Sep 17 00:00:00 2001 From: "Kennelly, Martin" Date: Wed, 17 Feb 2021 12:26:10 +0000 Subject: [PATCH] Add static analysis github action Add golangci-lint action with extra linters besides the default set [1]. Add hadolint and shellcheck. [1] https://golangci-lint.run/usage/linters Signed-off-by: Kennelly, Martin --- .github/workflows/lint.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..7ef3653e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,35 @@ +name: Go-static-analysis +on: [push, pull_request] +jobs: + golangci: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.29 + # Adding additional linters beside the default set - See https://golangci-lint.run/usage/linters + args: --enable=golint,bodyclose,gosec,whitespace + shellcheck: + name: Shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + hadolint: + runs-on: ubuntu-latest + name: Hadolint + steps: + - uses: actions/checkout@v2 + - uses: brpaz/hadolint-action@v1.2.1 + name: Run Hadolint + with: + dockerfile: Dockerfile + - uses: brpaz/hadolint-action@v1.2.1 + with: + dockerfile: Dockerfile.rhel7 +