-
Notifications
You must be signed in to change notification settings - Fork 3
104 lines (91 loc) · 3.5 KB
/
rspec.yml
File metadata and controls
104 lines (91 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
govukChatPrivateRef:
description: 'The branch, tag or SHA to checkout govuk_chat_private'
required: false
type: string
jobs:
run-rspec:
services:
opensearch-2:
image: opensearchproject/opensearch:2
env:
discovery.type: single-node
OPENSEARCH_JAVA_OPTS: -Xms2g -Xmx2g
DISABLE_INSTALL_DEMO_CONFIG: "true" # Prevents execution of bundled demo script
DISABLE_SECURITY_PLUGIN: "true"
ports:
- 9200:9200
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 5
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: alphagov/govuk-chat
ref: ${{ inputs.ref || github.ref }}
- name: Checkout Publishing API (for Content Schemas)
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: alphagov/publishing-api
ref: ${{ inputs.publishingApiRef }}
path: vendor/publishing-api
- name: Checkout govuk_chat_private
if: inputs.govukChatPrivateRef != ''
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: alphagov/govuk_chat_private
ref: ${{ inputs.govukChatPrivateRef }}
path: govuk_chat_private
token: ${{ secrets.GOVUK_CI_GITHUB_API_TOKEN }}
- name: Setup Ruby
uses: ruby/setup-ruby@97ecb7b512899eb71ab1bf2310a624c6f1589ac6 # v1.308.0
with:
bundler-cache: true
env:
BUNDLE_GITHUB__COM: "x-access-token:${{ secrets.GOVUK_CI_GITHUB_API_TOKEN }}"
- name: Configure Bundler to use checked-out version of govuk_chat_private
if: inputs.govukChatPrivateRef != ''
run: |
bundle config local.govuk_chat_private govuk_chat_private
bundle config set disable_local_branch_check true
bundle config set disable_local_revision_check true
bundle config set frozen false
bundle update --conservative govuk_chat_private
bundle info govuk_chat_private
- 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: 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
TEST_DATABASE_URL: ${{ steps.setup-postgres.outputs.db-url }}
GOVUK_CONTENT_SCHEMAS_PATH: vendor/publishing-api/content_schemas
run: bundle exec rake spec