CI linting

This commit is contained in:
Kirill Fedoseev 2022-05-22 16:28:52 +04:00
parent 7731d821ee
commit 174fbbbd81
2 changed files with 53 additions and 5 deletions

View File

@ -1,16 +1,27 @@
name: CI
on:
push:
tags: [ "*" ]
on: push
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
DOCKER_IMAGE_NAME: ${{ github.repository }}
GO_VERSION: '^1.17'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.46.2
test:
runs-on: ubuntu-latest
steps:
@ -18,7 +29,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.17'
go-version: ${{ env.GO_VERSION }}
- name: Run tests
run: go test -race -cover -coverprofile cover.out ./...
- name: Generage coverage report
@ -30,7 +41,9 @@ jobs:
path: coverage.html
build-and-publish:
runs-on: ubuntu-latest
needs: test
needs:
- lint
- test
steps:
- name: Checkout repository
uses: actions/checkout@v3

35
.golangci.yml Normal file
View File

@ -0,0 +1,35 @@
run:
concurrency: 4
timeout: 5m
go: '1.17'
linters:
enable-all: true
disable:
- dupl
- wrapcheck
- tagliatelle
- gomnd
- varnamelen
- nlreturn
- gochecknoglobals
- lll
- goerr113
- ireturn
- exhaustivestruct
- exhaustruct
- cyclop
- wsl
- nestif
- gocognit
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/poanetwork/tokenbridge-monitor)
gocritic:
disabled-checks:
- ifElseChain
funlen:
lines: 130
statements: 60