Skip to content

chore: standardize repository for procore open-source #14

chore: standardize repository for procore open-source

chore: standardize repository for procore open-source #14

Workflow file for this run

name: Test
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
permissions:
contents: read
jobs:
test:
env:
ENVIRONMENT: test
GEMFILE: gemfiles/spec.postgres.gemfile
PG_DB: myapp_test
PG_HOST: localhost
PG_USER: myappuser
RAILS_APP: myapp
strategy:
matrix:
#ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
#postgres: ['16-bullseye', '15-bullseye', '14-bullseye', '13-bullseye', '12-bullseye']
ruby: ['3.0']
postgres: ['16-bullseye']
name: Ruby ${{ matrix.ruby }} - PostgreSQL ${{ matrix.postgres }}
# https://docs.github.com/en/actions/learn-github-actions/expressions#example
runs-on: ${{ matrix.ruby == '2.7' && 'ubuntu-20.04' || 'ubuntu-latest' }}
services:
postgres:
image: postgres:${{ matrix.postgres }}
env:
POSTGRES_DB: ${{ env.PG_DB}}
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: ${{ env.PG_USER }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Installing dependencies
run: bundle install --gemfile ${{ env.GEMFILE }}
- name: Setup test Rails application
run: bundle exec rails new ${{ env.RAILS_APP }} --force --skip-bundle --database=postgresql
- name: Copy database config
run: cp spec/postgres_db_config.yml ${{ env.RAILS_APP }}/config/database.yml
- name: Initialize empty database
run: cd ${{ env.RAILS_APP }} && bundle exec rails db:setup RAILS_ENV=${{ env.ENVIRONMENT }}
- name: Initialize rspec_profiling
run: bundle exec rake rspec_profiling:install ${{ env.ENVIRONMENT }}
- name: Run tests
run: bundle exec rake