-
-
Notifications
You must be signed in to change notification settings - Fork 23
67 lines (62 loc) · 1.78 KB
/
main.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
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Build
on:
push:
tags:
- v*
branches:
- master
pull_request:
branches:
- master
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
with:
version: v1.56.2
args: -v
test:
strategy:
matrix:
go-version: [ '1.16.x', '1.17.x', '1.18.x', '1.19.x', '1.20.x' , '1.21.x' , '1.22.x' ]
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go-version }} on ${{ matrix.os }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
run: go test -json -race ./... > TestResults-${{ matrix.os }}-${{ matrix.go-version }}.json
- name: Upload Go test results
uses: actions/upload-artifact@v3
with:
name: Go-results-${{ matrix.os }}-${{ matrix.go-version }}
path: TestResults-${{ matrix.os }}-${{ matrix.go-version }}.json
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Go 1.22.x on ubuntu-latest
uses: actions/setup-go@v3
with:
go-version: '1.22.x'
- name: Setup Dependencies
run: |
go get golang.org/x/tools/cmd/cover
go get -t -v ./...
- name: Run Tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.txt
flags: unittests
fail_ci_if_error: true
verbose: true