Skip to content

Commit ccb5d1d

Browse files
authored
Merge pull request #1361 from fabiovincenzi/windows-failing-tests
ci: add Windows to test matrix and fix cross-platform compatibility
2 parents 2150064 + 65c45bd commit ccb5d1d

11 files changed

Lines changed: 235 additions & 126 deletions

File tree

.github/workflows/ci.yml

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ permissions:
1313
pull-requests: write
1414

1515
jobs:
16-
build:
16+
# Ubuntu build with MongoDB matrix (9 combinations: 3 Node × 3 MongoDB)
17+
build-ubuntu:
1718
runs-on: ubuntu-latest
1819

1920
strategy:
@@ -38,7 +39,7 @@ jobs:
3839
node-version: ${{ matrix.node-version }}
3940

4041
- name: Start MongoDB
41-
uses: supercharge/mongodb-github-action@315db7fe45ac2880b7758f1933e6e5d59afd5e94 # ratchet:supercharge/mongodb-github-action@1.12.1
42+
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
4243
with:
4344
mongodb-version: ${{ matrix.mongodb-version }}
4445

@@ -65,24 +66,21 @@ jobs:
6566
with:
6667
files: ./coverage/lcov.info
6768
token: ${{ secrets.CODECOV_TOKEN }}
68-
# - name: Exit if coverage condition not met
69-
# if: ${{ steps.test.outputs.exit_code }} != 0
70-
# run: exit ${{ steps.test.outputs.exit_code }}
7169

7270
- name: Build frontend
7371
run: npm run build-ui
7472

7573
- name: Save build folder
76-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
74+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
7775
with:
78-
name: build-${{ matrix.node-version }}-mongo-${{ matrix.mongodb-version }}
76+
name: build-ubuntu-node-${{ matrix.node-version }}-mongo-${{ matrix.mongodb-version }}
7977
if-no-files-found: error
8078
path: build
8179

8280
- name: Download the build folders
83-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # ratchet:actions/download-artifact@v5
81+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
8482
with:
85-
name: build-${{ matrix.node-version }}-mongo-${{ matrix.mongodb-version }}
83+
name: build-ubuntu-node-${{ matrix.node-version }}-mongo-${{ matrix.mongodb-version }}
8684
path: build
8785

8886
- name: Run cypress test
@@ -93,37 +91,80 @@ jobs:
9391
wait-on-timeout: 120
9492
command: npm run cypress:run
9593

94+
# Windows build - single combination for development support
95+
build-windows:
96+
runs-on: windows-latest
97+
98+
steps:
99+
- name: Harden Runner
100+
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
101+
with:
102+
egress-policy: audit
103+
104+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
105+
with:
106+
fetch-depth: 0
107+
108+
- name: Use Node.js 24.x
109+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
110+
with:
111+
node-version: 24.x
112+
113+
- name: Enable Windows Developer Mode
114+
shell: powershell
115+
run: |
116+
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
117+
118+
- name: Install dependencies
119+
run: npm ci
120+
121+
- name: Check Types (Server)
122+
run: npm run check-types:server
123+
124+
- name: Build TypeScript
125+
run: npm run build-ts
126+
127+
- name: Test
128+
id: test
129+
shell: bash
130+
run: |
131+
npm run test-coverage-ci
132+
npm run test-coverage-ci --workspaces --if-present
133+
134+
- name: Build frontend
135+
run: npm run build-ui
136+
96137
# Execute a final job to collect the results and report a single check status
97138
results:
98139
if: ${{ always() }}
99140
runs-on: ubuntu-latest
100141
name: build result
101-
needs: [build]
142+
needs: [build-ubuntu, build-windows]
102143
steps:
103144
- name: Check build results
104145
run: |
105-
result="${{ needs.build.result }}"
106-
if [[ $result == "success" || $result == "skipped" ]]; then
146+
ubuntu_result="${{ needs.build-ubuntu.result }}"
147+
windows_result="${{ needs.build-windows.result }}"
148+
if [[ ($ubuntu_result == "success" || $ubuntu_result == "skipped") && ($windows_result == "success" || $windows_result == "skipped") ]]; then
107149
echo "### ✅ All builds passed" >> $GITHUB_STEP_SUMMARY
108150
exit 0
109151
else
110152
echo "### ❌ Some builds failed" >> $GITHUB_STEP_SUMMARY
153+
echo "- Ubuntu: $ubuntu_result" >> $GITHUB_STEP_SUMMARY
154+
echo "- Windows: $windows_result" >> $GITHUB_STEP_SUMMARY
111155
exit 1
112156
fi
113157
114158
- name: Parse failed matrix jobs
115-
if: needs.build.result == 'failure'
159+
if: needs.build-ubuntu.result == 'failure' || needs.build-windows.result == 'failure'
116160
run: |
117161
echo "## Failed Matrix Combinations" >> $GITHUB_STEP_SUMMARY
118162
echo "" >> $GITHUB_STEP_SUMMARY
119-
echo "| Node Version | MongoDB Version | Status |" >> $GITHUB_STEP_SUMMARY
120-
echo "|--------------|-----------------|--------|" >> $GITHUB_STEP_SUMMARY
121-
122-
# Parse the matrix results from the build job
123-
results='${{ toJSON(needs.build.outputs) }}'
163+
echo "| OS | Node Version | MongoDB Version | Status |" >> $GITHUB_STEP_SUMMARY
164+
echo "|----|--------------|-----------------|--------|" >> $GITHUB_STEP_SUMMARY
124165
125166
# Since we can't directly get individual matrix job statuses,
126167
# we'll note that the build job failed
127-
echo "| Multiple | Multiple | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
168+
echo "| Multiple | Multiple | Multiple | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
128169
echo "" >> $GITHUB_STEP_SUMMARY
129170
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

