--- name: ruby-tests on: pull_request: branches: - main push: branches: - main jobs: build: name: Tests with Ruby ${{ matrix.ruby }} runs-on: "ubuntu-latest" strategy: fail-fast: false matrix: ruby: ["2.7.x", "2.6.x"] services: postgres: image: postgres:11.5 ports: ["5432:5432"] options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - uses: actions/checkout@v2.3.4 - uses: actions/cache@v2 with: path: vendor/bundle key: > ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }} restore-keys: > ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }} - name: Set up Ruby uses: actions/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - name: Install PostgreSQL 11 client run: | sudo apt-get -yqq install libpq-dev - name: Install gem dependencies env: PGHOST: localhost PGUSER: postgres RAILS_ENV: test run: | gem install bundler bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - name: Run Tests env: PGHOST: localhost PGUSER: postgres RAILS_ENV: test run: | psql -U postgres -c "create database test" bundle exec rake