diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4769713..a5e12f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..ba595e6 --- /dev/null +++ b/.golangci.yml @@ -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