Skip to content

Fix API build in release.yml #33

Fix API build in release.yml

Fix API build in release.yml #33

name: Integration Tests
permissions:
contents: read
packages: read
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:
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@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
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/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:
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@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
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/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:
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@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
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/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