Skip to content

Commit

Permalink
chore: upgrade golangci-lint to v1.42.0 and add cache (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
appleboy committed Aug 30, 2021
1 parent ed1c282 commit 8328b5a
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,34 @@ on:
- master

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: '^1.16'
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.42.0
args: --verbose
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go: [1.13, 1.14, 1.15, 1.16]
go: [1.13, 1.14, 1.15, 1.16, 1.17]
include:
- os: ubuntu-latest
go-build: ~/.cache/go-build
- os: macos-latest
go-build: ~/Library/Caches/go-build
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
env:
GO111MODULE: on
TESTTAGS: ${{ matrix.test-tags }}
GOPROXY: https://proxy.golang.org
steps:
- name: Set up Go ${{ matrix.go }}
Expand All @@ -31,12 +49,19 @@ jobs:
with:
ref: ${{ github.ref }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v2

- uses: actions/cache@v2
with:
path: |
${{ matrix.go-build }}
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Tests
run: |
go test -v -covermode=atomic -coverprofile=coverage.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v2
with:
flags: ${{ matrix.os }},go-${{ matrix.go }}

0 comments on commit 8328b5a

Please sign in to comment.