-
Notifications
You must be signed in to change notification settings - Fork 8
67 lines (65 loc) · 1.84 KB
/
main.yml
File metadata and controls
67 lines (65 loc) · 1.84 KB
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: lint and test
on:
push:
branches:
- master
- main
- release-*
pull_request:
branches:
- master
- main
- release-*
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.45.2
unittest:
name: Test in ${{ matrix.target_os }}_${{ matrix.target_arch }} with Go_${{ matrix.go }}
runs-on: ${{ matrix.os }}
needs: [lint]
env:
GOOS: ${{ matrix.target_os }}
GOARCH: ${{ matrix.target_arch }}
GOPROXY: https://proxy.golang.org
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
go: [1.17]
target_arch: [amd64]
include:
- os: ubuntu-latest
target_os: linux
- os: windows-latest
target_os: windows
- os: macOS-latest
target_os: darwin
fail-fast: false
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2.1.4
with:
go-version: ${{ matrix.go }}
- name: Check out code
uses: actions/checkout@v2
- name: Run make go.mod check-diff
if: matrix.target_os == 'linux'
run: git diff --exit-code ./go.mod
- name: run test in widnows
if: matrix.target_os == 'windows'
run: go test -v -cover -gcflags=all=-l .\...
- name: run tests
if: matrix.target_os != 'windows'
run: go test -v -cover -gcflags=all=-l -coverprofile=coverage.out ./...
- name: Upload coverage to Codecov
if: matrix.target_os == 'linux'
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.out