Skip to content

Merge pull request #677 from kbrock/rails_71 #335

Merge pull request #677 from kbrock/rails_71

Merge pull request #677 from kbrock/rails_71 #335

name: run-test-suite
on:
push:
branches: [ master, 4-3-stable ]
pull_request:
branches: [ master, 4-3-stable ]
jobs:
test:
services:
# https://github.com/docker-library/docs/blob/master/postgres/README.md
postgres:
image: postgres:13
env:
POSTGRES_PASSWORD: password
POSTGRES_DB: ancestry_test
ports:
- "5432:5432"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: ancestry_test
ports:
- "3306:3306"
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# this matrix is driven by these sources:
# - https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
# - https://www.ruby-lang.org/en/downloads/branches/
# - https://guides.rubyonrails.org/maintenance_policy.html
format: [materialized_path, materialized_path2]
activerecord: [70, 71]
ruby: [3.1, 3.2]
# additional tests
include:
# EOL 6/2022
- ruby: 2.5
activerecord: 52
# EOL 2023
- ruby: 2.7
activerecord: 60
# rails 6.1 and 7.0 have different ruby versions
- ruby: 2.7
activerecord: 61
- ruby: "3.0"
activerecord: 61
env:
# for the pg cli (psql, pg_isready) and possibly rails
PGHOST: 127.0.0.1 # container is mapping it locally
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: password
# for the mysql cli (mysql, mysqladmin)
MYSQL_HOST: 127.0.0.1
MYSQL_PWD: password
# for rails tests (from matrix)
BUNDLE_GEMFILE: gemfiles/gemfile_${{ matrix.activerecord }}.gemfile
FORMAT: ${{ matrix.format }}
steps:
- name: checkout code
uses: actions/checkout@v4
- name: setup Ruby
# https://github.com/ruby/setup-ruby#versioning
# runs 'bundle install' and caches installed gems automatically
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: run sqlite tests
env:
DB: sqlite3
run: |
bundle exec rake
- name: run pg tests
env:
DB: pg
run: |
bundle exec rake
- name: run pg tests (UPDATE_STRATEGY=sql)
env:
DB: pg
UPDATE_STRATEGY: sql
run: |
bundle exec rake
if: ${{ matrix.activerecord != 52 }}
- name: run pg tests (ANCESTRY_COLUMN=ancestry_alt)
env:
DB: pg
ANCESTRY_COLUMN: ancestry_alt
run: |
bundle exec rake
- name: run pg tests (UPDATE_STRATEGY=sql ANCESTRY_COLUMN=ancestry_alt)
env:
DB: pg
ANCESTRY_COLUMN: ancestry_alt
UPDATE_STRATEGY: sql
run: |
bundle exec rake
FORMAT=${{ matrix.format }} UPDATE_STRATEGY=sql bundle exec rake
if: ${{ matrix.activerecord != 52 }}
- name: run mysql tests
env:
DB: mysql2
run: |
bundle exec rake
- name: run mysql tests (ANCESTRY_COLUMN_TYPE=binary)
env:
DB: mysql2
ANCESTRY_COLUMN_TYPE: binary
run: |
bundle exec rake