From ac784eb25a438342e6ba4f5b55a03a5dc0507bc7 Mon Sep 17 00:00:00 2001 From: Tristan Colgate-McFarlane Date: Wed, 13 Dec 2023 11:43:14 +0000 Subject: [PATCH] fix(ci): fix some unused CI config --- .github/workflows/codeql.yml | 11 --- .github/workflows/test-matrix.yaml | 2 +- .github/workflows/vulnerability-check.yaml | 10 -- .golangci.yaml | 107 +++++++++++++++++++++ 4 files changed, 108 insertions(+), 22 deletions(-) create mode 100644 .golangci.yaml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index af88c91..39a2f52 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -58,14 +58,3 @@ jobs: uses: github/codeql-action/analyze@v2 with: category: "/language:${{matrix.language}}" - - - - name: Notify Slack - if: failure() - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - uses: voxmedia/github-action-slack-notify-build@v2 - with: - channel_id: C02TMGNNL4V - status: FAILED - color: danger diff --git a/.github/workflows/test-matrix.yaml b/.github/workflows/test-matrix.yaml index 266b936..d4fdebc 100644 --- a/.github/workflows/test-matrix.yaml +++ b/.github/workflows/test-matrix.yaml @@ -21,7 +21,7 @@ jobs: uses: goreleaser/goreleaser-action@v4 with: version: latest - args: build --config=.goreleaser.yml --rm-dist --snapshot --single-target + args: build --config=.goreleaser.yml --clean --snapshot --single-target - name: Test run: | diff --git a/.github/workflows/vulnerability-check.yaml b/.github/workflows/vulnerability-check.yaml index f3309f1..2074d4d 100644 --- a/.github/workflows/vulnerability-check.yaml +++ b/.github/workflows/vulnerability-check.yaml @@ -20,13 +20,3 @@ jobs: run: | go install golang.org/x/vuln/cmd/govulncheck@latest govulncheck -v ./... - - - name: Notify Slack - if: failure() - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - uses: voxmedia/github-action-slack-notify-build@v2 - with: - channel_id: C02TMGNNL4V - status: FAILED - color: danger diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..c84f533 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,107 @@ +--- +run: + timeout: 300s + skip-dirs: + - "^tools/" + build-tags: + - tests + +linters-settings: + exhaustive: + default-signifies-exhaustive: true + + gci: + sections: + - standard + - default + - prefix(github.com/cerbos/cerbos) + - blank + - dot + skip-generated: true + custom-order: true + + gofumpt: + extra-rules: true + + goheader: + values: + const: + COMPANY: Zenauth Ltd. + template: |- + Copyright {{ YEAR-RANGE }} {{ COMPANY }} + SPDX-License-Identifier: Apache-2.0 + + govet: + enable-all: true + disable: + - shadow + + nolintlint: + allow-unused: true # false would be preferable, but it's flaky (https://github.com/golangci/golangci-lint/issues/3228) + allow-leading-space: false + require-specific: true + + tagliatelle: + case: + rules: + json: goCamel + yaml: goCamel + xml: goCamel + bson: goCamel + +linters: + enable: + - asciicheck + - bidichk + - bodyclose + - dupl + - durationcheck + - errorlint + - exhaustive + - exportloopref + - forbidigo + - forcetypeassert + - goconst + - gocritic + - godot + - gofumpt + - goimports + - goheader + - gomnd + - gomoddirectives + - gosec + - govet + - importas + - makezero + - misspell + - nakedret + - nestif + - nilerr + - noctx + - nolintlint + - prealloc + - predeclared + - promlinter + - revive + - rowserrcheck + - sqlclosecheck + - tagliatelle + - tenv + - thelper + - tparallel + - unconvert + - unparam + - wastedassign + - whitespace + +issues: + max-same-issues: 30 + + exclude-rules: + - path: _test\.go + linters: + - dupl + - forcetypeassert + - goconst + - gomnd + - govet