Repository navigation
184 lines (153 loc) · 4.65 KB
/
Copy pathci.yml
File metadata and controls
184 lines (153 loc) · 4.65 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: CI
on:
pull_request:
push:
branches:
- main
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
backend-lint:
name: Backend lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25.x"
cache-dependency-path: backend/go.sum
- name: go vet
run: go vet ./...
- name: gofmt
run: test -z "$(gofmt -l .)"
backend-unit:
name: Backend unit tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25.x"
cache-dependency-path: backend/go.sum
- name: Run unit tests
run: go test ./... -race -count=1
backend-integration:
name: Backend integration tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: unity
POSTGRES_PASSWORD: unity
POSTGRES_DB: unity_run_club
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U unity -d unity_run_club"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgres://unity:unity@localhost:5432/unity_run_club?sslmode=disable
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25.x"
cache-dependency-path: backend/go.sum
- name: Apply migrations
run: go run ./cmd/migrate up
- name: Verify migration status
run: go run ./cmd/migrate status
- name: Run integration tests
run: go test -tags=integration ./... -race -count=1 -p 1
frontend:
name: Frontend lint and build
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
env:
NEXT_PUBLIC_BASE_URL: http://localhost:8080
NEXT_PUBLIC_REALTIME_URL: http://localhost:8081
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Build
run: npm run build
realtime:
name: Realtime syntax check
runs-on: ubuntu-latest
defaults:
run:
working-directory: realtime
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: realtime/package-lock.json
- name: Install dependencies
run: npm ci
- name: Syntax check
run: npm run check
load-balancing:
name: API load balancing and failover
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25.x"
cache-dependency-path: backend/go.sum
- name: Install isolated test dependencies
run: |
sudo apt-get update
sudo apt-get install -y postgresql redis-server
echo "$(pg_config --bindir)" >> "$GITHUB_PATH"
mkdir -p "$RUNNER_TEMP/traefik"
curl -fsSL --retry 3 https://github.com/traefik/traefik/releases/download/v3.7.12/traefik_v3.7.12_linux_amd64.tar.gz -o "$RUNNER_TEMP/traefik.tar.gz"
tar -xzf "$RUNNER_TEMP/traefik.tar.gz" -C "$RUNNER_TEMP/traefik" traefik
echo "$RUNNER_TEMP/traefik" >> "$GITHUB_PATH"
- name: Verify distribution, sessions, worker isolation, and failover
run: python3 deploy/test_load_balancing.py
- name: Upload diagnostic logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: load-balancing-logs
path: tmp/load-balancing-*/*.log
compose-config:
name: Docker Compose config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate compose file
run: docker compose config --quiet
- name: Validate Dokploy compose file
env:
POSTGRES_PASSWORD: ci-postgres-password
REDIS_PASSWORD: ci-redis-password
JWT_SECRET: ci-jwt-secret-that-is-long-enough-for-staging-validation
run: docker compose -f docker-compose.dokploy.yml config --quiet