-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.46 KB
/
ci.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
49
50
51
52
53
54
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
test:
strategy:
matrix:
go-version: [1.18.x, 1.19.x, tip]
lint-and-coverage: [false]
include:
- go-version: 1.20.x
lint-and-coverage: true
runs-on: ubuntu-latest
steps:
- name: Setup go
run: |
curl -sL https://raw.githubusercontent.com/maxatome/install-go/v3.4/install-go.pl |
perl - ${{ matrix.go-version }} $HOME/go
- name: Checkout code
uses: actions/checkout@v2
- name: Linting
if: matrix.lint-and-coverage
run: |
curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh |
sh -s -- -b $HOME/go/bin v1.52.2
$HOME/go/bin/golangci-lint run ./...
- name: Testing
continue-on-error: ${{ matrix.go-version == 'tip' }}
run: |
go version
if [ ${{ matrix.lint-and-coverage }} = true ]; then
GO_TEST_OPTS="-covermode=atomic -coverprofile=coverage.out"
fi
export GORACE="halt_on_error=1"
go test -race $GO_TEST_OPTS ./...
- name: Reporting coverage
if: matrix.lint-and-coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go install github.com/mattn/[email protected]
goveralls -coverprofile=coverage.out -service=github