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 6e8e5b0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 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
2 changes: 1 addition & 1 deletion Gemfile-postgres.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ GEM
concurrent-ruby (~> 1.0)

PLATFORMS
x86_64-darwin-22
ruby

DEPENDENCIES
pg
Expand Down

0 comments on commit 6e8e5b0

Please sign in to comment.