.github/workflows/unused-dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
node-version: '22.x'
2222
- name: 'Run depcheck'
2323
run: |
24-
npx depcheck --skip-missing --ignores="tsx,@babel/*,@commitlint/*,eslint,eslint-*,husky,ts-node,concurrently,nyc,prettier,typescript,tsconfig-paths,vite-tsconfig-paths,quicktype,history,@types/domutils,@vitest/coverage-v8"
24+
npx depcheck --skip-missing --ignores="tsx,@babel/*,@commitlint/*,eslint,eslint-*,husky,ts-node,concurrently,nyc,prettier,typescript,tsconfig-paths,vite-tsconfig-paths,quicktype,history,@types/domutils,@vitest/coverage-v8,cross-env"
2525
echo $?
2626
if [[ $? == 1 ]]; then
2727
echo "Unused dependencies or devDependencies found"

package-lock.json

Lines changed: 42 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@
4949
"server": "ALLOWED_ORIGINS=* tsx index.ts",
5050
"start": "concurrently \"npm run server\" \"npm run client\"",
5151
"build": "npm run generate-config-types && npm run build-ui && npm run build-ts",
52-
"build-ts": "tsc --project tsconfig.publish.json && ./scripts/fix-shebang.sh",
52+
"build-ts": "tsc --project tsconfig.publish.json && node scripts/fix-shebang.js",
5353
"build-ui": "vite build",
5454
"check-types": "tsc",
5555
"check-types:server": "tsc --project tsconfig.publish.json --noEmit",
56-
"test": "NODE_ENV=test vitest --run --dir ./test",
56+
"test": "cross-env NODE_ENV=test vitest --run --dir ./test",
5757
"test:e2e": "vitest run --config vitest.config.e2e.ts",
5858
"test:e2e:watch": "vitest --config vitest.config.e2e.ts",
59-
"test-coverage": "NODE_ENV=test vitest --run --dir ./test --coverage",
60-
"test-coverage-ci": "NODE_ENV=test vitest --run --dir ./test --coverage.enabled=true --coverage.reporter=lcovonly --coverage.reporter=text",
61-
"test-watch": "NODE_ENV=test vitest --dir ./test --watch",
59+
"test-coverage": "cross-env NODE_ENV=test vitest --run --dir ./test --coverage",
60+
"test-coverage-ci": "cross-env NODE_ENV=test vitest --run --dir ./test --coverage.enabled=true --coverage.reporter=lcovonly --coverage.reporter=text",
61+
"test-watch": "cross-env NODE_ENV=test vitest --dir ./test --watch",
6262
"prepare": "node ./scripts/prepare.js",
6363
"lint": "eslint",
6464
"lint:fix": "eslint --fix",
@@ -152,6 +152,7 @@
152152
"@types/yargs": "^17.0.35",
153153
"@vitejs/plugin-react": "^5.1.2",
154154
"@vitest/coverage-v8": "^3.2.4",
155+
"cross-env": "^10.1.0",
155156
"cypress": "^15.9.0",
156157
"eslint": "^9.39.2",
157158
"eslint-config-prettier": "^10.1.8",

scripts/fix-shebang.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
6+
const distIndexPath = path.join(__dirname, '..', 'dist', 'index.js');
7+
8+
if (fs.existsSync(distIndexPath)) {
9+
let content = fs.readFileSync(distIndexPath, 'utf-8');
10+
// Replace tsx with node in the shebang (first line)
11+
content = content.replace(/^#!.*tsx/, '#!/usr/bin/env node');
12+
fs.writeFileSync(distIndexPath, content);
13+
console.log('Fixed shebang in dist/index.js');
14+
} else {
15+
console.log('dist/index.js not found, skipping shebang fix');
16+
}

scripts/fix-shebang.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/proxy/processors/push-action/preReceive.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ const exec = async (
1515
const step = new Step('executeExternalPreReceiveHook');
1616
let stderrTrimmed = '';
1717

18+
// Pre-receive hooks execute Unix shell scripts, which is not supported on Windows
19+
if (process.platform === 'win32') {
20+
step.log('Warning: Pre-receive hooks are not supported on Windows, skipping execution.');
21+
action.addStep(step);
22+
return action;
23+
}
24+
1825
try {
1926
const resolvedPath = path.resolve(hookFilePath);
2027
const hookDir = path.dirname(resolvedPath);

0 commit comments

Comments
 (0)