name: CI on: [push] jobs: test: name: Tests runs-on: ubuntu-latest services: postgres: image: postgres:11 env: POSTGRES_USER: <%= @repository_name %> POSTGRES_DB: <%= "#{@repository_name}_test" %> POSTGRES_PASSWORD: "" ports: ["5432:5432"] steps: - name: Checkout code uses: actions/checkout@v2 - name: <%= "Set up Ruby #{@ruby_version}" %> uses: ruby/setup-ruby@v1 with: ruby-version: <%= @ruby_version %> - name: Ruby gem cache uses: actions/cache@v1 with: path: vendor/bundle key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} restore-keys: | ${{ runner.os }}-gems- - name: Install gems run: | bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - name: Setup Node uses: actions/setup-node@v1 with: node-version: <%= @node_version %> - name: Find yarn cache location id: yarn-cache run: echo "::set-output name=dir::$(yarn cache dir)" - name: JS package cache uses: actions/cache@v1 with: path: ${{ steps.yarn-cache.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - name: Install packages run: | yarn install --pure-lockfile - name: Setup test database env: RAILS_ENV: test PGHOST: localhost PGUSER: <%= @repository_name %> run: | bin/rails db:setup - name: Run tests run: bundle exec rails test # TODO: Update the test runner command as per your requirement.