| 1 |
name: Go |
| 2 |
on: |
| 3 |
push: |
| 4 |
tags: |
| 5 |
- v* |
| 6 |
branches: |
| 7 |
- master |
| 8 |
paths: |
| 9 |
- '**.go' |
| 10 |
- ".goreleaser.yml" |
| 11 |
- ".golangci.yml" |
| 12 |
- ".dockerignore" |
| 13 |
- "Makefile" |
| 14 |
- "rules.mk" |
| 15 |
- "go.*" |
| 16 |
- ".github/workflows/go.yml" |
| 17 |
pull_request: |
| 18 |
paths: |
| 19 |
- '**.go' |
| 20 |
- ".goreleaser.yml" |
| 21 |
- ".golangci.yml" |
| 22 |
- ".dockerignore" |
| 23 |
- "Makefile" |
| 24 |
- "rules.mk" |
| 25 |
- "go.*" |
| 26 |
- ".github/workflows/go.yml" |
| 27 |
|
| 28 |
jobs: |
| 29 |
golangci-lint: |
| 30 |
runs-on: ubuntu-latest |
| 31 |
steps: |
| 32 |
- uses: actions/checkout@v3 |
| 33 |
- name: golangci-lint |
| 34 |
uses: golangci/[email protected] |
| 35 |
with: |
| 36 |
version: v1.38 |
| 37 |
|
| 38 |
args: --timeout=2m |
| 39 |
only-new-issues: false |
| 40 |
working-directory: . |
| 41 |
tests-on-windows: |
| 42 |
needs: golangci-lint |
| 43 |
runs-on: windows-latest |
| 44 |
strategy: |
| 45 |
matrix: |
| 46 |
golang: |
| 47 |
- 1.16.x |
| 48 |
steps: |
| 49 |
- uses: actions/checkout@v3 |
| 50 |
- name: Install Go |
| 51 |
uses: actions/setup-go@v2 |
| 52 |
with: |
| 53 |
go-version: ${{ matrix.golang }} |
| 54 |
- name: Run tests on Windows |
| 55 |
run: make.exe unittest |
| 56 |
continue-on-error: true |
| 57 |
tests-on-mac: |
| 58 |
needs: golangci-lint |
| 59 |
runs-on: macos-latest |
| 60 |
strategy: |
| 61 |
matrix: |
| 62 |
golang: |
| 63 |
- 1.16.x |
| 64 |
env: |
| 65 |
OS: macos-latest |
| 66 |
GOLANG: ${{ matrix.golang }} |
| 67 |
steps: |
| 68 |
- uses: actions/checkout@v3 |
| 69 |
- name: Install Go |
| 70 |
uses: actions/setup-go@v2 |
| 71 |
with: |
| 72 |
go-version: ${{ matrix.golang }} |
| 73 |
- uses: actions/[email protected] |
| 74 |
with: |
| 75 |
path: ~/go/pkg/mod |
| 76 |
key: ${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }} |
| 77 |
restore-keys: | |
| 78 |
${{ runner.os }}-go-${{ matrix.golang }}- |
| 79 |
- name: Run tests on Unix-like operating systems |
| 80 |
run: make unittest |
| 81 |
- name: Check go.mod and go.sum |
| 82 |
run: | |
| 83 |
go mod tidy -v |
| 84 |
git --no-pager diff go.mod go.sum |
| 85 |
git --no-pager diff --quiet go.mod go.sum |
| 86 |
- name: Upload coverage to Codecov |
| 87 |
uses: codecov/[email protected] |
| 88 |
with: |
| 89 |
|
| 90 |
file: ./coverage.txt |
| 91 |
flags: unittests |
| 92 |
env_vars: OS,GOLANG |
| 93 |
name: codecov-umbrella |
| 94 |
fail_ci_if_error: false |
| 95 |
tests-on-linux: |
| 96 |
needs: golangci-lint |
| 97 |
runs-on: ubuntu-latest |
| 98 |
strategy: |
| 99 |
matrix: |
| 100 |
golang: |
| 101 |
- 1.14.x |
| 102 |
- 1.15.x |
| 103 |
- 1.16.x |
| 104 |
env: |
| 105 |
OS: ubuntu-latest |
| 106 |
GOLANG: ${{ matrix.golang }} |
| 107 |
steps: |
| 108 |
- uses: actions/checkout@v3 |
| 109 |
- name: Install Go |
| 110 |
uses: actions/setup-go@v2 |
| 111 |
with: |
| 112 |
go-version: ${{ matrix.golang }} |
| 113 |
- uses: actions/[email protected] |
| 114 |
with: |
| 115 |
path: ~/go/pkg/mod |
| 116 |
key: ${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }} |
| 117 |
restore-keys: | |
| 118 |
${{ runner.os }}-go-${{ matrix.golang }}- |
| 119 |
- name: Check go.mod and go.sum |
| 120 |
run: | |
| 121 |
go mod tidy -v |
| 122 |
git --no-pager diff go.mod go.sum |
| 123 |
git --no-pager diff --quiet go.mod go.sum |
| 124 |
- name: Run tests on Unix-like operating systems |
| 125 |
run: make unittest |
| 126 |
- name: Upload coverage to Codecov |
| 127 |
uses: codecov/[email protected] |
| 128 |
with: |
| 129 |
|
| 130 |
file: ./coverage.txt |
| 131 |
flags: unittests |
| 132 |
env_vars: OS,GOLANG |
| 133 |
name: codecov-umbrella |
| 134 |
fail_ci_if_error: false |