-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (50 loc) · 1.5 KB
/
ci.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
57
58
59
name: ci
on:
pull_request:
paths-ignore:
- "README.md"
push:
branches:
- main
paths-ignore:
- "README.md"
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: "go.mod"
cache: false
- name: Ensure go modules are tidy
run: |
go mod tidy
if [[ -n $(git status -s) ]] ; then
echo
echo -e "\e[31mRunning 'go mod tidy' changes the current setting"
echo -e "\e[31mEnsure to include updated go.mod and go.sum in this PR."
echo -e "\e[31mThis is usually done by running 'go mod tidy'\e[0m"
git status -s
git diff --color
exit 1
fi
- name: Run linters
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
with:
args: --out-format=colored-line-number
version: latest
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: "go.mod"
cache: false
- run: go mod download
- run: go build cmd/main.go