| 1 |
name: Go |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [master] |
| 6 |
tags: ['v*'] |
| 7 |
pull_request: |
| 8 |
branches: ['*'] |
| 9 |
|
| 10 |
permissions: |
| 11 |
contents: read |
| 12 |
|
| 13 |
jobs: |
| 14 |
|
| 15 |
build: |
| 16 |
runs-on: ubuntu-latest |
| 17 |
strategy: |
| 18 |
matrix: |
| 19 |
go: ["1.21.x", "1.22.x"] |
| 20 |
include: |
| 21 |
- go: 1.22.x |
| 22 |
|
| 23 |
steps: |
| 24 |
- name: Checkout code |
| 25 |
uses: actions/checkout@v4 |
| 26 |
|
| 27 |
- name: Setup Go |
| 28 |
uses: actions/setup-go@v4 |
| 29 |
with: |
| 30 |
go-version: ${{ matrix.go }} |
| 31 |
cache-dependency-path: '**/go.sum' |
| 32 |
|
| 33 |
- name: Download Dependencies |
| 34 |
run: | |
| 35 |
go mod download |
| 36 |
(cd tools && go mod download) |
| 37 |
(cd benchmarks && go mod download) |
| 38 |
(cd zapgrpc/internal/test && go mod download) |
| 39 |
|
| 40 |
- name: Test |
| 41 |
run: make cover |
| 42 |
|
| 43 |
- name: Upload coverage to codecov.io |
| 44 |
uses: codecov/codecov-action@v3 |
| 45 |
|
| 46 |
lint: |
| 47 |
name: Lint |
| 48 |
runs-on: ubuntu-latest |
| 49 |
|
| 50 |
steps: |
| 51 |
- uses: actions/checkout@v4 |
| 52 |
name: Check out repository |
| 53 |
- uses: actions/setup-go@v4 |
| 54 |
name: Set up Go |
| 55 |
with: |
| 56 |
go-version: 1.22.x |
| 57 |
cache: false # managed by golangci-lint |
| 58 |
|
| 59 |
- uses: golangci/golangci-lint-action@v4 |
| 60 |
name: Install golangci-lint |
| 61 |
with: |
| 62 |
version: latest |
| 63 |
args: --version # make lint will run the linter |
| 64 |
|
| 65 |
- run: make lint |
| 66 |
name: Lint |
| 67 |
|
| 68 |
- name: vulncheck |
| 69 |
run: make vulncheck |