-
-
Notifications
You must be signed in to change notification settings - Fork 150
171 lines (150 loc) · 4.85 KB
/
frontend.yml
File metadata and controls
171 lines (150 loc) · 4.85 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
161
162
163
164
165
166
167
168
169
170
171
name: Frontend CI
defaults:
run:
working-directory: ./frontend
on:
push:
branches:
- main
- v*
pull_request:
paths:
- "frontend/**"
- ".github/workflows/frontend.yml"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install Yarn
run: npm install -g yarn
- name: Clear Yarn Cache
run: yarn cache clean
- name: Install Dependencies
run: yarn install --frozen-lockfile # Use frozen lockfile for CI
- name: Lint Prettier
run: yarn run lint
# Gate explicit `any` usage against frontend/.any-baseline.json so the
# count cannot regress. `--check-strict` also fails when the count drops
# without the baseline being lowered, keeping the file in lockstep with
# reality. See issue #1448 and docs/frontend/any-baseline.md.
- name: Check any-baseline
run: yarn run any:check:strict
component-test:
name: Component Tests
runs-on: ubuntu-latest
needs: lint # Run only if lint job passes
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install Yarn
run: npm install -g yarn # Still need global yarn
- name: Clear Yarn Cache
run: yarn cache clean
- name: Install Dependencies
run: yarn install --frozen-lockfile # Use frozen lockfile for CI
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run Playwright Component Tests with Coverage
run: yarn run test:coverage:ct
# Metadata tests already run with coverage above (included in *.ct.tsx).
# This separate re-run without coverage catches flaky failures that
# may have been masked by retries, without blocking the pipeline.
- name: Re-run Metadata Component Tests (flakiness check)
run: |
yarn run test:ct --reporter=list tests/*Metadata*.ct.tsx
continue-on-error: true
# The `frontend` flag is intentionally listed alongside
# `frontend-component` so the same upload feeds both the per-suite
# drill-in and the merged Frontend coverage total. Codecov aggregates
# all uploads sharing a flag server-side, so the README `flag=frontend`
# badge reflects the union of unit + component + e2e without any
# cross-workflow lcov merging on our side.
- name: Upload CT Coverage to Codecov
if: success() || failure()
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: frontend/coverage/ct/lcov.info
flags: frontend-component,frontend
name: frontend-ct-coverage
fail_ci_if_error: false
disable_search: true
build:
name: Build
runs-on: ubuntu-latest
needs: lint
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install Yarn
run: npm install -g yarn
- name: Clear Yarn Cache
run: yarn cache clean
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Build TypeScript and Vite
run: yarn build
unit-test:
name: Unit Tests
runs-on: ubuntu-latest
needs: lint
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install Yarn
run: npm install -g yarn
- name: Clear Yarn Cache
run: yarn cache clean
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Run Unit Tests with Coverage
run: yarn run test:coverage:unit
# See the CT upload above for why the `frontend` flag is listed here too.
- name: Upload Unit Coverage to Codecov
if: success() || failure()
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: frontend/coverage/unit/lcov.info
flags: frontend-unit,frontend
name: frontend-unit-coverage
fail_ci_if_error: false
disable_search: true
docker-build:
name: Build Docker Image
runs-on: ubuntu-latest
needs: lint
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build Docker Image
run: docker build -t opencontracts-frontend .