-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #537 from d-m-u/github_actions
[wip] add github actions test skeleton
- Loading branch information
Showing
1 changed file
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |