ombulabs/pecas

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
# .github/workflows/ci.yml

name: CI
on:
  push:
    branches:
    - main
  pull_request:
    branches:
    - main

jobs:
  test-rails-current:
    runs-on: ubuntu-latest

    services:
      postgres:
        image: postgres:11.6-alpine
        ports:
          - 5432:5432
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        # 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@v1
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: "2.5.8"

      - name: Install PostgreSQL 11 client
        run: |
          sudo apt-get -yqq install libpq-dev

      - name: Build App
        env:
          PGHOST: localhost
          PGUSER: postgres
          RAILS_ENV: test
        run: |
          gem install bundler:2.2.29
          bundle install --jobs 4 --retry 3
          yarn install
          cp config/database.yml.github config/database.yml
          rake db:setup
      - name: Run tests
        run: |
          bundle exec rspec spec
  test-rails-next:
    runs-on: ubuntu-latest
    env:
      PGHOST: localhost
      PGUSER: postgres
      BUNDLE_GEMFILE: Gemfile.next
      RAILS_ENV: test

    services:
      postgres:
        image: postgres:11.6-alpine
        ports:
          - 5432:5432
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        # 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@v1
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: "2.5.8"

      - name: Install PostgreSQL 11 client
        run: |
          sudo apt-get -yqq install libpq-dev

      - name: Build App
        run: |
          gem install bundler:2.2.29
          bundle install --jobs 4 --retry 3
          yarn install
          cp config/database.yml.github config/database.yml
          rake db:setup
      - name: Run tests
        run: |
          bundle exec rspec spec