-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (85 loc) · 2.51 KB
/
ci.yml
File metadata and controls
107 lines (85 loc) · 2.51 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: cashapp/activate-hermit@v1
- name: Cache Go modules and tools
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
.hermit/go/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum', '**/go.mod') }}
restore-keys: |
${{ runner.os }}-go-
- name: Format check
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go files not formatted. Run: task format"
gofmt -l .
exit 1
fi
- name: Install code generation tools
run: task tools
- name: Build
run: task build
- name: Run tests
run: task test
env:
GOTESTSUM_FORMAT: github-actions
goreleaser:
name: Validate GoReleaser Config
runs-on: ubuntu-latest
if: contains(github.event.head_commit.modified, '.goreleaser.yml') || contains(github.event.pull_request.files.*.filename, '.goreleaser.yml')
steps:
- uses: actions/checkout@v4
- uses: cashapp/activate-hermit@v1
- name: Validate GoReleaser config
run: goreleaser check
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cashapp/activate-hermit@v1
- name: Cache Go modules and tools
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
.hermit/go/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum', '**/go.mod') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install code generation tools
run: task tools
- name: Generate code
run: task generate
- name: Check formatting
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go files not formatted:"
gofmt -l .
exit 1
fi
- name: Run golangci-lint
run: task lint
- name: Check for TODO/FIXME comments
run: |
if grep -r "TODO\|FIXME" . --include="*.go" --exclude-dir=.git --exclude-dir=vendor; then
echo "Found TODO/FIXME comments that should be addressed or tracked as issues"
exit 0 # Don't fail, just warn
fi