|
| 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 | + |
0 commit comments