Skip to content

Commit 8e54c92

Browse files
authored
Create ci.yml
1 parent f3971dd commit 8e54c92

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

.github/workflows/ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18.x, 20.x]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run linter
30+
run: npm run lint
31+
32+
- name: Check formatting
33+
run: npm run format:check
34+
35+
- name: Type check
36+
run: npm run type-check
37+
38+
- name: Run tests
39+
run: npm run test:coverage
40+
41+
- name: Upload coverage to Codecov
42+
uses: codecov/codecov-action@v3
43+
with:
44+
file: ./coverage/lcov.info
45+
fail_ci_if_error: true
46+
47+
e2e:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: actions/setup-node@v4
52+
with:
53+
node-version: 18
54+
cache: 'npm'
55+
- name: Install dependencies
56+
run: npm ci
57+
- name: Install Playwright Browsers
58+
run: npx playwright install --with-deps
59+
- name: Run Playwright tests
60+
run: npm run test:e2e
61+
- uses: actions/upload-artifact@v3
62+
if: always()
63+
with:
64+
name: playwright-report
65+
path: playwright-report/
66+
retention-days: 30
67+
68+
deploy:
69+
needs: [test, e2e]
70+
runs-on: ubuntu-latest
71+
if: github.ref == 'refs/heads/main'
72+
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: actions/setup-node@v4
76+
with:
77+
node-version: 18
78+
cache: 'npm'
79+
- name: Install dependencies
80+
run: npm ci
81+
- name: Build
82+
run: npm run build
83+
- name: Deploy to Vercel
84+
uses: vercel/action@v1
85+
with:
86+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
87+
vercel-org-id: ${{ secrets.ORG_ID }}
88+
vercel-project-id: ${{ secrets.PROJECT_ID }}
89+
vercel-args: '--prod'

0 commit comments

Comments
 (0)