From 326ef3f931f78be8e461add41d851384c5f4cb2f Mon Sep 17 00:00:00 2001 From: dreamer Date: Tue, 2 Jul 2024 09:29:16 +0800 Subject: [PATCH] add lint workflow --- .github/workflows/lint.yml | 49 +++++++++++++++++++++++++++++++++++++ .github/workflows/sims.yaml | 37 ---------------------------- modules/htlc/go.mod | 2 +- simapp/go.mod | 2 +- 4 files changed, 51 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/sims.yaml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..db398b30 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,49 @@ +name: Lint +on: + push: + branches: + - main + - release/** + pull_request: + merge_group: +permissions: + contents: read +jobs: + golangci: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - uses: actions/setup-go@v3 + with: + go-version: "1.19" + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + Makefile + **/Makefile + .golangci.yml + - name: run linting (long) + if: env.GIT_DIFF + id: lint_long + run: | + nix develop -c make lint + env: + NIX: 1 + - uses: technote-space/get-diff-action@v6.1.2 + if: steps.lint_long.outcome == 'skipped' + with: + PATTERNS: | + **/*.go + *.go + - name: run linting (short) + if: steps.lint_long.outcome == 'skipped' && env.GIT_DIFF + run: | + nix develop -c make lint + env: + GIT_DIFF: ${{ env.GIT_DIFF }} + LINT_DIFF: 1 + NIX: 1 \ No newline at end of file diff --git a/.github/workflows/sims.yaml b/.github/workflows/sims.yaml deleted file mode 100644 index 1c729db1..00000000 --- a/.github/workflows/sims.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# name: Simulation Test -# on: [pull_request] - -# jobs: -# test-sim-nondeterminism-fast: -# name: Test AppStateDeterminism -# runs-on: ubuntu-latest -# steps: -# - name: Checkout source code -# uses: actions/checkout@v3 -# - name: Setup go -# uses: actions/setup-go@v3 -# with: -# go-version: '^1.19' # The Go version to download (if necessary) and use. -# - run: make test-sim-nondeterminism-fast - # test-sim-import-export: - # name: Test AppImportExport - # runs-on: ubuntu-latest - # steps: - # - name: Checkout source code - # uses: actions/checkout@v3 - # - name: Setup go - # uses: actions/setup-go@v3 - # with: - # go-version: '^1.19' # The Go version to download (if necessary) and use. - # - run: make test-sim-import-export - # test-sim-after-import: - # name: Test AppSimulationAfterImport - # runs-on: ubuntu-latest - # steps: - # - name: Checkout source code - # uses: actions/checkout@v3 - # - name: Setup go - # uses: actions/setup-go@v3 - # with: - # go-version: '^1.19' # The Go version to download (if necessary) and use. - # - run: make test-sim-after-import \ No newline at end of file diff --git a/modules/htlc/go.mod b/modules/htlc/go.mod index db8cfe2c..fe0cda3e 100644 --- a/modules/htlc/go.mod +++ b/modules/htlc/go.mod @@ -7,6 +7,7 @@ require ( cosmossdk.io/core v0.5.1 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.1 + cosmossdk.io/math v1.2.0 github.com/cometbft/cometbft v0.37.4 github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.47.9 @@ -32,7 +33,6 @@ require ( cloud.google.com/go/iam v1.1.5 // indirect cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/log v1.3.1 // indirect - cosmossdk.io/math v1.2.0 // indirect cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect diff --git a/simapp/go.mod b/simapp/go.mod index 1f0d11ea..bbc02a7f 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -4,6 +4,7 @@ go 1.19 require ( cosmossdk.io/depinject v1.0.0-alpha.4 + cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.2.0 github.com/cometbft/cometbft v0.37.4 github.com/cometbft/cometbft-db v0.7.0 @@ -21,7 +22,6 @@ require ( cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/core v0.5.1 // indirect - cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/log v1.3.1 // indirect cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect