From d00c86f00025cf27cf427ae17c8c74cbf8b38e67 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 11 Dec 2023 21:02:49 +0700 Subject: [PATCH 1/3] add some automatic ci aids --- .github/dependabot.yml | 17 ++++++ .github/workflows/go.yml | 4 +- .golangci.yml | 129 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .golangci.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..9cc7b151 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +# `dependabot.yml` file with updates +# disabled for Docker and limited for npm + +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + + diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f16837c3..2d874b63 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: "1.21" - name: Build run: make build @@ -28,7 +28,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: "1.21" - name: Test run: make test \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..0c3f7535 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,129 @@ +run: + tests: true + timeout: 10m + +linters: + disable-all: true + enable: + - exportloopref + - errcheck + - gci + - goconst + - gocritic + - gofumpt + - gosec + - gosimple + - govet + - ineffassign + - misspell + - nakedret + - staticcheck + - thelper + - typecheck +# - stylecheck + - revive + - typecheck + - tenv + - unconvert + - unparam + - unused + - misspell + + +issues: + exclude-rules: + - text: 'differs only by capitalization to method' + linters: + - revive + - text: 'Use of weak random number generator' + linters: + - gosec + - linters: + - staticcheck + text: "SA1019:" # silence errors on usage of deprecated funcs + + max-issues-per-linter: 10000 + max-same-issues: 10000 + +linters-settings: + gci: + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + - blank # blank imports + - dot # dot imports + - prefix(cosmossdk.io) + - prefix(github.com/cosmos/cosmos-sdk) + - prefix(github.com/cometbft/cometbft) + - prefix(github.com/cosmos/ibc-go) + - prefix(github.com/CudoVentures/cudos-node) + custom-order: true + gocritic: + disabled-checks: + - appendAssign + + revive: + enable-all-rules: true + # Do NOT whine about the following, full explanation found in: + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#description-of-available-rules + rules: + - name: use-any + disabled: true + - name: if-return + disabled: true + - name: max-public-structs + disabled: true + - name: cognitive-complexity + disabled: true + - name: argument-limit + disabled: true + - name: cyclomatic + disabled: true + - name: file-header + disabled: true + - name: function-length + disabled: true + - name: function-result-limit + disabled: true + - name: line-length-limit + disabled: true + - name: flag-parameter + disabled: true + - name: import-shadowing + disabled: true + - name: add-constant + disabled: true + - name: empty-lines + disabled: true + - name: banned-characters + disabled: true + - name: deep-exit + disabled: true + - name: unchecked-type-assertion + disabled: true + - name: confusing-results + disabled: true + - name: unused-parameter + disabled: true + - name: modifies-value-receiver + disabled: true + - name: var-naming + disabled: true + - name: early-return + disabled: true + - name: var-naming + disabled: true + - name: confusing-naming + disabled: true + - name: defer + disabled: true + # Disabled in favour of unparam. + - name: unused-parameter + disabled: true + - name: unhandled-error + disabled: false + arguments: + - 'fmt.Printf' + - 'fmt.Print' + - 'fmt.Println' + - 'myFunction' \ No newline at end of file From ee3ab8f84a0369970e75d58076870cbd722cafdd Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 11 Dec 2023 21:16:20 +0700 Subject: [PATCH 2/3] Update and rename go.yml to test.yml --- .github/workflows/go.yml | 34 ---------------------------------- .github/workflows/test.yml | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 2d874b63..00000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: CI - -on: - push: - branches: [ $default-branch ] - pull_request: - -jobs: - - Build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: "1.21" - - - name: Build - run: make build - - Test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: "1.21" - - - name: Test - run: make test \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..cecd3a0e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,15 @@ +on: [push, pull_request] +name: Test +jobs: + test: + strategy: + matrix: + go-version: [1.20.x, 1.21.x] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + - run: go test ./... From 870e08c5ec16a379ec15a2a3241a9e4ef5f1a97e Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 11 Dec 2023 21:17:14 +0700 Subject: [PATCH 3/3] Create build.yml --- .github/workflows/build.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..ec8c5fec --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,15 @@ +on: [push, pull_request] +name: Test +jobs: + test: + strategy: + matrix: + go-version: [1.20.x, 1.21.x] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + - run: go build ./...