Skip to content

Commit

Permalink
Merge pull request #2655 from alphagov/bulk/reusable-ruby-test-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
theseanything authored Jan 12, 2023
2 parents 64cafb9 + 3842ecd commit 6ba20cf
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 28 deletions.
29 changes: 1 addition & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,5 @@ jobs:

test-ruby:
name: Test Ruby
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Checkout Publishing API (for Content Schemas)
uses: actions/checkout@v3
with:
repository: alphagov/publishing-api
ref: deployed-to-production
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

- name: Run Minitest
env:
RAILS_ENV: test
GOVUK_CONTENT_SCHEMAS_PATH: vendor/publishing-api/content_schemas
run: bundle exec rake test
uses: ./.github/workflows/minitest.yml

49 changes: 49 additions & 0 deletions .github/workflows/minitest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Run Minitest

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: 'deployed-to-production'
type: string

jobs:
run-minitest:
name: Run Minitest
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: alphagov/government-frontend
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

- name: Run Minitest
env:
RAILS_ENV: test
GOVUK_CONTENT_SCHEMAS_PATH: vendor/publishing-api/content_schemas
run: bundle exec rake test

0 comments on commit 6ba20cf

Please sign in to comment.