-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
133 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
run: | ||
timeout: 5m | ||
go: '1.22' | ||
linters: | ||
enable: | ||
- gofmt # Gofmt checks whether code was gofmt-ed. By default, this tool runs with -s option to check for code simplification | ||
- gci # Gci controls golang package import order and makes it always deterministic. | ||
- errorlint # errorlint can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. | ||
- containedctx # containedctx is a linter that detects struct contained context.Context field | ||
- dogsled # Checks assignments with too many blank identifiers (e.g. x, , , _, := f()) | ||
- nilnil # Checks that there is no simultaneous return of nil error and an invalid value. | ||
- noctx # noctx finds sending http request without context.Context | ||
- funlen # limit function length | ||
- dupl # Detect code duplication | ||
|
||
issues: | ||
exclude-rules: | ||
- linters: | ||
- containedctx | ||
- gocyclo | ||
- gocognit | ||
- funlen | ||
path: _test\.go | ||
|
||
linters-settings: | ||
gocyclo: | ||
min-complexity: 10 | ||
gocognit: | ||
min-complexity: 20 | ||
funlen: | ||
lines: 120 | ||
statements: 120 | ||
|
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,43 @@ | ||
name: Lint checks | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- '[0-9]+.[1-9][0-9]*.x' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
- '[0-9]+.[1-9][0-9]*.x' | ||
paths: | ||
- "**.go" | ||
- "**/go.mod" | ||
- "**/go.sum" | ||
- ".golangi.yml" | ||
- ".github/workflows/golangci-lint.yml" | ||
- "!docs/**" | ||
env: | ||
# renovate: datasource=github-releases depName=golangci/golangci-lint | ||
GOLANGCI_LINT_VERSION: "v1.57.2" | ||
GO_VERSION: "~1.22" | ||
jobs: | ||
golangci-lint: | ||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
check-latest: true | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
working-directory: ./ | ||
version: ${{ env.GOLANGCI_LINT_VERSION }} | ||
args: --config ./.github/config/golangci.yml -v | ||
|
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,57 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
env: | ||
DEFAULT_GO_VERSION: "~1.22" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
unit-test: | ||
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.DEFAULT_GO_VERSION }} | ||
|
||
- name: Setup Environment | ||
run: | | ||
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | ||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | ||
- name: Module cache | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: go-mod-cache | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Make a build | ||
run: make build | ||
|
||
- name: Unit Test | ||
run: make unit-test | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
flags: unit-tests | ||
files: ./cover.out | ||
slug: dabump/pingreboot | ||
|