-
Notifications
You must be signed in to change notification settings - Fork 2
63 lines (51 loc) · 1.29 KB
/
go.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
52
53
54
55
56
57
58
59
60
61
62
63
name: Go CI
on:
push:
branches:
- main
paths:
- go/**
pull_request:
branches:
- main
paths:
- go/**
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: go
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go/go.mod'
cache: true
- name: Display Go version
run: go version
- name: Pull in all Go dependencies
run: go mod vendor
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
skip-pkg-cache: true
skip-build-cache: true
- name: Check code formatting via go fmt
run: |
if [ "$(gofmt -s -l . | grep -v vendor | wc -l)" -gt 0 ]; then
echo "Code is not formatted. Please run 'go fmt'."
exit 1
fi
- name: Check that go modules are in sync
run: |
go mod tidy -v
if [ -n "$(git status --porcelain go.mod go.sum)" ]; then
echo "Go modules are not in sync. Please run 'go mod tidy'."
exit 1
fi
- name: Run unit tests
run: make test