Skip to content

Add Postgres + MySQL CI matrix#57

Merged
ngan merged 1 commit into
mainfrom
np-pg-mysql-ci-matrix
May 6, 2026
Merged

Add Postgres + MySQL CI matrix#57
ngan merged 1 commit into
mainfrom
np-pg-mysql-ci-matrix

Conversation

@ngan
Copy link
Copy Markdown
Collaborator

@ngan ngan commented May 6, 2026

Summary

Adds a test_db CI job covering rails_8.1 against postgresql and mysql2, with the surrounding infrastructure to support running the suite against any of the three adapters.

What's new

  • Gemfile / Appraisals: bundler groups for pg and mysql2. Lockfiles regenerated.
  • spec/dummy/config/database.yml: ENV-driven via FIXTURE_KIT_DB (and _HOST/_USERNAME/_PASSWORD for CI). Defaults stay sqlite.
  • spec/support/dummy_rails_helper.rb: ensure_test_databases_exist! creates the PG/MySQL databases on first run via a separate TestDatabaseBootstrap class so the main ActiveRecord::Base connection is established cleanly later. drop_table calls use force: :cascade for PG FK dependencies.
  • .github/workflows/ci.yml: new test_db job with PG + MySQL service containers.
  • spec/dummy gets its own bundle install in CI with BUNDLE_GEMFILE unset.
  • Coder spec's upsert_all exercise now omits :unique_by on MySQL/Trilogy (those adapters reject it).

Why this PR has so much code

Adding "support PG/MySQL in CI" is a small workflow change in spirit but cascades through gem groups, lockfiles, schema bootstrap, and a few cross-adapter incompatibilities in existing specs. Splitting any of these out makes the CI add unrunnable on its own.

Stack

Stacked on #56.

Test plan

  • All three adapters green locally (162/0 each)
  • CI confirms PG/MySQL jobs come up and pass

🤖 Generated with Claude Code

@ngan ngan changed the base branch from np-verify-foreign-keys to main May 6, 2026 20:11
Adds a test_db job covering rails_8.1 against postgresql and mysql2
with service containers, plus the infrastructure to make the dummy
app's adapter configurable via FIXTURE_KIT_DB.

- Bundler groups for pg and mysql2; appraisal lockfiles regenerated
- spec/dummy/config/database.yml is ENV-driven (FIXTURE_KIT_DB and
  friends), defaults stay sqlite
- ensure_test_databases_exist! creates the PG/MySQL databases on
  first run via a separate connection class so the main
  ActiveRecord::Base connection is established cleanly later
- drop_table calls use force: :cascade to handle PG's FK dependencies
- spec/dummy gets its own bundle install in CI with BUNDLE_GEMFILE
  unset (the parent matrix's gemfile path doesn't resolve from inside
  spec/dummy)
- ActiveRecordCoder coverage tests the upsert_all path via a helper
  that omits :unique_by on MySQL/Trilogy (those adapters reject it)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ngan ngan force-pushed the np-pg-mysql-ci-matrix branch from be65794 to f0cb021 Compare May 6, 2026 20:16
@ngan ngan marked this pull request as ready for review May 6, 2026 20:16
@ngan ngan merged commit 2ea1265 into main May 6, 2026
12 checks passed
@ngan ngan deleted the np-pg-mysql-ci-matrix branch May 6, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant