name: Ruby checks

on:
  push:
    branches:
      - main
  pull_request: {}

jobs:
  test:
    name: test
    runs-on: ubuntu-latest
    env:
      DATABASE_URL: postgres://postgres:postgres@localhost/intercode_test
      RAILS_ENV: test
    services:
      postgres:
        image: postgres
        env:
          POSTGRES_PASSWORD: postgres
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        ports:
          - 5432:5432
    steps:
      - uses: actions/checkout@v2
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - name: Database setup
        run: bundle exec rails db:create db:migrate
      - name: Run tests
        run: bundle exec rails test

Add a non-Docker Ruby test step
Add a non-Docker Ruby test step
