Skip to content

Commit

Permalink
install golangci-lint manually in nix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed Aug 27, 2024
1 parent 41bc141 commit 22e25aa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 49 deletions.
58 changes: 11 additions & 47 deletions .github/workflows/seth-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
permissions:
contents: read
jobs:
tools:
name: Get tool-versions
golangci:
defaults:
run:
working-directory: seth
name: lint
runs-on: ubuntu-latest
outputs:
golangci-lint-version: ${{ steps.tool-versions.outputs.golangci-lint_version }}
should_run: ${{ steps.changes.outputs.src }}
steps:
- name: Check out Code
- 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
Expand All @@ -20,47 +20,11 @@ jobs:
filters: |
src:
- 'seth/**'
- name: Parse tool-versions file
- uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
if: steps.changes.outputs.src == 'true'
uses: smartcontractkit/tool-versions-to-env-action@aabd5efbaf28005284e846c5cf3a02f2cba2f4c2 # v1.0.8
id: tool-versions

golangci:
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()
working-directory: seth
shell: bash
nix_path: nixpkgs=channel:nixos-unstable
- name: Run tests
if: steps.changes.outputs.src == 'true'
run: |
if test -f golangci-lint-report.xml; then
cat golangci-lint-report.xml
else
echo "No golangci-lint-report.xml file found"
fi
- 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
nix develop -c make lint
6 changes: 5 additions & 1 deletion seth/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pkgs.mkShell {
go
gopls
delve
golangci-lint
gotools
jq
];
Expand All @@ -17,5 +16,10 @@ pkgs.mkShell {
shellHook = ''
solc-select install 0.8.19
solc-select use 0.8.19
# setup go bin for nix
export GOBIN=$HOME/.nix-go/bin
mkdir -p $GOBIN
export PATH=$GOBIN:$PATH
go install github.com/golangci/golangci-lint/cmd/[email protected]
'';
}
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ mkShell' {
gotools
gopls
delve
golangci-lint
github-cli
jq
dasel
Expand Down Expand Up @@ -70,5 +69,6 @@ mkShell' {
export PATH=$GOBIN:$PATH
# install gotestloghelper
go install github.com/smartcontractkit/chainlink-testing-framework/tools/gotestloghelper@latest
go install github.com/golangci/golangci-lint/cmd/[email protected]
'';
}

0 comments on commit 22e25aa

Please sign in to comment.