@@ -9,9 +9,43 @@ concurrency:
99 cancel-in-progress : ${{ github.event_name == 'pull_request' }}
1010
1111jobs :
12+ # Run unit tests before building the application
13+
14+ run-unit-tests :
15+ name : Run unit tests
16+ runs-on : ubuntu-22.04
17+ steps :
18+ # Checkout repository code
19+ - name : Checkout code
20+ uses : actions/checkout@v4
21+
22+ # Verify CSP line exists in target TypeScript file
23+ - name : Check CSP configuration in webClientServer.ts
24+ shell : sh
25+ run : |
26+ TARGET_FILE="patched-vscode/src/vs/server/node/webClientServer.ts"
27+ REQUIRED_TEXT="'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://openvsxorg.blob.core.windows.net https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;'"
28+
29+ if [ ! -f "$TARGET_FILE" ]; then
30+ echo "❌ FAIL: Target file $TARGET_FILE does not exist."
31+ exit 1
32+ fi
33+
34+ if grep -F "$REQUIRED_TEXT" "$TARGET_FILE" > /dev/null; then
35+ echo "✅ PASS: Required CSP text exists."
36+ else
37+ echo "❌ FAIL: Required CSP text NOT found in $TARGET_FILE"
38+ exit 1
39+ fi
40+
41+
42+
43+ # The main job for building the application
1244 build :
1345 name : Build sagemaker-code-editor
14- runs-on : ubuntu-latest
46+ runs-on : ubuntu-22.04
47+ # Ensure unit tests pass before building
48+ needs : run-unit-tests
1549 timeout-minutes : 180
1650 env :
1751 DISABLE_V8_COMPILE_CACHE : 1
3771 - name : Apply patches (if any)
3872 run : |
3973 if [ -d patches ] && [ "$(ls -A patches)" ]; then
40- quilt push -a || true
74+ {
75+ quilt push -a --leave-rejects --color=auto
76+ } || {
77+ printf "\nPatching error, review logs!\n"
78+ find ./vscode -name "*.rej"
79+ exit 1
80+ }
4181 fi
4282
4383 - name : Set Development Version
@@ -53,18 +93,17 @@ jobs:
5393 cd vscode
5494 export DISABLE_V8_COMPILE_CACHE=1
5595 export UV_THREADPOOL_SIZE=4
96+
97+ npm install -g node-gyp
5698
99+ # Install dependencies using npm, skip optional and native modules
57100 npm install
58101
59- VSCODE_RIPGREP_VERSION=$(jq -r '.dependencies."@vscode/ripgrep"' package.json)
60- mv package.json package.json.orig
61- jq 'del(.dependencies."@vscode/ripgrep")' package.json.orig > package.json
62-
63- npm install
64- npm install --ignore-scripts "@vscode/ripgrep@${VSCODE_RIPGREP_VERSION}"
65-
102+ # Run the gulp build task with memory optimizations
66103 ARCH_ALIAS=linux-x64
67- npx gulp vscode-reh-web-${ARCH_ALIAS}-min
104+ node --max-old-space-size=32768 --optimize-for-size \
105+ ./node_modules/gulp/bin/gulp.js \
106+ "vscode-reh-web-${ARCH_ALIAS}-min"
68107
69108 - name : Find build output
70109 id : find_output
@@ -96,7 +135,23 @@ jobs:
96135 tar czf $TARBALL -C "$PARENT_DIR" "$BUILD_DIR_NAME"
97136
98137 - name : Upload build artifact
138+ if : env.ACT == ''
99139 uses : actions/upload-artifact@v4
100140 with :
101141 name : npm-package
102142 path : sagemaker-code-editor-${{ env.VERSION }}.tar.gz
143+ # Run end-to-end tests after the build is complete
144+ run-e2e-tests :
145+ name : Run e2e tests
146+ permissions :
147+ contents : read
148+ runs-on : ubuntu-22.04
149+ needs : build # Ensure e2e tests run after build
150+ steps :
151+ # Checkout repository code
152+ - name : Checkout code
153+ uses : actions/checkout@v4
154+
155+ # Output placeholder message for e2e tests
156+ - name : Test of e2e test
157+ run : echo "Test of e2e test"
0 commit comments