-
Notifications
You must be signed in to change notification settings - Fork 0
190 lines (160 loc) · 4.98 KB
/
build_test_and_release.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: Test, Build & Release
on: push
permissions:
contents: read
id-token: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_VERSION: "21.2.0"
SKIP_E2E_CHECK: ${{ !contains(github.event.head_commit.message, '[skip_e2e]') }}
jobs:
setup:
name: 🔧 Setup
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '[skip_e2e]') }}
outputs:
cache-hit: ${{ steps.cache-node-modules.outputs.cache-hit }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
submodules: true
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Cache Playwright browsers
id: cache-playwright
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ hashFiles('package-lock.json') }}
- name: Install Playwright Browsers
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Update kittehub.zip
uses: ./.github/actions/update-kittehub
with:
pat-token: ${{ secrets.PAT_TOKEN }}
test:
name: 🧪 Testing ${{ matrix.browser }}
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
browser: ["Chrome", "Edge", "Firefox", "Safari"]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
submodules: true
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Restore cached dependencies
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Restore Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ hashFiles('package-lock.json') }}
- name: Setup test environment
uses: ./.github/actions/setup-test-env
with:
aws-role: ${{ secrets.AWS_GITHUB_ROLE }}
descope-project-id: ${{ secrets.VITE_DESCOPE_PROJECT_ID }}
browser: ${{ matrix.browser }}
- name: Run Playwright tests
env:
TESTS_JWT_AUTH_TOKEN: ${{ secrets.TESTS_JWT_AUTH_TOKEN }}
run: npx playwright test --project=${{ matrix.browser }}
- name: Upload test artifacts
if: always()
uses: ./.github/actions/upload-test-artifacts
with:
browser: ${{ matrix.browser }}
run-id: ${{ github.run_id }}
build:
needs: setup
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
submodules: true
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Restore cached dependencies
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Update kittehub.zip
uses: ./.github/actions/update-kittehub
with:
pat-token: ${{ secrets.PAT_TOKEN }}
- name: Build and verify
run: |
git submodule update --remote
npm run type-check
npm run lint:ci
npm run prettier:ci
npm run build
echo '!dist' >> .gitignore
- name: Upload Built Files
uses: actions/upload-artifact@v4
with:
name: built-files
path: dist
release:
needs: [build, test]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- uses: actions/download-artifact@v4
with:
name: built-files
path: ./dist
- name: Create ZIP of the dist directory
run: zip -r dist.zip dist
- name: Calculate SHA256 hash of dist.zip
run: |
SHA256=$(sha256sum dist.zip | awk '{ print $1 }')
echo "$SHA256" > dist.zip.sha256
echo "SHA256=$SHA256" >> $GITHUB_ENV
- name: Create release
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
HUSKY: 0
run: |
npm ci
npx semantic-release