hje
Joined
Activity
This took me 11 tries to get working. Here are the errors I ran into along with solutions.
Error 1:
/home/runner/work/_temp/315b8fef-45fa-4e39-9779-9fa4fde9bc23.sh: line 1: bin/rails: Permission denied
Solution 1:
It's not clear from this log what script this is, but since the only thing mentioned under "run" in ci.yml is "bin/rails", I figured out that must be it.
Needed to run locally the command "git update-index --chmod=+x ./bin/rails" and push changes, issue fixed.
Error 2:
/usr/bin/env: ‘ruby.exe’: No such file or directory
Solution 2:
Probably ran into this error because I'm using Windows, but the test runs on "ubuntu-latest".
In bin/rails and bin/rake, change the "ruby.exe" to "ruby" in the shebang line, issue fixed. Seems once I did it locally I had no issues, but who knows, maybe it's better to keep it for Windows? Not sure about this one, but the Github action will fail if ruby.exe is left there.
Error 3:
Unrecognized command "bin/rails" (Rails::Command::UnrecognizedCommandError)
Solution 3:
Here in the ci.yml for run, I simply missed the "|" character on the first line. If executing multiple commands, in needs to be written as "run: |".
Posting here in case anyone else ran into the issue where they tried to run a test, but got the error of having pending database migrations (also after running db:migrate).
For me what helped is running db:migrate for the test environment, so:
bin/rails db:migrate RAILS_ENV=test
After that, tests would run fine.