-
Notifications
You must be signed in to change notification settings - Fork 54
107 lines (99 loc) · 3.09 KB
/
Copy pathpr-frontend.yaml
File metadata and controls
107 lines (99 loc) · 3.09 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
105
106
107
name: PR Frontend Checks
on:
workflow_dispatch:
pull_request:
branches:
- main
permissions:
contents: read
env:
NODE_VERSION: "22"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Only run the frontend jobs when frontend sources (the NestJS BFF in src/,
# the Vue app in packages/, the workspace manifests) or this workflow change.
changes:
runs-on: ubuntu-latest
outputs:
frontend: ${{ github.event_name != 'pull_request' || steps.filter.outputs.frontend == 'true' }}
steps:
- uses: dorny/paths-filter@v3
id: filter
if: github.event_name == 'pull_request'
with:
filters: |
frontend:
- 'src/**'
- 'packages/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'tsconfig*.json'
- 'Makefile'
- '.github/workflows/pr-frontend.yaml'
build-test:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.frontend == 'true'
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build BFF
run: pnpm run build
- name: Build web
run: pnpm --filter hami-webui-web run build
- name: Test BFF
run: pnpm test
lint:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.frontend == 'true'
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
# The package `lint` script auto-fixes (`--fix`) and `--require`s a
# structured-clone polyfill that is not committed to the repo; run ESLint
# directly in check mode (node 22 has structuredClone natively).
- name: Lint BFF
run: pnpm exec eslint "{src,apps,libs,test}/**/*.ts"
- name: Lint web
run: pnpm --filter hami-webui-web run lint
# Single required status check: green only if every frontend job passed (or
# there were no frontend-relevant changes).
pr-frontend-required:
runs-on: ubuntu-latest
needs:
- changes
- build-test
- lint
if: always()
steps:
- name: Aggregate frontend check results
run: |
if [[ "${{ needs.changes.outputs.frontend }}" != "true" ]]; then
echo "No frontend-relevant changes; skipping."
exit 0
fi
for result in \
"${{ needs.build-test.result }}" \
"${{ needs.lint.result }}"; do
if [[ "${result}" != "success" ]]; then
echo "Frontend checks did not complete successfully: ${result}"
exit 1
fi
done
echo "All frontend checks passed."