Test PostgreSQL ActiveRecord adapter types
Postgres support in Tapioca for ActiveRecordColumns DSL compiler has been slowly increasing https://github.com/search?q=repo%3AShopify%2Ftapioca%20postgresql&type=code. As a result we have untested code paths since we only run an in memory SQLite database during tests. We should have CI setup where we can observe column types under the ActiveRecord::ConnectionAdapters::PostgreSQL namespace.
Questions:
- Do we need to run postgres to be able to test the ActiveRecord adapter? (It'd be great if we didn't)
- If we do run postgres, do we need a service container with a postgres image (ex) or is it already available in our image and we can just activate it?
cc @alex-tan in case you're interested or have knowledge on the above questions 🙂
That's interesting, normally you would use a separate image for postgres, e.g.:
https://github.com/rails/rails/blob/e7c0592cd2944caf9d70c3fabe9ec6877f1f951b/railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt#L83-L92
If we may need to test against different versions of postgres then the image approach would be more flexible.
Agreed! I think the easiest way to test would be to use Docker both for the switching of versions if that ends up being necessary and probably for local development setup as well. It might make sense to use docker-compose to keep things consistent between GitHub actions and local development?