frab #1914
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: frab | |
on: | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
env: | |
RAILS_ENV: test | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby_version: | |
- '3.0' | |
- '3.1' | |
db: | |
- mysql | |
- postgresql | |
- sqlite | |
services: | |
postgres: | |
image: postgres:11 | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
POSTGRES_PASSWORD: root | |
mysql: | |
image: mariadb:10.3 | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{matrix.ruby_version}} | |
bundler-cache: true | |
- name: Prepare Postgresql | |
run: | | |
bundle exec rails db:create | |
echo "DATABASE_URL=$DATABASE_URL" >> $GITHUB_ENV | |
env: | |
DATABASE_URL: postgres://postgres:root@127.0.0.1:${{ job.services.postgres.ports[5432] }}/frab_test | |
if: matrix.db == 'postgresql' | |
- name: Prepare MySQL | |
run: | | |
cp db/schema.rb-mysql db/schema.rb | |
bundle exec rails db:create | |
echo "DATABASE_URL=$DATABASE_URL" >> $GITHUB_ENV | |
env: | |
DATABASE_URL: mysql2://root:root@127.0.0.1:${{ job.services.mysql.ports[3306] }}/frab_test | |
if: matrix.db == 'mysql' | |
- name: Prepare SQLite | |
run: | | |
cp .github/database.yml config/database.yml | |
bundle exec rails db:create | |
if: matrix.db == 'sqlite' | |
- name: Run tests | |
run: | | |
sed -i 's/config.eager_load = .*/config.eager_load = true/' config/environments/test.rb | |
bundle exec rails db:setup | |
bundle exec rails db:rollback STEP=5 | |
bundle exec rails db:migrate | |
bundle exec rails test | |
bundle exec rails test:system | |
env: | |
DB: ${{ matrix.db }} | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: screenshots-${{matrix.ruby_version}}-${{matrix.db}} | |
path: tmp/screenshots/* | |
retention-days: 5 |