Skip to content

Commit 09228a1

Browse files
committed
feat: add ci for ui
1 parent 1e27b9a commit 09228a1

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed

.github/workflows/ui-ci.yml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: "UI CI/CD"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- v2
8+
paths:
9+
- 'ui/**'
10+
- '.github/workflows/ui-ci.yml'
11+
12+
pull_request:
13+
branches:
14+
- main
15+
- v2
16+
types: [ opened, synchronize ]
17+
paths:
18+
- 'ui/**'
19+
- '.github/workflows/ui-ci.yml'
20+
21+
jobs:
22+
# Lint job - runs on PR and push
23+
lint:
24+
name: "Lint"
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
working-directory: ./ui
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Setup pnpm
35+
uses: pnpm/action-setup@v4
36+
with:
37+
version: 10.11.0
38+
run_install: 'true'
39+
40+
- name: Run ESLint
41+
run: pnpm lint
42+
43+
# Test job - runs on PR and push
44+
test:
45+
name: "Test"
46+
runs-on: ubuntu-latest
47+
defaults:
48+
run:
49+
working-directory: ./ui
50+
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v4
54+
55+
- name: Setup pnpm
56+
uses: pnpm/action-setup@v4
57+
with:
58+
version: 10.11.0
59+
run_install: 'true'
60+
61+
- name: Run tests
62+
run: |
63+
if pnpm run test --if-present; then
64+
echo "Tests completed successfully"
65+
else
66+
echo "No tests found or tests failed, but continuing..."
67+
fi
68+
continue-on-error: true
69+
70+
- name: Upload test results
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: ui-test-results
74+
path: ui/coverage/
75+
if-no-files-found: ignore
76+
77+
# Build job - runs on PR and push
78+
build:
79+
name: "Build UI"
80+
runs-on: ubuntu-latest
81+
defaults:
82+
run:
83+
working-directory: ./ui
84+
85+
steps:
86+
- name: Checkout code
87+
uses: actions/checkout@v4
88+
89+
- name: Setup pnpm
90+
uses: pnpm/action-setup@v4
91+
with:
92+
version: 10.11.0
93+
run_install: 'true'
94+
95+
- name: Build application
96+
run: pnpm run build
97+
98+
- name: Upload build artifacts
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: ui-build
102+
path: ui/dist/
103+
retention-days: 7
104+
105+
# Type check job - runs on PR and push
106+
type-check:
107+
name: "Type Check"
108+
runs-on: ubuntu-latest
109+
defaults:
110+
run:
111+
working-directory: ./ui
112+
113+
steps:
114+
- name: Checkout code
115+
uses: actions/checkout@v4
116+
117+
- name: Setup pnpm
118+
uses: pnpm/action-setup@v4
119+
with:
120+
version: 10.11.0
121+
run_install: 'true'
122+
123+
- name: Run TypeScript type check
124+
run: pnpm tsc
125+
126+
# Test coverage report - runs only on PR
127+
test-coverage:
128+
name: "Test Coverage Report"
129+
if: github.event_name == 'pull_request'
130+
runs-on: ubuntu-latest
131+
needs: [ test ]
132+
continue-on-error: true
133+
defaults:
134+
run:
135+
working-directory: ./ui
136+
137+
permissions:
138+
contents: read
139+
pull-requests: write
140+
141+
steps:
142+
- name: Checkout code
143+
uses: actions/checkout@v4
144+
145+
- uses: pnpm/action-setup@v4
146+
with:
147+
version: 10.11.0
148+
run_install: true
149+
150+
- name: Generate coverage report
151+
uses: artiomtr/jest-coverage-report-action@v2
152+
with:
153+
test-script: pnpm jest --reporters="summary" --reporters="github-actions" --passWithNoTests --json --outputFile=report.json
154+
package-manager: pnpm
155+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)