...
1---
2name: Go workflow
3on:
4 push:
5 branches:
6 - "*"
7 - "*/*"
8 - "**"
9 - "!main"
10permissions:
11 contents: read
12
13jobs:
14 lint:
15 name: lint
16 runs-on: ubuntu-latest
17 steps:
18 - uses: actions/checkout@master
19 - uses: actions/setup-go@v3
20 with:
21 go-version: 1.18
22
23 - name: golangci-lint
24 uses: golangci/golangci-lint-action@v3
25 with:
26 version: v1.46
27 args: --timeout 5m
28
29 test:
30 name: Test Go ${{ matrix.go }} on ${{ matrix.os }}
31 runs-on: ${{ matrix.os }}
32 strategy:
33 matrix:
34 os: [ubuntu-latest, windows-latest, macos-latest]
35 go: ["1.13", "1.14", "1.15", "1.16", "1.17", "1.18"]
36 steps:
37 - name: Go ${{ matrix.go }}
38 uses: actions/setup-go@v3
39 with:
40 go-version: ${{ matrix.go }}
41 - name: Checkout source code
42 uses: actions/checkout@master
43 - name: Get dependencies
44 run: go get -t -v
45 - name: Run test
46 if: matrix.os == 'windows-latest'
47 run: go test -v
48 - name: Run test coverage
49 if: matrix.os != 'windows-latest'
50 run: go test -v -coverprofile=coverage.out -covermode=count
51 - name: Publish coverage
52 if: matrix.os != 'windows-latest'
53 env:
54 CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
55 run: bash <(curl -s https://codecov.io/bash)
View as plain text