Skip to content

Commit 71806f3

Browse files
committed
wip
1 parent e1475c6 commit 71806f3

2 files changed

Lines changed: 172 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
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+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
29+
30+
- name: Install Node.js
31+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
32+
with:
33+
node-version-file: ".nvmrc"
34+
cache: "npm"
35+
36+
- name: Install JavaScript dependencies
37+
run: npm ci
38+
39+
- name: Run linter
40+
run: npm run lint:scss
41+
42+
lint-javascript:
43+
name: Lint JavaScript
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout repository
47+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
48+
49+
- name: Install Node.js
50+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
51+
with:
52+
node-version-file: ".nvmrc"
53+
cache: "npm"
54+
55+
- name: Install JavaScript dependencies
56+
run: npm ci
57+
58+
- name: Run linter
59+
run: npm run lint:javascript
60+
61+
test-ruby:
62+
name: Run RSpec
63+
runs-on: ubuntu-latest
64+
env:
65+
RAILS_ENV: "test"
66+
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/forms_runner_test"
67+
QUEUE_DATABASE_URL: "postgres://postgres:postgres@localhost:5432/forms_runner_test_queue"
68+
steps:
69+
- name: Setup Postgres
70+
id: setup-postgres
71+
uses: alphagov/govuk-infrastructure/.github/actions/setup-postgres@59fd794d40eef8c53f0973c3b6080f94f056ba6d
72+
with:
73+
POSTGRES_DB: forms_runner_test
74+
POSTGRES_USER: postgres
75+
POSTGRES_PASSWORD: postgres
76+
77+
- name: Setup ChromeDriver
78+
uses: nanasess/setup-chromedriver@e93e57b843c0c92788f22483f1a31af8ee48db25 # v2.3.0
79+
with:
80+
chromedriver-version: '128.0.6613.8600'
81+
chromeapp: chrome
82+
83+
- name: Purge Google Chrome
84+
run: |
85+
sudo apt-get purge google-chrome-stable
86+
87+
- name: Setup Chrome
88+
uses: browser-actions/setup-chrome@b94431e051d1c52dcbe9a7092a4f10f827795416 # v2.1.0
89+
with:
90+
chrome-version: 128
91+
install-chromedriver: 'false'
92+
93+
- name: Checkout repository
94+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
95+
96+
- name: Setup Ruby
97+
uses: ruby/setup-ruby@f8d7259c7a66155a7c4a157a1a10ca601f186594
98+
with:
99+
bundler-cache: true
100+
101+
- name: Install Node.js
102+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
103+
with:
104+
node-version-file: ".nvmrc"
105+
cache: "npm"
106+
107+
- name: Install JavaScript dependencies
108+
run: npm ci
109+
110+
- name: Run Vite build
111+
run: bin/vite build
112+
113+
- name: Initialize database
114+
run: bundle exec rails db:setup
115+
116+
- name: Run RSpec
117+
run: bundle exec rake spec
118+
119+
test-javascript:
120+
name: Test JavaScript
121+
runs-on: ubuntu-latest
122+
steps:
123+
- name: Checkout repository
124+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
125+
126+
- name: Setup Ruby
127+
uses: ruby/setup-ruby@f8d7259c7a66155a7c4a157a1a10ca601f186594
128+
with:
129+
bundler-cache: true
130+
131+
- name: Install Node.js
132+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
133+
with:
134+
node-version-file: ".nvmrc"
135+
cache: "npm"
136+
137+
- name: Install JavaScript dependencies
138+
run: npm ci
139+
140+
- name: Run Vite build
141+
run: bin/vite build
142+
143+
- name: Run Vitest
144+
run: npm run test
145+
146+
security-analysis:
147+
name: Security Analysis
148+
uses: alphagov/govuk-infrastructure/.github/workflows/brakeman.yml@59fd794d40eef8c53f0973c3b6080f94f056ba6d
149+
secrets: inherit
150+
permissions:
151+
contents: read
152+
security-events: write
153+
actions: read
154+
155+
audit-dependencies:
156+
name: Audit dependencies
157+
runs-on: ubuntu-latest
158+
steps:
159+
- name: Checkout repository
160+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
161+
162+
- name: Setup Ruby
163+
uses: ruby/setup-ruby@f8d7259c7a66155a7c4a157a1a10ca601f186594
164+
with:
165+
bundler-cache: true
166+
167+
- name: Run bundle audit
168+
run: bundle exec bundle-audit check --update
169+

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"scripts": {
1616
"test": "vitest run",
1717
"test:watch": "vitest watch",
18-
"lint": "standard | snazzy && stylelint 'app/**/*.scss'",
18+
"lint": "npm run lint:javascript && npm run lint:scss",
19+
"lint:scss": "stylelint 'app/**/*.scss'",
20+
"lint:javascript": "standard | snazzy",
1921
"format": "standard --fix && stylelint 'app/**/*.scss' --fix",
2022
"ci": "bin/setup && bin/rails server",
2123
"dev": "vite dev"

0 commit comments

Comments
 (0)