From e80be966110de281d8453c9b77c972993b4a2f3d Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 27 Aug 2024 14:10:19 +0200 Subject: [PATCH] change Seth lint to use action --- .github/workflows/seth-lint.yml | 55 +++++++++++++++++++++++++++------ seth/.golangci.yml | 2 +- seth/contract_store.go | 2 -- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/.github/workflows/seth-lint.yml b/.github/workflows/seth-lint.yml index 943eebee0..db3ee68a9 100644 --- a/.github/workflows/seth-lint.yml +++ b/.github/workflows/seth-lint.yml @@ -4,15 +4,16 @@ on: permissions: contents: read jobs: - golangci: + tools: defaults: run: working-directory: seth - name: lint + name: Get tool-versions runs-on: ubuntu-latest + outputs: + golangci-lint-version: ${{ steps.tool-versions.outputs.golangci-lint_version }} + should_run: ${{ steps.changes.outputs.src }} steps: - - name: Checkout repo - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - name: Check for changes in Seth project uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes @@ -20,11 +21,45 @@ jobs: filters: | src: - 'seth/**' - - uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26 + - name: Check out Code + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 if: steps.changes.outputs.src == 'true' - with: - nix_path: nixpkgs=channel:nixos-unstable - - name: Run lints + - name: Parse tool-versions file if: steps.changes.outputs.src == 'true' - run: | - nix develop -c make lint + uses: smartcontractkit/tool-versions-to-env-action@aabd5efbaf28005284e846c5cf3a02f2cba2f4c2 # v1.0.8 + id: tool-versions + + golangci: + defaults: + run: + working-directory: seth + name: Linting Seth + if: needs.tools.outputs.should_run == 'true' + runs-on: ubuntu-latest + needs: [tools] + steps: + - name: Check out Code + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + - name: Install Go + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@e29366cdecfe6befff9ab8c3cfe4825218505d58 # v2.3.16 + with: + test_download_vendor_packages_command: cd seth && go mod download + go_mod_path: seth/go.mod + cache_key_id: ctf-go-seth + cache_restore_only: 'false' + - name: golangci-lint ${{ needs.tools.outputs.golangci-lint-version }} + uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc # v5.1.0 + with: + version: v${{ needs.tools.outputs.golangci-lint-version }} + args: --out-format checkstyle:golangci-lint-report.xml + skip-cache: true + working-directory: seth + - name: Print lint report artifact + if: always() + run: test -f seth/}golangci-lint-report.xml || true + - name: Store lint report artifact + if: always() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: golangci-lint-report-seth + path: seth/golangci-lint-report.xml diff --git a/seth/.golangci.yml b/seth/.golangci.yml index f15eb765c..40c1198ce 100644 --- a/seth/.golangci.yml +++ b/seth/.golangci.yml @@ -24,7 +24,7 @@ linters-settings: exhaustive: default-signifies-exhaustive: true goimports: - local-prefixes: github.com/smartcontractkit/chainlink-testing-framework + local-prefixes: github.com/smartcontractkit/chainlink-testing-framework/seth gosec: exclude-generated: true govet: diff --git a/seth/contract_store.go b/seth/contract_store.go index 1bae18a41..5a0428ca8 100644 --- a/seth/contract_store.go +++ b/seth/contract_store.go @@ -202,8 +202,6 @@ func extractABIFromGethWrapperDir(filePath string) (string, *abi.ABI, error) { return "", nil, err } - const metaDataSuffix = "MetaData" - var abiContent string // use package name as contract name contractName := node.Name.Name