diff options
| -rw-r--r-- | .github/workflows/checks.yaml | 50 | ||||
| -rw-r--r-- | .golangci.yaml | 85 |
2 files changed, 135 insertions, 0 deletions
diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml new file mode 100644 index 0000000..c406d98 --- /dev/null +++ b/.github/workflows/checks.yaml @@ -0,0 +1,50 @@ +# SPDX-FileCopyrightText: 2025 Stefan Majewsky <majewsky@gmx.net> +# SPDX-License-Identifier: Apache-2.0 + +name: Checks +"on": + push: + branches: [ main ] + pull_request: + branches: [ '*' ] + workflow_dispatch: {} +permissions: + checks: write + contents: read +jobs: + checks: + name: Checks + runs-on: ubuntu-latest + steps: + + #################### + ### Setup Phase + + - name: Check out code + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + check-latest: true + go-version: stable + + #################### + # Static Tests + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v8 + with: + version: latest + + #################### + # Test Suite + + - name: Run tests + run: go test -shuffle=on -coverprofile=cover.out -covermode=count ./... + - name: Upload coverage report to Coveralls + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GIT_BRANCH: ${{ github.head_ref }} + run: | + go install github.com/mattn/goveralls@latest + goveralls -service=github -coverprofile=cover.out diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..cbe64b9 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,85 @@ +version: "2" +run: + modules-download-mode: vendor + timeout: 3m0s # none by default in v2 + +formatters: + enable: + - gofmt + - goimports + +issues: + max-issues-per-linter: 0 # no limit + max-same-issues: 0 # no limit + +linters: + default: standard + enable: + - errorlint + - exhaustive + - gocheckcompilerdirectives + - goconst + - gocritic + - gosec + - intrange + - misspell + - musttag + - nilerr + - nolintlint + - perfsprint + - prealloc + - predeclared + - reassign + - unconvert + - usestdlibvars + - usetesting + - wastedassign + - whitespace + settings: + goconst: + min-occurrences: 5 + gocritic: + enabled-checks: + - boolExprSimplify + - builtinShadow + - emptyStringTest + - evalOrder + - httpNoBody + - importShadow + - initClause + - methodExprCall + - paramTypeCombine + - preferFilepathJoin + - ptrToRefParam + - redundantSprint + - returnAfterHttpError + - stringConcatSimplify + - timeExprSimplify + - truncateCmp + - typeAssertChain + - typeUnparen + - unnamedResult + - unnecessaryBlock + - unnecessaryDefer + - weakCond + - yodaStyleExpr + gomoddirectives: + toolchain-forbidden: true + go-version-pattern: 1\.\d+(\.0)?$ + nolintlint: + require-specific: true + staticcheck: + dot-import-whitelist: + - github.com/majewsky/gg/option + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - path: (.+)\.go$ + text: declaration of "err" shadows declaration at + - path: _test\.go + linters: [ goconst ] |
