Update rspec.yml #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run RSpec | ||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: 'The branch, tag or SHA to checkout' | ||
required: false | ||
type: string | ||
publishingApiRef: | ||
description: 'The branch, tag or SHA to checkout Publishing API' | ||
required: false | ||
default: 'main' | ||
type: string | ||
jobs: | ||
run-rspec: | ||
name: Run RSpec | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Postgres | ||
id: setup-postgres | ||
uses: alphagov/govuk-infrastructure/.github/actions/setup-postgres@main | ||
- name: Setup Redis | ||
uses: alphagov/govuk-infrastructure/.github/actions/setup-redis@main | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: alphagov/content-tagger | ||
ref: ${{ inputs.ref || github.ref }} | ||
- name: Checkout Publishing API (for Content Schemas) | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: alphagov/publishing-api | ||
ref: ${{ inputs.publishingApiRef }} | ||
path: vendor/publishing-api | ||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
- name: Setup Node | ||
uses: alphagov/govuk-infrastructure/.github/actions/setup-node@main | ||
# - name: Precompile assets | ||
# uses: alphagov/govuk-infrastructure/.github/actions/precompile-rails-assets@main | ||
- Precompile assets | ||
run: bundle exec rails assets:clobber assets:precompile -v | ||
- name: Initialize database | ||
env: | ||
RAILS_ENV: test | ||
TEST_DATABASE_URL: ${{ steps.setup-postgres.outputs.db-url }} | ||
run: bundle exec rails db:setup | ||
- name: Run RSpec | ||
env: | ||
RAILS_ENV: test | ||
GOVUK_CONTENT_SCHEMAS_PATH: vendor/publishing-api/content_schemas | ||
TEST_DATABASE_URL: ${{ steps.setup-postgres.outputs.db-url }} | ||
run: bundle exec rake spec |