Skip to content

Commit 309faba

Browse files
committed
wip
1 parent e1475c6 commit 309faba

1 file changed

Lines changed: 173 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# This workflow uses actions that are not certified by GitHub. They are
2+
# provided by a third-party and are governed by separate terms of service,
3+
# privacy policy, and support documentation.
4+
#
5+
# This workflow will install a prebuilt Ruby version, install dependencies, and
6+
# run tests and linters.
7+
8+
name: "CI"
9+
10+
on:
11+
push:
12+
branches: [main]
13+
pull_request:
14+
branches: [main]
15+
merge_group:
16+
types: [checks_requested]
17+
18+
jobs:
19+
lint-ruby:
20+
name: Lint Ruby
21+
uses: alphagov/govuk-infrastructure/.github/workflows/rubocop.yml@59fd794d40eef8c53f0973c3b6080f94f056ba6d
22+
23+
lint-scss:
24+
name: Lint SCSS
25+
runs-on: ubuntu-latest
26+
env:
27+
NODE_ENV: "test"
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
31+
32+
- name: Install Node.js
33+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
34+
with:
35+
node-version-file: ".nvmrc"
36+
cache: "npm"
37+
38+
- name: Install JavaScript dependencies
39+
run: npm ci
40+
41+
- name: Run linter
42+
run: stylelint "app/**/*.scss"
43+
44+
lint-javascript:
45+
name: Lint JavaScript
46+
runs-on: ubuntu-latest
47+
env:
48+
NODE_ENV: "test"
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
52+
53+
- name: Install Node.js
54+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
55+
with:
56+
node-version-file: ".nvmrc"
57+
cache: "npm"
58+
59+
- name: Install JavaScript dependencies
60+
run: npm ci --include=dev
61+
62+
- name: Run linter
63+
run: standard | snazzy
64+
65+
test-ruby:
66+
name: Run RSpec
67+
runs-on: ubuntu-latest
68+
env:
69+
RAILS_ENV: "test"
70+
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/forms_runner_test"
71+
QUEUE_DATABASE_URL: "postgres://postgres:postgres@localhost:5432/forms_runner_test_queue"
72+
steps:
73+
- name: Setup Postgres
74+
id: setup-postgres
75+
uses: alphagov/govuk-infrastructure/.github/actions/setup-postgres@59fd794d40eef8c53f0973c3b6080f94f056ba6d
76+
with:
77+
POSTGRES_DB: forms_runner_test
78+
POSTGRES_USER: postgres
79+
POSTGRES_PASSWORD: postgres
80+
81+
- name: Setup ChromeDriver
82+
uses: nanasess/setup-chromedriver@e93e57b843c0c92788f22483f1a31af8ee48db25 # v2.3.0
83+
with:
84+
chromedriver-version: '128.0.6613.8600'
85+
chromeapp: chrome
86+
87+
- name: Purge Google Chrome
88+
run: |
89+
sudo apt-get purge google-chrome-stable
90+
91+
- name: Setup Chrome
92+
uses: browser-actions/setup-chrome@b94431e051d1c52dcbe9a7092a4f10f827795416 # v2.1.0
93+
with:
94+
chrome-version: 128
95+
install-chromedriver: 'false'
96+
97+
- name: Checkout repository
98+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
99+
100+
- name: Setup Ruby
101+
uses: ruby/setup-ruby@f8d7259c7a66155a7c4a157a1a10ca601f186594
102+
with:
103+
bundler-cache: true
104+
105+
- name: Install Node.js
106+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
107+
with:
108+
node-version-file: ".nvmrc"
109+
cache: "npm"
110+
111+
- name: Install JavaScript dependencies
112+
run: npm ci
113+
114+
- name: Run Vite build
115+
run: bin/vite build
116+
117+
- name: Initialize database
118+
run: bundle exec rails db:setup
119+
120+
- name: Run RSpec
121+
run: bundle exec rake spec
122+
123+
test-javascript:
124+
name: Test JavaScript
125+
runs-on: ubuntu-latest
126+
steps:
127+
- name: Checkout repository
128+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
129+
130+
- name: Setup Ruby
131+
uses: ruby/setup-ruby@f8d7259c7a66155a7c4a157a1a10ca601f186594
132+
with:
133+
bundler-cache: true
134+
135+
- name: Install Node.js
136+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
137+
with:
138+
node-version-file: ".nvmrc"
139+
cache: "npm"
140+
141+
- name: Install JavaScript dependencies
142+
run: npm ci
143+
144+
- name: Run Vite build
145+
run: bin/vite build
146+
147+
- name: Run Vitest
148+
run: npm run test
149+
150+
security-analysis:
151+
name: Security Analysis
152+
uses: alphagov/govuk-infrastructure/.github/workflows/brakeman.yml@59fd794d40eef8c53f0973c3b6080f94f056ba6d
153+
secrets: inherit
154+
permissions:
155+
contents: read
156+
security-events: write
157+
actions: read
158+
159+
audit-dependencies:
160+
name: Audit dependencies
161+
runs-on: ubuntu-latest
162+
steps:
163+
- name: Checkout repository
164+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
165+
166+
- name: Setup Ruby
167+
uses: ruby/setup-ruby@f8d7259c7a66155a7c4a157a1a10ca601f186594
168+
with:
169+
bundler-cache: true
170+
171+
- name: Run bundle audit
172+
run: bundle exec bundle-audit check --update
173+

0 commit comments

Comments
 (0)