add .golangci.yml #56
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- master | |
- main | |
pull_request: | |
jobs: | |
unit-tests: | |
name: unit-tests | |
strategy: | |
matrix: | |
go-version: [ 1.21.x, 1.22.x ] # support latest 2 major versions | |
os: [ ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Download deps | |
run: go mod download | |
- name: Test | |
run: make test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.txt | |
fail_ci_if_error: true | |
lint: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./go.mod | |
cache: true # caching and restoring go modules and build outputs | |
- name: Check that 'go mod tidy' was called before commit | |
run: go mod tidy && git diff --exit-code | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: v1.56 | |
skip-cache: true # cache/restore is done by actions/setup-go step |