-
Notifications
You must be signed in to change notification settings - Fork 154
176 lines (144 loc) · 6.04 KB
/
ci.yml
File metadata and controls
176 lines (144 loc) · 6.04 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
172
173
174
175
176
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
pull-requests: write
jobs:
# Ubuntu build with MongoDB matrix (9 combinations: 3 Node × 3 MongoDB)
build-ubuntu:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20.x, 22.x, 24.x]
mongodb-version: ['6.0', '7.0', '8.0']
steps:
- name: Harden Runner
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.node-version }}
- name: Start MongoDB
uses: supercharge/mongodb-github-action@315db7fe45ac2880b7758f1933e6e5d59afd5e94 # 1.12.1
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Install dependencies
run: npm ci
# for now only check the types of the server
# tsconfig isn't quite set up right to respect what vite accepts
# for the frontend code
- name: Check Types (Server)
run: npm run check-types:server
- name: Build TypeScript
run: npm run build-ts
- name: Test
id: test
run: |
npm run test-coverage-ci
npm run test-coverage-ci --workspaces --if-present
- name: MongoDB Integration Tests
env:
RUN_MONGO_TESTS: 'true'
GIT_PROXY_MONGO_CONNECTION_STRING: mongodb://localhost:27017/git-proxy-test
run: npm run test:integration
- name: Upload test coverage report
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
files: ./coverage/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build frontend
run: npm run build-ui
- name: Save build folder
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: build-ubuntu-node-${{ matrix.node-version }}-mongo-${{ matrix.mongodb-version }}
if-no-files-found: error
path: build
- name: Download the build folders
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8
with:
name: build-ubuntu-node-${{ matrix.node-version }}-mongo-${{ matrix.mongodb-version }}
path: build
- name: Run cypress test
uses: cypress-io/github-action@bc22e01685c56e89e7813fd8e26f33dc47f87e15 # v7.1.5
with:
start: npm start &
wait-on: 'http://localhost:3000'
wait-on-timeout: 120
command: npm run cypress:run
# Windows build - single combination for development support
build-windows:
runs-on: windows-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Use Node.js 24.x
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24.x
- name: Enable Windows Developer Mode
shell: powershell
run: |
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
- name: Install dependencies
run: npm ci
- name: Check Types (Server)
run: npm run check-types:server
- name: Build TypeScript
run: npm run build-ts
- name: Test
id: test
shell: bash
run: |
npm run test-coverage-ci
npm run test-coverage-ci --workspaces --if-present
- name: Build frontend
run: npm run build-ui
# Execute a final job to collect the results and report a single check status
results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: build result
needs: [build-ubuntu, build-windows]
steps:
- name: Check build results
run: |
ubuntu_result="${{ needs.build-ubuntu.result }}"
windows_result="${{ needs.build-windows.result }}"
if [[ ($ubuntu_result == "success" || $ubuntu_result == "skipped") && ($windows_result == "success" || $windows_result == "skipped") ]]; then
echo "### ✅ All builds passed" >> $GITHUB_STEP_SUMMARY
exit 0
else
echo "### ❌ Some builds failed" >> $GITHUB_STEP_SUMMARY
echo "- Ubuntu: $ubuntu_result" >> $GITHUB_STEP_SUMMARY
echo "- Windows: $windows_result" >> $GITHUB_STEP_SUMMARY
exit 1
fi
- name: Parse failed matrix jobs
if: needs.build-ubuntu.result == 'failure' || needs.build-windows.result == 'failure'
run: |
echo "## Failed Matrix Combinations" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| OS | Node Version | MongoDB Version | Status |" >> $GITHUB_STEP_SUMMARY
echo "|----|--------------|-----------------|--------|" >> $GITHUB_STEP_SUMMARY
# Since we can't directly get individual matrix job statuses,
# we'll note that the build job failed
echo "| Multiple | Multiple | Multiple | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "⚠️ Check the [build job logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details on which specific matrix combinations failed." >> $GITHUB_STEP_SUMMARY