Version 3.0.4 #54
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
name: Ruby | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby_version: | |
- '2.6' | |
- '3.0' | |
db: | |
- active_record:sqlite3 | |
- active_record:mysql2 | |
- active_record:postgresql | |
- mongoid:mongodb | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: ci_rails_admin | |
ports: | |
- 3306:3306 | |
# needed because the mysql container does not provide a healthcheck | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
mongodb: | |
image: mongo:4.2 | |
ports: | |
- 27017:27017 | |
postgres: | |
image: postgres:10.8 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: ci_rails_admin | |
ports: | |
- 5432:5432 | |
# needed because the postgres container does not provide a healthcheck | |
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=5 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby_version }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/vendor/bundle | |
key: ${{ matrix.ruby_version}}-${{ matrix.db }}-gems-${{ hashFiles('**/Gemfile', '**/Gemfile.lock') }} | |
restore-keys: | | |
${{ matrix.ruby_version}}-${{ matrix.db }}-gems- | |
- name: Set up ORM and DB adapter | |
id: setup-orm | |
run: | | |
orm=$(echo ${{ matrix.db }} | cut -f1 -d:) | |
db_adapter=$(echo ${{ matrix.db }} | cut -f2 -d:) | |
echo "::set-output name=orm::$orm" | |
echo "::set-output name=db_adapter::$db_adapter" | |
- name: Install dependencies | |
run: | | |
bundle config path ~/vendor/bundle | |
gem install bundler -v 2.2.19 | |
bundle install --jobs 4 --retry 3 | |
pushd spec/dummy_app | |
bundle config path ~/vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
# Piggyback of the Rails Admin CI rake task | |
bundle exec rake rails_admin:prepare_ci_env | |
bundle exec rake db:create db:migrate | |
popd | |
env: | |
RAILS_ENV: test | |
CI_ORM: ${{ steps.setup-orm.outputs.orm }} | |
CI_DB_ADAPTER: ${{ steps.setup-orm.outputs.db_adapter }} | |
- name: Run tests | |
run: bundle exec rake test | |
env: | |
RAILS_ENV: test | |
CI_ORM: ${{ steps.setup-orm.outputs.orm }} | |
CI_DB_ADAPTER: ${{ steps.setup-orm.outputs.db_adapter }} |