Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnavis committed Oct 17, 2023
1 parent ca5854e commit fff32ad
Show file tree
Hide file tree
Showing 4 changed files with 385 additions and 184 deletions.
266 changes: 266 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
name: Test
on: [push, pull_request]

jobs:
# Run the linter first for rapid feedback if some trivial stylistic issues
# slipped through the cracks.
lint:
runs-on: ubuntu-latest
env:
# When running in CI the gemspec does NOT pull rubocop as a dependency
# to avoid conflicting with various Ruby/Rails setups. We need to
# set LINT to explicitly request rubocop as a dependency.
LINT: true
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- run: bundle exec rake rubocop

test-latest-against-postgresql:
runs-on: ubuntu-latest
strategy:
matrix:
# We can't test against previous versions of Ruby without extra
# effort to make mysql2 work. See the link above for more information
# about the issue we run into:
#
# https://github.com/ruby/setup-ruby/issues/150
include:
- ruby: 2.6
rubygems: 3.2.3
active_record: 4.2
bundler: 1.17.3
- ruby: 2.7
active_record: 5.0
- ruby: 2.7
active_record: 5.1
- ruby: 2.7
active_record: 5.2
- ruby: 3.2
active_record: 6.1
- ruby: 3.2
active_record: 6.1
- ruby: 3.2
active_record: 7.0
steps:
- uses: ./.github/workflows/postgresql
with:
ruby: ${{ matrix.ruby }}
active_record: ${{ matrix.active_record }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}

test-latest-against-mysql:
runs-on: ubuntu-latest
strategy:
matrix:
# We can't test against previous versions of Ruby without extra
# effort to make mysql2 work. See the link above for more information
# about the issue we run into:
#
# https://github.com/ruby/setup-ruby/issues/150
include:
- ruby: 2.6
rubygems: 3.2.3
active_record: 4.2
bundler: 1.17.3
- ruby: 2.7
active_record: 5.0
- ruby: 2.7
active_record: 5.1
- ruby: 2.7
active_record: 5.2
- ruby: 3.2
active_record: 6.1
- ruby: 3.2
active_record: 6.1
- ruby: 3.2
active_record: 7.0
steps:
- uses: ./.github/workflows/mysql
with:
ruby: ${{ matrix.ruby }}
active_record: ${{ matrix.active_record }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}

test-remaining-against-postgresql:
runs-on: ubuntu-latest
strategy:
matrix:
# We can't test against previous versions of Ruby without extra
# effort to make mysql2 work. See the link above for more information
# about the issue we run into:
#
# https://github.com/ruby/setup-ruby/issues/150
include:
- ruby: 2.4
rubygems: 3.2.3
active_record: 4.2
bundler: 1.17.3
- ruby: 2.5
rubygems: 3.2.3
active_record: 4.2
bundler: 1.17.3

- ruby: 2.4
rubygems: 3.2.3
active_record: 5.0
- ruby: 2.5
rubygems: 3.2.3
active_record: 5.0
- ruby: 2.6
rubygems: 3.2.3
active_record: 5.0

- ruby: 2.4
rubygems: 3.2.3
active_record: 5.1
- ruby: 2.5
rubygems: 3.2.3
active_record: 5.1
- ruby: 2.6
rubygems: 3.2.3
active_record: 5.1

- ruby: 2.4
rubygems: 3.2.3
active_record: 5.2
- ruby: 2.5
rubygems: 3.2.3
active_record: 5.2
- ruby: 2.6
rubygems: 3.2.3
active_record: 5.2

- ruby: 2.5
rubygems: 3.2.3
active_record: 6.0
- ruby: 2.6
rubygems: 3.2.3
active_record: 6.0
- ruby: 2.7
active_record: 6.0
- ruby: 3.0
active_record: 6.0
- ruby: 3.1
active_record: 6.1

- ruby: 2.5
rubygems: 3.2.3
active_record: 6.1
- ruby: 2.6
rubygems: 3.2.3
active_record: 6.1
- ruby: 2.7
active_record: 6.1
- ruby: 3.0
active_record: 6.1
- ruby: 3.1
active_record: 6.1

- ruby: 2.7
active_record: 7.0
- ruby: 3.0
active_record: 7.0
- ruby: 3.1
active_record: 7.0
steps:
- uses: ./.github/workflows/postgresql
with:
ruby: ${{ matrix.ruby }}
active_record: ${{ matrix.active_record }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}

test-remaining-against-mysql:
runs-on: ubuntu-latest
strategy:
matrix:
# We can't test against previous versions of Ruby without extra
# effort to make mysql2 work. See the link above for more information
# about the issue we run into:
#
# https://github.com/ruby/setup-ruby/issues/150
include:
- ruby: 2.4
rubygems: 3.2.3
active_record: 4.2
bundler: 1.17.3
- ruby: 2.5
rubygems: 3.2.3
active_record: 4.2
bundler: 1.17.3

- ruby: 2.4
rubygems: 3.2.3
active_record: 5.0
- ruby: 2.5
rubygems: 3.2.3
active_record: 5.0
- ruby: 2.6
rubygems: 3.2.3
active_record: 5.0

- ruby: 2.4
rubygems: 3.2.3
active_record: 5.1
- ruby: 2.5
rubygems: 3.2.3
active_record: 5.1
- ruby: 2.6
rubygems: 3.2.3
active_record: 5.1

- ruby: 2.4
rubygems: 3.2.3
active_record: 5.2
- ruby: 2.5
rubygems: 3.2.3
active_record: 5.2
- ruby: 2.6
rubygems: 3.2.3
active_record: 5.2

- ruby: 2.5
rubygems: 3.2.3
active_record: 6.0
- ruby: 2.6
rubygems: 3.2.3
active_record: 6.0
- ruby: 2.7
active_record: 6.0
- ruby: 3.0
active_record: 6.0
- ruby: 3.1
active_record: 6.1

- ruby: 2.5
rubygems: 3.2.3
active_record: 6.1
- ruby: 2.6
rubygems: 3.2.3
active_record: 6.1
- ruby: 2.7
active_record: 6.1
- ruby: 3.0
active_record: 6.1
- ruby: 3.1
active_record: 6.1

- ruby: 2.7
active_record: 7.0
- ruby: 3.0
active_record: 7.0
- ruby: 3.1
active_record: 7.0
steps:
- uses: ./.github/workflows/mysql
with:
ruby: ${{ matrix.ruby }}
active_record: ${{ matrix.active_record }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ matrix.bundler }}
59 changes: 59 additions & 0 deletions .github/workflows/mysql/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Test specified versions of Ruby and Active Record against MySQL

on:
workflow_call:
inputs:
ruby:
required: true
type: string
active_record:
required: true
type: string
rubygems:
required: false
type: string
bundler:
required: false
type: string

jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql
env:
MYSQL_ROOT_PASSWORD: github
MYSQL_USER: github
MYSQL_PASSWORD: github
MYSQL_DATABASE: active_record_doctor_primary
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.activerecord-${{ inputs.active_record }}.x
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby }}
rubygems: ${{ inputs.rubygems }}
bundler: ${{ inputs.bundler }}
bundler-cache: true
- name: Prepare MySQL
run: |
mysqladmin -h127.0.0.1 -uroot -pgithub create active_record_doctor_secondary
mysql -h127.0.0.1 -uroot -pgithub -e "GRANT ALL PRIVILEGES ON active_record_doctor_secondary.* TO 'github'"
- name: Run the test suite against MySQL
run: bundle exec rake test:mysql2
env:
# We can't use localhost because that makes the MySQL client try
# connecting via a Unix socket instead of TCP.
DATABASE_HOST: 127.0.0.1
DATABASE_PORT: 3306
DATABASE_USERNAME: github
DATABASE_PASSWORD: github
60 changes: 60 additions & 0 deletions .github/workflows/postgresql/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Test specified versions of Ruby and Active Record against MySQL

on:
workflow_call:
inputs:
ruby:
required: true
type: string
active_record:
required: true
type: string
rubygems:
required: false
type: string
bundler:
required: false
type: string

jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_DB: active_record_doctor_primary
POSTGRES_USER: github
POSTGRES_PASSWORD: github
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.activerecord-${{ inputs.active_record }}.x
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby }}
rubygems: ${{ inputs.rubygems }}
bundler: ${{ inputs.bundler }}
bundler-cache: true
- name: Prepare PostgreSQL
run: createdb active_record_doctor_secondary
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: github
PGPASSWORD: github
PGDATABASE: postgres
- name: Run the test suite against PostgreSQL
run: bundle exec rake test:postgresql
env:
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_USERNAME: github
DATABASE_PASSWORD: github
Loading

0 comments on commit fff32ad

Please sign in to comment.