|
| 1 | +# PostgreSQL Version Matrix for CI |
| 2 | + |
| 3 | +## Problem |
| 4 | + |
| 5 | +PostgreSQL 18 was released and the `postgres:latest` Docker image broke volume mounting (commit `3e4fff24`). CI was pinned to PostgreSQL 17. We need to: |
| 6 | +1. Support PostgreSQL 18 (assuming upstream fix) |
| 7 | +2. Expand test coverage across multiple PostgreSQL versions |
| 8 | +3. Catch future breaking changes early |
| 9 | + |
| 10 | +## Decision |
| 11 | + |
| 12 | +Run a full parallel matrix in CI testing PostgreSQL versions 14, 15, 16, 17, and 18. |
| 13 | + |
| 14 | +## Design |
| 15 | + |
| 16 | +### GitHub Actions Matrix Strategy |
| 17 | + |
| 18 | +Update `.github/workflows/test.yml`: |
| 19 | + |
| 20 | +```yaml |
| 21 | +jobs: |
| 22 | + test: |
| 23 | + name: Test (PostgreSQL ${{ matrix.pg_version }}) |
| 24 | + runs-on: blacksmith-16vcpu-ubuntu-2204 |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + pg_version: [14, 15, 16, 17, 18] |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + - uses: ./.github/actions/setup-test |
| 32 | + - run: | |
| 33 | + mise run postgres:up --extra-args "--detach --wait" |
| 34 | + env: |
| 35 | + PG_VERSION: ${{ matrix.pg_version }} |
| 36 | + # ... rest of steps with PG_VERSION in env |
| 37 | +``` |
| 38 | + |
| 39 | +- `fail-fast: false` ensures all versions complete even if one fails |
| 40 | +- Version passed via `PG_VERSION` environment variable |
| 41 | +- Job names include version for clear identification in GitHub UI |
| 42 | + |
| 43 | +### Docker Compose Changes |
| 44 | + |
| 45 | +Update `tests/docker-compose.yml`: |
| 46 | + |
| 47 | +```yaml |
| 48 | +services: |
| 49 | + postgres: &postgres |
| 50 | + image: postgres:${PG_VERSION:-17} |
| 51 | + pull_policy: always |
| 52 | + # ... rest unchanged |
| 53 | + |
| 54 | + postgres-tls: # renamed from postgres-17-tls |
| 55 | + <<: *postgres |
| 56 | + image: postgres:${PG_VERSION:-17} |
| 57 | + container_name: postgres-tls |
| 58 | + environment: |
| 59 | + PGPORT: 5617 |
| 60 | + volumes: |
| 61 | + - ./pg/pg_hba-tls.conf:/etc/postgresql/pg_hba.conf |
| 62 | + - ./tls/localhost-key.pem:/etc/postgresql/localhost-key.pem |
| 63 | + - ./tls/localhost.pem:/etc/postgresql/localhost.pem |
| 64 | + - ./pg/data-tls:/var/lib/postgresql/data # simplified from data-17 |
| 65 | +``` |
| 66 | +
|
| 67 | +- Both containers use `postgres:${PG_VERSION:-17}` - defaults to 17 for local dev |
| 68 | +- Rename `postgres-17-tls` → `postgres-tls` (version-agnostic naming) |
| 69 | +- Data directory `data-17` → `data-tls` (version-agnostic) |
| 70 | + |
| 71 | +### Mise Configuration Updates |
| 72 | + |
| 73 | +Update `mise.toml` task `postgres:up` default services: |
| 74 | +- Change `postgres postgres-17-tls` → `postgres postgres-tls` |
| 75 | + |
| 76 | +Update `tests/mise.tls.toml`: |
| 77 | +- Update any `postgres-17-tls` references to `postgres-tls` |
| 78 | + |
| 79 | +No explicit `PG_VERSION` passthrough needed - docker-compose reads from environment. |
| 80 | + |
| 81 | +### CI Test Execution |
| 82 | + |
| 83 | +Each matrix job runs the full integration suite against one PostgreSQL version: |
| 84 | +- All jobs use same ports (5532, 5617, 6432) - no conflicts as each runs on separate runner |
| 85 | +- Tests run against TLS-enabled PostgreSQL container |
| 86 | +- Each version shows as separate check in GitHub PR |
| 87 | + |
| 88 | +## Files to Modify |
| 89 | + |
| 90 | +| File | Change | |
| 91 | +|------|--------| |
| 92 | +| `.github/workflows/test.yml` | Add matrix strategy with `pg_version: [14, 15, 16, 17, 18]` | |
| 93 | +| `tests/docker-compose.yml` | Use `postgres:${PG_VERSION:-17}`, rename `postgres-17-tls` → `postgres-tls` | |
| 94 | +| `mise.toml` | Update default services in `postgres:up` task | |
| 95 | +| `tests/mise.tls.toml` | Update container name reference if present | |
| 96 | + |
| 97 | +## Local Development |
| 98 | + |
| 99 | +No changes to local development workflow. Defaults to PostgreSQL 17. |
| 100 | + |
| 101 | +## Validation |
| 102 | + |
| 103 | +1. Create branch with changes |
| 104 | +2. Push to trigger CI matrix |
| 105 | +3. Verify all 5 versions pass (especially v18 to confirm volume issue resolved) |
| 106 | +4. If v18 fails, investigate the specific volume issue before merge |
| 107 | + |
| 108 | +## Rollback |
| 109 | + |
| 110 | +- Remove strategy block to revert to single version |
| 111 | +- `PG_VERSION` defaults to 17, so removing the env var restores current behavior |
0 commit comments