Skip to content

Commit

Permalink
add github actions skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
d-m-u committed May 12, 2021
1 parent 2ff497e commit 69f2324
Showing 1 changed file with 96 additions and 0 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/run_test_suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: run-test-suite
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: ancestry_test
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_PASSWORD:
ports:
- 3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
runs-on: ubuntu-latest
strategy:
matrix:
include:
- ruby: 2.5
activerecord: 52
- ruby: 2.7
activerecord: 60
- ruby: 2.7
activerecord: 61
- ruby: 3.0
activerecord: 61
env:
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: postgres
PGHOST: 127.0.0.1
PGPORT: 5432
BUNDLE_GEMFILE: gemfiles/gemfile_${{ matrix.activerecord }}.gemfile
MYSQL_DATABASE: ancestry_test

steps:
- name: checkout code
uses: actions/checkout@v2

- name: setup Ruby
# This will automatically get bug fixes and new Ruby versions (see https://github.com/ruby/setup-ruby#versioning)
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: install gems
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: setup mysql test database
run: |
sudo apt-get update && sudo apt-get install -y mysql-client
sudo /etc/init.d/mysql start
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -e 'CREATE SCHEMA IF NOT EXISTS 'ancestry_test';'
- name: setup postgres test database
run: |
sudo /etc/init.d/postgresql start
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
psql -U postgres -c 'create database ancestry_test;'
- name: run pg tests
env:
DB: pg
run: bundle exec rake

- name: run mysql tests
env:
DB: mysql2
MYSQL_DATABASE: ancestry_test
PORT: ${{ job.services.mysql.ports[3306] }}
run: bundle exec rake

- name: run sqlite tests
env:
DB: sqlite3
run: bundle exec rake

0 comments on commit 69f2324

Please sign in to comment.