Skip to content

Commit

Permalink
github action: use lint.sh in CI (ava-labs#1050)
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho authored Jan 3, 2022
1 parent 6648e82 commit 601a230
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Full Lint
name: Static analysis
on:
push:
tags-ignore:
Expand All @@ -8,14 +8,16 @@ on:
- dev

jobs:
run_lint:
name: lint
run_static_analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
- name: Checkout
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
version: v1.43.0
working-directory: .
args: --timeout 10m --config .golangci.yml
go-version: 1.17
- name: Run static analysis tests
shell: bash
run: scripts/lint.sh
9 changes: 7 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# https://golangci-lint.run/usage/configuration/
run:
timeout: 10m
# skip auto-generated files.
skip-files:
- ".*\\.pb\\.go$"

issues:
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true

enable:
- asciicheck
- bodyclose
Expand Down Expand Up @@ -36,11 +41,11 @@ linters:
- unconvert
- whitespace
- staticcheck
# - structcheck
# - lll
# - gomnd
# - goprintffuncname
# - interfacer
# - structcheck
# - typecheck
# - goerr113
# - noctx
Expand Down
3 changes: 2 additions & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ fi
TESTS=${TESTS:-"golangci_lint license_header"}

function test_golangci_lint {
golangci-lint run --max-same-issues=0 --timeout=2m
go install -v github.com/golangci/golangci-lint/cmd/[email protected]
golangci-lint run --config .golangci.yml
}

# find_go_files [package]
Expand Down

0 comments on commit 601a230

Please sign in to comment.