From 290fc63869d3430190a4ffc4477c43e69a596c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jer=C3=B3nimo=20Albi?= Date: Wed, 18 Oct 2023 12:36:11 +0200 Subject: [PATCH 1/2] ci: fix integration tests and lint workflows (#3700) * ci: fix integration tests and lint workflows * fix: lint issues --- .github/workflows/test-integration.yml | 17 ++++++----------- .github/workflows/test-lint.yml | 3 +++ ignite/pkg/cache/cache.go | 2 +- ignite/pkg/cosmosanalysis/app/app.go | 10 +++++----- ignite/pkg/placeholder/error.go | 5 +++-- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index c67925cc50..7092742213 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -42,22 +42,17 @@ jobs: go.sum **/testdata/** - - uses: actions/cache@v3 - if: env.GIT_DIFF - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - uses: actions/setup-go@v4 if: env.GIT_DIFF with: - go-version: '1.21' + go-version: 'stable' + - name: Run Integration Tests if: env.GIT_DIFF - run: GOSUMDB=off go test -v -timeout 120m ./integration/${{ matrix.test-path }} + env: + GOTOOLCHAIN: local+path + GOSUMDB: off + run: go test -v -timeout 120m ./integration/${{ matrix.test-path }} status: runs-on: ubuntu-latest diff --git a/.github/workflows/test-lint.yml b/.github/workflows/test-lint.yml index 46cc7973c2..58c3d30fbb 100644 --- a/.github/workflows/test-lint.yml +++ b/.github/workflows/test-lint.yml @@ -24,10 +24,13 @@ jobs: **/*.go go.mod go.sum + - uses: actions/setup-go@v4 if: env.GIT_DIFF with: go-version-file: go.mod + cache: false + - uses: golangci/golangci-lint-action@v3 if: env.GIT_DIFF with: diff --git a/ignite/pkg/cache/cache.go b/ignite/pkg/cache/cache.go index 061818ed5c..ad115d7888 100644 --- a/ignite/pkg/cache/cache.go +++ b/ignite/pkg/cache/cache.go @@ -94,7 +94,7 @@ func (c Cache[T]) Put(key string, value T) error { func (c Cache[T]) Get(key string) (val T, err error) { db, err := openDB(c.storage.storagePath) if err != nil { - return + return val, err } defer db.Close() diff --git a/ignite/pkg/cosmosanalysis/app/app.go b/ignite/pkg/cosmosanalysis/app/app.go index b240fe86da..77b956aeea 100644 --- a/ignite/pkg/cosmosanalysis/app/app.go +++ b/ignite/pkg/cosmosanalysis/app/app.go @@ -220,25 +220,25 @@ func newUnexpectedTypeErr(n any) error { func findBasicManagerRegistrations(n ast.Node, pkgDir string, fileImports map[string]string) (packages []string, err error) { callExprType, ok := n.(*ast.CallExpr) if !ok { - return + return packages, err } selectorExprType, ok := callExprType.Fun.(*ast.SelectorExpr) if !ok { - return + return packages, err } identExprType, ok := selectorExprType.X.(*ast.Ident) if !ok { - return + return packages, err } basicModulePkgName := findBasicManagerPkgName(fileImports) if basicModulePkgName == "" { // cosmos-sdk/types/module is not imported in this file, skip - return + return packages, err } if identExprType.Name != basicModulePkgName || selectorExprType.Sel.Name != "NewBasicManager" { - return + return packages, err } // Node "n" defines the call to NewBasicManager, let's loop on its args to discover modules diff --git a/ignite/pkg/placeholder/error.go b/ignite/pkg/placeholder/error.go index a649d95a12..a2fe398a42 100644 --- a/ignite/pkg/placeholder/error.go +++ b/ignite/pkg/placeholder/error.go @@ -1,6 +1,7 @@ package placeholder import ( + "errors" "fmt" "strings" @@ -18,8 +19,8 @@ type MissingPlaceholdersError struct { // Is true if both errors have the same list of missing placeholders. func (e *MissingPlaceholdersError) Is(err error) bool { - other, ok := err.(*MissingPlaceholdersError) //nolint:errorlint - if !ok { + var other *MissingPlaceholdersError + if !errors.As(err, &other) { return false } if len(other.missing) != len(e.missing) { From 4739fafdd31fb3f6d214a2f5ee3f471629924372 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Wed, 18 Oct 2023 13:01:30 +0200 Subject: [PATCH 2/2] chore: bump go version to 1.21 (#3701) * bum go version to 1.21 * add changelog --------- Co-authored-by: Pantani --- changelog.md | 1 + ignite/services/plugin/template/go.mod.plush | 2 +- ignite/templates/app/files/go.mod.plush | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 6ddc00384f..4f37f2dcc0 100644 --- a/changelog.md +++ b/changelog.md @@ -11,6 +11,7 @@ ### Changes +- [#3701](https://github.com/ignite/cli/pull/3701) Bump `go` version to 1.21 - [#3621](https://github.com/ignite/cli/pull/3621) Change `pkg/availableport` to allow custom parameters in `Find` function and handle duplicated ports - [#3559](https://github.com/ignite/cli/pull/3559) Bump network plugin version to `v0.1.1` - [#3581](https://github.com/ignite/cli/pull/3581) Bump cometbft and cometbft-db in the template diff --git a/ignite/services/plugin/template/go.mod.plush b/ignite/services/plugin/template/go.mod.plush index 6f4603f0e0..fe8fffd05b 100644 --- a/ignite/services/plugin/template/go.mod.plush +++ b/ignite/services/plugin/template/go.mod.plush @@ -1,6 +1,6 @@ module <%= ModuleName %> -go 1.20 +go 1.21 require ( github.com/hashicorp/go-plugin v1.4.9 diff --git a/ignite/templates/app/files/go.mod.plush b/ignite/templates/app/files/go.mod.plush index 64f04e084f..578f6def14 100644 --- a/ignite/templates/app/files/go.mod.plush +++ b/ignite/templates/app/files/go.mod.plush @@ -1,6 +1,6 @@ module <%= ModulePath %> -go 1.20 +go 1.21 require ( cosmossdk.io/api v0.3.1