結論
表題通り。
ハマった
落ちるときのエラーは次のような感じ。
rails aborted! ActiveRecord::NoDatabaseError: We could not find your database: hogehoge_test. Which can be found in the database configuration file located at config/database.yml. To resolve this issue: - Did you create the database for this app, or delete it? You may need to create your database. - Has the database name changed? Check your database.yml config has the correct database name. To create your database, run: bin/rails db:create
Caused by: PG::ConnectionBad: connection to server at "::1", port 5432 failed: FATAL: database "hogehoge_test" does not exist
手元では通るが CI では落ちる。エラーメッセージより、疑う対象となるのは「CI 環境でデータベースが正しく起動していないのではないか」という点になる。
SSH で中に入ってみたり、DB の起動方法やパラメータを変えてみたり、いろいろするが 3時間 ハマった。
ハマりから抜け出したのは、トレースを追ってみて、
/home/runner/work/hogehoge/config/routes.rb:1:in `<main>'
を見つけたことがきっかけで、直近の変更箇所と併せて感づいた。