-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (120 loc) · 4.42 KB
/
Copy pathci.yml
File metadata and controls
144 lines (120 loc) · 4.42 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: CI
on:
push:
branches: ["main", "claude/**"]
pull_request:
branches: ["main"]
jobs:
# ── owm-coordinator ──────────────────────────────────────────────────────────
coordinator:
name: coordinator — build, vet, test
runs-on: ubuntu-latest
defaults:
run:
working-directory: owm-coordinator
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: owm
POSTGRES_PASSWORD: owm
POSTGRES_DB: owm_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U owm"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
cache-dependency-path: owm-coordinator/go.sum
- name: Install protoc
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq protobuf-compiler
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
- name: Generate protobuf stubs
run: |
protoc \
--go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
proto/coordinator/v1/coordinator.proto
- name: Download dependencies
run: go mod download
- name: go vet
run: go vet ./...
- name: Build coordinator binary
run: go build ./cmd/coordinator
- name: Run unit tests
run: go test -v -count=1 -race ./...
env:
OWM_TEST_DSN: postgres://owm:owm@localhost:5432/owm_test
- name: Check for uncommitted generated files
run: git diff --exit-code
# ── Lint (golangci-lint) ─────────────────────────────────────────────────────
lint:
name: golangci-lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: owm-coordinator
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
cache-dependency-path: owm-coordinator/go.sum
- name: Install protoc
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq protobuf-compiler
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
- name: Generate protobuf stubs
run: |
protoc \
--go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
proto/coordinator/v1/coordinator.proto
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
working-directory: owm-coordinator
args: --timeout=5m
# ── Kubernetes manifests (Kustomize) ─────────────────────────────────────────
kustomize:
name: kustomize build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build overlays
run: |
kubectl kustomize k8s/overlays/dev >/tmp/dev.yaml
kubectl kustomize k8s/overlays/prod >/tmp/prod.yaml
kubectl kustomize k8s/overlays/prod-mtls >/tmp/prod-mtls.yaml
test -s /tmp/dev.yaml && test -s /tmp/prod.yaml && test -s /tmp/prod-mtls.yaml
# ── Docker build check ───────────────────────────────────────────────────────
docker:
name: Docker build
runs-on: ubuntu-latest
needs: coordinator
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build coordinator image (no push)
uses: docker/build-push-action@v5
with:
context: owm-coordinator
push: false
tags: owm-coordinator:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max