-
Notifications
You must be signed in to change notification settings - Fork 1
261 lines (233 loc) · 7.12 KB
/
Copy pathintegration-tests.yml
File metadata and controls
261 lines (233 loc) · 7.12 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
name: Integration Tests
on:
pull_request:
branches: [main, dev]
push:
branches: [main, dev]
workflow_dispatch:
inputs:
test_size:
description: "Test size (small/medium/large)"
required: true
default: "small"
type: choice
options:
- small
- medium
- large
jobs:
integration-test-small:
name: Integration Test (Small)
permissions:
contents: read
packages: read
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_size == 'small')
timeout-minutes: 10
services:
timescaledb:
image: timescale/timescaledb-ha:pg17
env:
POSTGRES_PASSWORD: test_password_12345678
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.26.4"
cache: true
- name: Wait for PostgreSQL
run: |
timeout 30 bash -c 'until pg_isready -h localhost -p 5432 -U postgres; do sleep 1; done'
env:
PGPASSWORD: test_password_12345678
- name: Initialize database schema
run: |
go run indexer/cmd/indexer.go setup create-db --db-user postgres --db-name postgres
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USER: gnoland
DB_PASSWORD: test_password_12345678
DB_NAME: gnoland
- name: Create test config
run: |
cat > integration/test_config.yml << EOF
host: localhost
port: 5432
user: postgres
password: test_password_12345678
dbname: gnoland
sslmode: disable
pool_max_conns: 100
pool_min_conns: 2
pool_max_conn_lifetime: 5m
pool_max_conn_idle_time: 2m
pool_health_check_period: 30s
pool_max_conn_lifetime_jitter: 30s
chain_id: gnoland
max_height: 1000
from_height: 1
to_height: 1000
EOF
- name: Run small integration test (1K blocks)
run: |
cd integration
go test -v -tags=integration -timeout=5m
timeout-minutes: 5
# Medium test for merges to main/develop
integration-test-medium:
name: Integration Test (Medium)
permissions:
contents: read
packages: read
runs-on: ubuntu-latest
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_size == 'medium')
timeout-minutes: 30
services:
timescaledb:
image: timescale/timescaledb-ha:pg17
env:
POSTGRES_PASSWORD: test_password_12345678
POSTGRES_DB: gnoland
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d gnoland"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.26.4"
cache: true
- name: Wait for PostgreSQL
run: |
timeout 30 bash -c 'until pg_isready -h localhost -p 5432 -U postgres; do sleep 1; done'
env:
PGPASSWORD: test_password_12345678
- name: Initialize database schema
run: |
go run indexer/cmd/indexer.go setup create-db --db-user postgres --db-name postgres
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: test_password_12345678
DB_NAME: gnoland
- name: Create test config
run: |
cat > integration/test_config.yml << EOF
host: localhost
port: 5432
user: postgres
password: test_password_12345678
dbname: gnoland
sslmode: disable
pool_max_conns: 100
pool_min_conns: 2
pool_max_conn_lifetime: 5m
pool_max_conn_idle_time: 2m
pool_health_check_period: 30s
pool_max_conn_lifetime_jitter: 30s
chain_id: gnoland
max_height: 10000
from_height: 1
to_height: 10000
EOF
- name: Run medium integration test (10K blocks)
run: |
cd integration
go test -v -tags=integration -timeout=20m
timeout-minutes: 20
# Full test for releases (manual trigger)
integration-test-large:
name: Integration Test (Large)
permissions:
contents: read
packages: read
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_size == 'large'
timeout-minutes: 90
services:
timescaledb:
image: timescale/timescaledb-ha:pg17
env:
POSTGRES_PASSWORD: test_password_12345678
POSTGRES_DB: gnoland
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d gnoland"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.26.4"
cache: true
- name: Wait for PostgreSQL
run: |
timeout 30 bash -c 'until pg_isready -h localhost -p 5432 -U postgres; do sleep 1; done'
env:
PGPASSWORD: test_password_12345678
- name: Initialize database schema
run: |
go run indexer/cmd/indexer.go setup create-db
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: test_password_12345678
DB_NAME: gnoland
- name: Create test config
run: |
cat > integration/test_config.yml << EOF
host: localhost
port: 5432
user: postgres
password: test_password_12345678
dbname: gnoland
sslmode: disable
pool_max_conns: 100
pool_min_conns: 2
pool_max_conn_lifetime: 5m
pool_max_conn_idle_time: 2m
pool_health_check_period: 30s
pool_max_conn_lifetime_jitter: 30s
chain_id: gnoland
max_height: 100000
from_height: 1
to_height: 100000
EOF
- name: Run large integration test (100K blocks)
run: |
cd integration
go test -v -tags=integration -timeout=75m
timeout-minutes: 75
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-test-results
path: |
integration/test_results/
state_dumps/
retention-days: 7