...
1name: Go
2on:
3 push:
4 branches: [ main ]
5 paths:
6 - '**.go'
7 - 'go.mod'
8 - '.golangci.yml'
9 - '.github/workflows/go.yml'
10 pull_request:
11 paths:
12 - '**.go'
13 - 'go.mod'
14 - '.golangci.yml'
15 - '.github/workflows/go.yml'
16env:
17 GOPROXY: "https://proxy.golang.org"
18
19jobs:
20 lint:
21 name: Lint
22 runs-on: ubuntu-latest
23 steps:
24 - name: Checkout code
25 uses: actions/checkout@v2
26 - name: Init Go Modules
27 run: |
28 go mod init github.com/go-ini/ini
29 go mod tidy
30 - name: Run golangci-lint
31 uses: golangci/golangci-lint-action@v2
32 with:
33 version: latest
34 args: --timeout=30m
35 skip-pkg-cache: true # Wrokaround of the "tar" problem: https://github.com/golangci/golangci-lint-action/issues/244
36
37 test:
38 name: Test
39 strategy:
40 matrix:
41 go-version: [ 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x ]
42 platform: [ ubuntu-latest, macos-latest, windows-latest ]
43 runs-on: ${{ matrix.platform }}
44 steps:
45 - name: Install Go
46 uses: actions/setup-go@v2
47 with:
48 go-version: ${{ matrix.go-version }}
49 - name: Checkout code
50 uses: actions/checkout@v2
51 - name: Run tests with coverage
52 run: |
53 go mod init github.com/go-ini/ini
54 go mod tidy
55 go test -v -race -coverprofile=coverage -covermode=atomic ./...
56 - name: Upload coverage report to Codecov
57 uses: codecov/codecov-action@v1.5.0
58 with:
59 file: ./coverage
60 flags: unittests
View as plain text