-
Notifications
You must be signed in to change notification settings - Fork 417
160 lines (155 loc) · 4.56 KB
/
frontend-verify.yml
File metadata and controls
160 lines (155 loc) · 4.56 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---
name: "Frontend Lint & Compile check"
on:
workflow_call:
env:
CI: true
jobs:
lint:
timeout-minutes: 3
runs-on: blacksmith-2vcpu-ubuntu-2404
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Get Biome version
id: biome-version
run: echo "version=$(jq -r '.devDependencies["@biomejs/biome"]' package.json)" >> $GITHUB_OUTPUT
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: ${{ steps.biome-version.outputs.version }}
- name: Check Ultracite setup
run: bun x ultracite doctor
- name: Run Biome/Ultracite
run: |
bun run lint
CHANGED=$(git status --porcelain)
if [ -n "$CHANGED" ]; then
echo "::error::Lint produced uncommitted changes. Run 'bun run lint' locally and commit the result."
echo "$CHANGED"
exit 1
fi
type-check:
timeout-minutes: 3
runs-on: blacksmith-2vcpu-ubuntu-2404
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run typecheck
run: bun run type:check
build:
timeout-minutes: 5
runs-on: blacksmith-2vcpu-ubuntu-2404
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Restore Rspack build cache
uses: actions/cache@v4
with:
path: frontend/node_modules/.cache
key: ${{ runner.os }}-rspack-${{ hashFiles('frontend/src/**', 'frontend/rsbuild.config.ts') }}
restore-keys: |
${{ runner.os }}-rspack-
- name: Run build frontend
run: |
REACT_APP_CONSOLE_GIT_SHA=$(echo $GITHUB_SHA | cut -c 1-6)
REACT_APP_CONSOLE_GIT_REF=$GITHUB_REF_NAME
REACT_APP_BUILD_TIMESTAMP=$(date +%s)
REACT_APP_DEV_HINT=true
bun run build
- name: Upload frontend build artifact
uses: actions/upload-artifact@v4
with:
name: frontend-build
path: frontend/build
retention-days: 1
test-unit:
timeout-minutes: 3
runs-on: blacksmith-2vcpu-ubuntu-2404
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run unit tests
run: bun run test:unit
- uses: actions/upload-artifact@v4
if: failure()
with:
name: unit-test-results
path: frontend/test-results
retention-days: 2
test-integration:
timeout-minutes: 5
runs-on: blacksmith-8vcpu-ubuntu-2404
strategy:
fail-fast: false
matrix:
shard: [1/2, 2/2]
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run integration tests
run: bun run test:integration -- --shard=${{ matrix.shard }}
- uses: actions/upload-artifact@v4
if: failure()
with:
name: integration-test-results-${{ matrix.shard }}
path: frontend/test-results
retention-days: 2
test-coverage:
needs: ["test-unit", "test-integration"]
timeout-minutes: 10
runs-on: blacksmith-4vcpu-ubuntu-2404
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run coverage (unit + integration, merged)
run: bun run test:coverage
- name: Upload merged coverage HTML report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: frontend/coverage-merged/
retention-days: 14