To use Postgres on Github Actions you need to set up a service for Postgres. I recommend using additional options that will configure Postgres to use RAM instead of disk. This way your database can run faster in a testing environment.
In the config below, we also pass the settings for doing a health check to ensure the database is up and running before you start running tests.
How to configure Redis on Github Actions
You can use Redis Docker container to start Redis server on Github Actions. See how simple it is:
How to use Github Actions build matrix to run tests with parallel jobs
You can use the build matrix in Github Actions to run multiple jobs at the same time.
You will need to split test files between these parallel jobs. For that, you can use Knapsack Pro with Queue Mode to distribute tests evenly between the jobs. This way you can ensure the proper amount of tests is executed on each job and the workload is well balanced between the jobs. Simply speaking this way you can make sure the CI build is as fast as possible - it has optimal execution time.
Full YML config for Github Actions and Ruby on Rails project
Here is the full configuration of the CI pipeline for Github Actions. You can use it to run tests for your Rails project.
You’ve just learned how to set up your Rails application on Github Actions. I hope this will help you if you migrate your project from a different CI server to Github Actions.