Skip to content

Commit ac94cbf

Browse files
committed
CI/frontend: use reusable actions
1 parent 8173d4c commit ac94cbf

File tree

2 files changed

+59
-32
lines changed

2 files changed

+59
-32
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: 'Frontend Build'
2+
description: 'Build and test frontend application'
3+
inputs:
4+
run-prettier-check:
5+
description: 'Whether to run prettier check'
6+
required: false
7+
default: 'false'
8+
run-tests:
9+
description: 'Whether to run Cypress tests'
10+
required: false
11+
default: 'false'
12+
node-version:
13+
description: 'Node.js version to use'
14+
required: false
15+
default: '23'
16+
17+
runs:
18+
using: 'composite'
19+
steps:
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ inputs.node-version }}
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
working-directory: frontend
28+
shell: bash
29+
30+
- name: Verify prettier installation
31+
if: inputs.run-prettier-check == 'true'
32+
run: npx prettier --version
33+
working-directory: frontend
34+
shell: bash
35+
36+
- name: Check code formatting with Prettier
37+
if: inputs.run-prettier-check == 'true'
38+
run: make check-prettify
39+
working-directory: frontend
40+
shell: bash
41+
42+
- name: Build frontend
43+
run: npm run build
44+
working-directory: frontend
45+
shell: bash
46+
47+
- name: Run tests
48+
if: inputs.run-tests == 'true'
49+
uses: cypress-io/github-action@v6
50+
with:
51+
working-directory: frontend
52+
start: npm start
53+
wait-on: http://localhost:4200
54+
wait-on-timeout: 180s

.github/workflows/frontend.yaml

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,14 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14-
frontend-prettier-check:
14+
frontend:
1515
runs-on: ubuntu-24.04
1616
steps:
1717
- name: Git checkout
1818
uses: actions/checkout@v5
19-
with:
20-
sparse-checkout: |
21-
frontend
22-
23-
- name: Setup Node.js
24-
uses: actions/setup-node@v4
25-
with:
26-
node-version: '23'
27-
28-
- name: Install dependencies
29-
run: npm ci
30-
working-directory: frontend
31-
32-
- name: Check code formatting with Prettier
33-
run: make check-prettify
34-
working-directory: frontend
35-
36-
frontend-test:
37-
runs-on: ubuntu-24.04
38-
steps:
39-
- name: Git checkout
40-
uses: actions/checkout@v5
41-
with:
42-
sparse-checkout: |
43-
frontend
4419

45-
- name: Run tests
46-
uses: cypress-io/github-action@v6
20+
- name: Frontend build and test
21+
uses: ./.github/actions/frontend-build
4722
with:
48-
working-directory: frontend
49-
start: npm start
50-
wait-on: http://localhost:4200
51-
wait-on-timeout: 180s
23+
run-prettier-check: 'true'
24+
run-tests: 'true'

0 commit comments

Comments
 (0)