48 lines (45 loc) · 1.26 KB
/
ci-go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Continuous integration handling for Go
name: ci-go
on:
pull_request:
paths:
- .github/workflows/test.yml
- .golangci.yml
- .go-version
- go.mod
- '**.go'
permissions:
contents: read
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: go-version
# Reference: https://github.com/actions/setup-go/issues/23
run: echo "::set-output name=version::$(cat ./.go-version)"
- uses: actions/setup-go@v3
with:
go-version: ${{ steps.go-version.outputs.version }}
- run: go mod download
- uses: golangci/golangci-lint-action@v3.1.0
with:
skip-go-installation: true
test:
name: test (Go v${{ matrix.go-version }})
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.18', '1.17' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- run: go mod download
- run: go test -coverprofile=coverage.out ./...
- run: go tool cover -html=coverage.out -o coverage.html
- uses: actions/upload-artifact@v3
with:
name: go-${{ matrix.go-version }}-coverage
path: coverage.html