-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (92 loc) · 2.63 KB
/
Copy pathci.yml
File metadata and controls
105 lines (92 loc) · 2.63 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: kronos
POSTGRES_PASSWORD: kronos
POSTGRES_DB: kronos
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U kronos"
--health-interval 5s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25.x"
cache: true
# go.sum is generated here and used for the rest of the job.
# Developers should run `go mod tidy` locally before pushing.
- name: Tidy and verify dependencies
run: |
go mod tidy
git diff --exit-code go.mod || (echo "go.mod is not tidy — run 'go mod tidy'" && exit 1)
- name: Build
run: go build ./...
- name: Unit tests (race detector)
run: go test -race -count=1 ./...
- name: Integration tests
env:
DATABASE_URL: postgres://kronos:kronos@localhost:5432/kronos?sslmode=disable
run: go test -tags integration -race -count=1 -timeout 120s ./internal/integration/...
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25.x"
cache: true
- run: go mod tidy
- name: go vet
run: go vet ./...
- name: gofmt check
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "The following files need gofmt:"
echo "$unformatted"
exit 1
fi
bench:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: kronos
POSTGRES_PASSWORD: kronos
POSTGRES_DB: kronos
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U kronos"
--health-interval 5s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25.x"
cache: true
- run: go mod tidy
- name: Worker pool micro-benchmark
run: go test -bench=BenchmarkPool_Throughput -benchtime=5s -count=1 ./internal/worker/ | tee bench.txt
- uses: actions/upload-artifact@v4
with:
name: bench-${{ github.sha }}
path: bench.txt