-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (134 loc) · 3.69 KB
/
ci.yml
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
name: Build, Tests, and Deploy
on:
push:
branches:
- main
- develop
- 'feature/**'
- 'release/**'
paths:
- '**.js'
- '**.ts'
- '**.jsx'
- '**.tsx'
- '**.json'
- '**.yml'
- 'public/**'
- '__tests__/**'
- '__e2e__/**'
pull_request:
branches:
- main
- develop
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
env:
NODE_VERSION: 20.x
jobs:
build:
name: Build Application
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Install Dependencies
run: npm ci
- name: Build Application
run: npm run build
- name: Cache Build Output
uses: actions/cache@v4
with:
path: |
.next/cache
node_modules
key: build-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
jest-test:
name: Run Jest Tests
needs: build
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Install Dependencies
run: npm ci
- name: Run Jest Tests
run: npm run test:coverage
- name: Upload Jest Coverage Report to Codecov
if: always()
uses: codecov/codecov-action@v5
with:
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
playwright-test:
name: Run Playwright Tests
needs: jest-test
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Install Dependencies
run: npm ci
- name: Install Playwright and Browsers
run: npx playwright install --with-deps
- name: Run Playwright Tests
run: npx playwright test
- name: Upload Playwright Test Results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30
deploy:
name: Deploy to Vercel
needs: playwright-test
if: ${{ github.ref_name == 'main' && success() }}
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Install Vercel CLI
run: |
npm install -g vercel@latest
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
summary:
name: Set Step Summary
needs: deploy
if: ${{ success() }}
runs-on: ubuntu-24.04
steps:
- name: Set step Summary
run: |
echo 'Deployment to Vercel successful 🚀' >> $GITHUB_STEP_SUMMARY