-
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (51 loc) · 1.62 KB
/
code-analysis.yml
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
name: Code Analysis & Tests
on:
workflow_dispatch:
pull_request:
branches:
- develop
- main
jobs:
lint:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
go-version: ["1.19.x", "1.x"]
name: Lint (${{ matrix.os }}/${{ matrix.go-version }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true # caching and restoring go modules and build outputs.
- run: echo "GOVERSION=$(go version)" >> $GITHUB_ENV
- name: Lint
uses: reviewdog/action-golangci-lint@v2
with: # https://github.com/reviewdog/action-golangci-lint#inputs
go_version_file: "go.mod"
workdir: ./
golangci_lint_flags: "--config=./.golangci.yaml --verbose --new-from-rev=${{ github.event.pull_request.base.sha }}"
fail_on_error: true
test:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
go-version: ["1.19.x", "1.x"]
name: Test (${{ matrix.os }}/${{ matrix.go-version }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true # caching and restoring go modules and build outputs.
- run: echo "GOVERSION=$(go version)" >> $GITHUB_ENV
- name: Test
run: go test ./...