Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,38 @@ jobs:
env:
RAIN_POSTGRES_DSN: postgres://rain:rain@127.0.0.1:5432/rain_test?sslmode=disable
run: go test -race ./pkg/rain -run '^TestPostgresIntegration'

mysql-integration:
name: MySQL Integration Tests
runs-on: ubuntu-latest
needs: [precommit]
timeout-minutes: 10
services:
mysql:
image: mysql:8.4
env:
MYSQL_DATABASE: rain_test
MYSQL_USER: rain
MYSQL_PASSWORD: rain
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -urain -prain"
Comment thread
cungminh2710 marked this conversation as resolved.
--health-interval=10s
--health-timeout=5s
--health-retries=10

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.26"

- name: Run MySQL integration tests
env:
RAIN_MYSQL_DSN: rain:rain@tcp(127.0.0.1:3306)/rain_test?parseTime=true
run: go test -race ./pkg/rain -run '^TestMySQLIntegration'
41 changes: 41 additions & 0 deletions docs/adr/2026-03-29-mysql-integration-ci-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ADR: MySQL integration coverage in CI

## Status
Accepted on 2026-03-29.

## Context
The repository already contains MySQL-backed integration coverage in `pkg/rain/mysql_integration_test.go`, and CI already runs separate SQLite and Postgres integration jobs.

That leaves one gap in cross-dialect runtime verification: MySQL behavior is exercised locally when contributors provide a DSN, but it is not enforced as a distinct signal in GitHub Actions.

The workflow already uses separate jobs per backend, so adding MySQL should preserve that structure rather than introducing a larger matrix refactor.

## Decision
Add a dedicated `mysql-integration` job to the existing GitHub Actions workflow.

The new job:

- uses `ubuntu-latest`
- provisions a `mysql:8.4` service container
- creates a fixed `rain_test` database with a `rain` user
- passes `RAIN_MYSQL_DSN` to the test process
- runs `go test -race ./pkg/rain -run '^TestMySQLIntegration'`

Keep the existing SQLite and Postgres jobs unchanged.

## Consequences
### Positive
- CI now exposes MySQL runtime compatibility as an independent signal.
- Backend-specific failures remain isolated because each database keeps its own job.
- The workflow change is incremental and consistent with the current CI layout.

### Negative
- CI runtime increases because another service-backed job must start and execute.
- The workflow now contains some duplicated setup across database jobs.

## Testing approach
- Keep running the existing local validation flow:
- `make fmt`
- `make lint`
- `make test`
- In GitHub Actions, run `go test -race ./pkg/rain -run '^TestMySQLIntegration'` in the dedicated MySQL job.
4 changes: 2 additions & 2 deletions pkg/rain/mysql_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ func defineMySQLTables(suffix string) (*mysqlUsersTable, *mysqlPostsTable) {
users := schema.Define("users_"+suffix, func(t *mysqlUsersTable) {
t.ID = t.BigSerial("id").PrimaryKey()
t.Email = t.VarChar("email", 255).NotNull()
t.Name = t.Text("name").NotNull().Default("guest")
t.Name = t.VarChar("name", 255).NotNull().Default("guest")
t.Active = t.Boolean("active").NotNull().Default(true)
t.Nickname = t.Text("nickname").Nullable().Default("buddy")
t.Nickname = t.VarChar("nickname", 255).Nullable().Default("buddy")
t.CreatedAt = t.TimestampTZ("created_at").NotNull().DefaultNow()
})

Expand Down
Loading