Skip to content

Commit 57452d0

Browse files
authored
Merge pull request #8 from Cogwheel-Validator/release/v0.3.0
Release/v0.3.0
2 parents 1725599 + 89e5b6d commit 57452d0

39 files changed

Lines changed: 2096 additions & 602 deletions

.dockerignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
build/
12+
13+
# Test binary, built with `go test -c`
14+
*.test
15+
16+
# Code coverage profiles and other test artifacts
17+
*.out
18+
coverage.*
19+
*.coverprofile
20+
profile.cov
21+
22+
# Dependency directories (remove the comment below to include it)
23+
# vendor/
24+
25+
# Go workspace file
26+
go.work
27+
go.work.sum
28+
29+
# env file
30+
.env
31+
32+
# Editor/IDE
33+
# .idea/
34+
# .vscode/
35+
36+
# env and config files
37+
config.yml
38+
test_config.yml
39+
.env
40+
config-api.yml
41+
42+
# State dumps and diagnostics directories
43+
state_dumps/
44+
diagnostics/
45+
46+
# Cert files
47+
server.crt
48+
server.key

.github/workflows/golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Golangci-lint
22
on:
33
push:
4-
branches: [dev]
4+
branches: [dev, release/**]
55
pull_request:
6-
branches: [main, dev]
6+
branches: [main, dev, release/**]
77

88
jobs:
99
lint:

.github/workflows/gotest.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Go Test
22
on:
33
push:
4-
branches: [dev]
4+
branches: [dev, release/**]
55
pull_request:
6-
branches: [main, dev]
6+
branches: [main, dev, release/**]
77

88
jobs:
99
lint:
@@ -18,4 +18,4 @@ jobs:
1818
go-version: '1.25.1'
1919

2020
- name: Run tests
21-
run: go test ./...
21+
run: go test -short ./...
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
name: Integration Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ main, develop ]
6+
push:
7+
branches: [ main, develop ]
8+
workflow_dispatch:
9+
inputs:
10+
test_size:
11+
description: 'Test size (small/medium/large)'
12+
required: true
13+
default: 'small'
14+
type: choice
15+
options:
16+
- small
17+
- medium
18+
- large
19+
20+
jobs:
21+
integration-test-small:
22+
runs-on: ubuntu-latest
23+
if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_size == 'small')
24+
timeout-minutes: 10
25+
26+
services:
27+
timescaledb:
28+
image: timescale/timescaledb-ha:pg17
29+
env:
30+
POSTGRES_PASSWORD: test_password_12345678
31+
POSTGRES_DB: gnoland
32+
ports:
33+
- 5432:5432
34+
options: >-
35+
--health-cmd "pg_isready -U postgres -d gnoland"
36+
--health-interval 10s
37+
--health-timeout 5s
38+
--health-retries 5
39+
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Set up Go
45+
uses: actions/setup-go@v5
46+
with:
47+
go-version: '1.25'
48+
cache: true
49+
50+
- name: Wait for PostgreSQL
51+
run: |
52+
timeout 30 bash -c 'until pg_isready -h localhost -p 5432 -U postgres; do sleep 1; done'
53+
env:
54+
PGPASSWORD: test_password_12345678
55+
56+
- name: Initialize database schema
57+
run: |
58+
go run indexer/main.go setup create-db
59+
env:
60+
DB_HOST: localhost
61+
DB_PORT: 5432
62+
DB_USER: postgres
63+
DB_PASSWORD: test_password_12345678
64+
DB_NAME: gnoland
65+
66+
- name: Create test config
67+
run: |
68+
cat > integration/test_config.yml << EOF
69+
host: localhost
70+
port: 5432
71+
user: postgres
72+
password: test_password_12345678
73+
dbname: gnoland
74+
sslmode: disable
75+
pool_max_conns: 100
76+
pool_min_conns: 2
77+
pool_max_conn_lifetime: 5m
78+
pool_max_conn_idle_time: 2m
79+
pool_health_check_period: 30s
80+
pool_max_conn_lifetime_jitter: 30s
81+
82+
chain_id: gnoland
83+
max_height: 1000
84+
from_height: 1
85+
to_height: 1000
86+
EOF
87+
88+
- name: Run small integration test (1K blocks)
89+
run: |
90+
cd integration
91+
go test -v -tags=integration -timeout=5m
92+
timeout-minutes: 5
93+
94+
# Medium test for merges to main/develop
95+
integration-test-medium:
96+
runs-on: ubuntu-latest
97+
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')
98+
timeout-minutes: 30
99+
100+
services:
101+
timescaledb:
102+
image: timescale/timescaledb-ha:pg17
103+
env:
104+
POSTGRES_PASSWORD: test_password_12345678
105+
POSTGRES_DB: gnoland
106+
ports:
107+
- 5432:5432
108+
options: >-
109+
--health-cmd "pg_isready -U postgres -d gnoland"
110+
--health-interval 10s
111+
--health-timeout 5s
112+
--health-retries 5
113+
114+
steps:
115+
- name: Checkout code
116+
uses: actions/checkout@v4
117+
118+
- name: Set up Go
119+
uses: actions/setup-go@v5
120+
with:
121+
go-version: '1.25'
122+
cache: true
123+
124+
- name: Wait for PostgreSQL
125+
run: |
126+
timeout 30 bash -c 'until pg_isready -h localhost -p 5432 -U postgres; do sleep 1; done'
127+
env:
128+
PGPASSWORD: test_password_12345678
129+
130+
- name: Initialize database schema
131+
run: |
132+
go run indexer/main.go setup create-db
133+
env:
134+
DB_HOST: localhost
135+
DB_PORT: 5432
136+
DB_USER: postgres
137+
DB_PASSWORD: test_password_12345678
138+
DB_NAME: gnoland
139+
140+
- name: Create test config
141+
run: |
142+
cat > integration/test_config.yml << EOF
143+
host: localhost
144+
port: 5432
145+
user: postgres
146+
password: test_password_12345678
147+
dbname: gnoland
148+
sslmode: disable
149+
pool_max_conns: 100
150+
pool_min_conns: 2
151+
pool_max_conn_lifetime: 5m
152+
pool_max_conn_idle_time: 2m
153+
pool_health_check_period: 30s
154+
pool_max_conn_lifetime_jitter: 30s
155+
156+
chain_id: gnoland
157+
max_height: 10000
158+
from_height: 1
159+
to_height: 10000
160+
EOF
161+
162+
- name: Run medium integration test (10K blocks)
163+
run: |
164+
cd integration
165+
go test -v -tags=integration -timeout=20m
166+
timeout-minutes: 20
167+
168+
# Full test for releases (manual trigger)
169+
integration-test-large:
170+
runs-on: ubuntu-latest
171+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_size == 'large'
172+
timeout-minutes: 90
173+
174+
services:
175+
timescaledb:
176+
image: timescale/timescaledb-ha:pg17
177+
env:
178+
POSTGRES_PASSWORD: test_password_12345678
179+
POSTGRES_DB: gnoland
180+
ports:
181+
- 5432:5432
182+
options: >-
183+
--health-cmd "pg_isready -U postgres -d gnoland"
184+
--health-interval 10s
185+
--health-timeout 5s
186+
--health-retries 5
187+
188+
steps:
189+
- name: Checkout code
190+
uses: actions/checkout@v4
191+
192+
- name: Set up Go
193+
uses: actions/setup-go@v5
194+
with:
195+
go-version: '1.25'
196+
cache: true
197+
198+
- name: Wait for PostgreSQL
199+
run: |
200+
timeout 30 bash -c 'until pg_isready -h localhost -p 5432 -U postgres; do sleep 1; done'
201+
env:
202+
PGPASSWORD: test_password_12345678
203+
204+
- name: Initialize database schema
205+
run: |
206+
go run indexer/main.go setup create-db
207+
env:
208+
DB_HOST: localhost
209+
DB_PORT: 5432
210+
DB_USER: postgres
211+
DB_PASSWORD: test_password_12345678
212+
DB_NAME: gnoland
213+
214+
- name: Create test config
215+
run: |
216+
cat > integration/test_config.yml << EOF
217+
host: localhost
218+
port: 5432
219+
user: postgres
220+
password: test_password_12345678
221+
dbname: gnoland
222+
sslmode: disable
223+
pool_max_conns: 100
224+
pool_min_conns: 2
225+
pool_max_conn_lifetime: 5m
226+
pool_max_conn_idle_time: 2m
227+
pool_health_check_period: 30s
228+
pool_max_conn_lifetime_jitter: 30s
229+
230+
chain_id: gnoland
231+
max_height: 100000
232+
from_height: 1
233+
to_height: 100000
234+
EOF
235+
236+
- name: Run large integration test (100K blocks)
237+
run: |
238+
cd integration
239+
go test -v -tags=integration -timeout=75m
240+
timeout-minutes: 75
241+
242+
- name: Upload test results
243+
if: always()
244+
uses: actions/upload-artifact@v4
245+
with:
246+
name: integration-test-results
247+
path: |
248+
integration/test_results/
249+
state_dumps/
250+
retention-days: 7
251+

.github/workflows/release.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ jobs:
4343
# Get git commit hash
4444
GIT_COMMIT=$(git rev-parse --short HEAD)
4545
46-
# Linux AMD64
46+
# Linux AMD64 for the indexer and the API
4747
GOOS=linux GOARCH=amd64 go build -ldflags="-X main.Commit=${GIT_COMMIT} -X main.Version=${{ steps.version.outputs.version }}" -o build/indexer-linux-amd64 indexer/main.go
48+
GOOS=linux GOARCH=amd64 go build -ldflags="-X main.Commit=${GIT_COMMIT} -X main.Version=${{ steps.version.outputs.version }}" -o build/indexer-api-linux-amd64 api/main.go
49+
4850
4951
- name: Create GitHub Release
5052
uses: softprops/action-gh-release@v1
@@ -55,14 +57,26 @@ jobs:
5557
body: |
5658
## Release ${{ steps.version.outputs.version }}
5759
58-
### Installation
60+
### Installation for the indexer
5961
Download the binary for your platform and make it executable:
6062
```bash
6163
chmod +x indexer-*
64+
```
65+
66+
You will need to set up the database for the indexer, check the docs for more information.
67+
When you have the database running run the cmd to create the database and the user.
68+
```bash
69+
go run cmd/setup.go create-db --db-host localhost --db-port 5432 --db-user postgres --db-name postgres --ssl-mode disable --new-db-name gnoland --chain-name gnoland
70+
go run cmd/setup.go create-user --db-host localhost --db-port 5432 --db-user postgres --db-name postgres --ssl-mode disable --user writer --privilege writer
71+
```
72+
6273
From here you can run the indexer using live or historic mode
74+
```bash
6375
./indexer live --config config.yml
6476
./indexer historic --config config.yml --from-height 1000 --to-height 2000
6577
```
78+
79+
For more information check the docs.
6680
env:
6781
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6882

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ diagnostics/
4646
# Cert files
4747
server.crt
4848
server.key
49+
50+
# Jet Brains
51+
.idea/

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.1] - 2025-10-06
9+
10+
Not really much of a change just added dockerignore file, small changes to the release.yml so it pushes the api also.
11+
812
## [0.2.0] - 2025-10-04
913

1014
Added the REST API with some basic routes that will come in handy. Small bug fixes and changes.

0 commit comments

Comments
 (0)