-
Notifications
You must be signed in to change notification settings - Fork 7
51 lines (51 loc) · 1.5 KB
/
golang.yaml
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
name: golang
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup-go
uses: actions/setup-go@v5
with:
go-version: 1.22
cache: true
cache-dependency-path: go.sum
- name: build
run: go build -v ./...
- name: test
run: go test -race ./...
lint:
# https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#annotations
permissions:
contents: read # read the repo
pull-requests: read # allows the 'only-new-issues' option to work
checks: write # annotate code in the PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup-go
uses: actions/setup-go@v5
with:
go-version: 1.22
cache: true
cache-dependency-path: go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v5
with:
install-mode: "binary"
version: "v1.57.1"
# https://github.com/golangci/golangci-lint-action/issues/244
# https://github.com/Kong/mesh-perf/pull/168
# https://github.com/golangci/golangci-lint-action/issues/552#issuecomment-1413509544
args: --timeout 10m
skip-cache: true
- name: go mod tidy
run: go mod tidy
- name: check for any changes
run: |
[[ $(git status --porcelain) == "" ]] || (echo "changes detected" && exit 1)