CI linting
This commit is contained in:
parent
7731d821ee
commit
174fbbbd81
|
@ -1,16 +1,27 @@
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on: push
|
||||||
push:
|
|
||||||
tags: [ "*" ]
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_REGISTRY: ghcr.io
|
DOCKER_REGISTRY: ghcr.io
|
||||||
DOCKER_USERNAME: ${{ github.actor }}
|
DOCKER_USERNAME: ${{ github.actor }}
|
||||||
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
||||||
DOCKER_IMAGE_NAME: ${{ github.repository }}
|
DOCKER_IMAGE_NAME: ${{ github.repository }}
|
||||||
|
GO_VERSION: '^1.17'
|
||||||
|
|
||||||
jobs:
|
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:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -18,7 +29,7 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '^1.17'
|
go-version: ${{ env.GO_VERSION }}
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: go test -race -cover -coverprofile cover.out ./...
|
run: go test -race -cover -coverprofile cover.out ./...
|
||||||
- name: Generage coverage report
|
- name: Generage coverage report
|
||||||
|
@ -30,7 +41,9 @@ jobs:
|
||||||
path: coverage.html
|
path: coverage.html
|
||||||
build-and-publish:
|
build-and-publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: test
|
needs:
|
||||||
|
- lint
|
||||||
|
- test
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue