Skip to content

Commit

Permalink
Split Github workflows into individual files
Browse files Browse the repository at this point in the history
To get a better overview of all the tasks that are being run as well
as for better maintainability, split the `test` Github workflow into
separate ones, one for executing the Rubocop checks and one per DB
we test against.

Since each DB tests against a grid of Ruby as well as DB versions, this
gives us a better view on which tests are still running.

Also, given that the 18.04 Ubuntu image has been deprecated by Github,
upgrade the Rubocop and Postgres jobs to run on Ubuntu 22.

For MySQL this is a bit more complicated since newer versions of Ubuntu
are incompatible with MySQL 5.7 but we still need to keep support for
5.7 as it still is a maintained MySQL version.

Therefore, use MacOS for testing against MySQL 5.7 and Ubuntu to test
MySQL 8.

But since MacOS does not allow to install the `pg` gem unless Postgres
is installed on the machine, remove the `pg` gem from the main Gemfile
and install it only in the Postgres test flow via a custom Gemfile. The
`mysql` gem is used for local testing and will therefore stay in the
main Gemfile for now.
  • Loading branch information
nicolas-fricke committed Aug 24, 2023
1 parent 30afa3d commit 2d0d369
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions .github/workflows/rspec-on-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ on:
branches: [ master ]

jobs:
test-on-mysql:
# MySQL 5.7 is not supported on Ubuntu 22, therefore using MacOS for this
# version
test-on-mysql-5-7:
runs-on: macos-13
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2']
mysql-version: ['5.7', '8.0']
ruby-version: ['2.7', '3.0', '3.1']
mysql-version: ['5.7']

steps:
- uses: actions/checkout@v2
Expand All @@ -32,3 +34,30 @@ jobs:
DB_ADAPTER: mysql2
DB_HOST: 127.0.0.1
DB_USER: root


test-on-mysql-8:
runs-on: ubuntu-22.04
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2']
mysql-version: ['8.0']

steps:
- uses: actions/checkout@v2
- uses: ankane/setup-mysql@v1
with:
mysql-version: ${{ matrix.mysql-version }}
- name: Create the test database
run: mysqladmin create rails_cursor_pagination_testing
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake spec
env:
DB_ADAPTER: mysql2
DB_HOST: 127.0.0.1
DB_USER: root

0 comments on commit 2d0d369

Please sign in to comment.