1- # Workflow name
21name : Build
32
4- # This workflow is triggered on pushes and pull requests to the main branch.
53on :
64 push :
7- # branches:
8- # - main
95 pull_request :
10- # branches:
11- # - main
126
13- # Concurrency settings to cancel in-progress runs for the same PR or branch
14- # This prevents wasting resources on outdated commits.
157concurrency :
168 group : ${{ github.workflow }}-${{ github.ref }}
179 cancel-in-progress : ${{ github.event_name == 'pull_request' }}
1810
1911jobs :
20- # Run unit tests before building the application
21-
22- run-unit-tests :
23- name : Run unit tests
24- runs-on : ubuntu-latest
25- steps :
26- # Checkout repository code
27- - name : Checkout code
28- uses : actions/checkout@v4
29-
30- # Verify CSP line exists in target TypeScript file
31- - name : Check CSP configuration in webClientServer.ts
32- run : |
33- TARGET_FILE="patched-vscode/src/vs/server/node/webClientServer.ts"
34- 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;'"
35-
36- if [ ! -f "$TARGET_FILE" ]; then
37- echo "❌ FAIL: Target file $TARGET_FILE does not exist."
38- exit 1
39- fi
40-
41- if grep -F "$REQUIRED_TEXT" "$TARGET_FILE" > /dev/null; then
42- echo "✅ PASS: Required CSP text exists."
43- else
44- echo "❌ FAIL: Required CSP text NOT found in $TARGET_FILE"
45- exit 1
46- fi
47-
48-
49-
50- # The main job for building the application
5112 build :
5213 name : Build sagemaker-code-editor
5314 runs-on : ubuntu-latest
54- # Ensure unit tests pass before building
55- needs : run-unit-tests
5615 timeout-minutes : 180
5716 env :
58- # Environment variable to optimize the build process
5917 DISABLE_V8_COMPILE_CACHE : 1
6018
6119 steps :
62- # Step 1: Check out the repository code, including its submodules.
6320 - name : Checkout repo with submodules
6421 uses : actions/checkout@v4
6522 with :
6623 submodules : recursive
6724
68- # Step 2: Install system-level dependencies required for the build.
6925 - name : Install system dependencies
7026 run : |
7127 sudo apt-get update
7228 sudo apt-get install -y make gcc g++ libx11-dev xorg-dev libxkbfile-dev libsecret-1-dev libkrb5-dev python3 jq perl gettext automake autoconf quilt
7329
74- # Step 3: Set up the Node.js environment. Version 20 is specified.
7530 - name : Set up Node.js
7631 uses : actions/setup-node@v4
7732 with :
7833 node-version : 20
79- # Use npm for caching, not yarn
8034 cache : ' npm'
8135 cache-dependency-path : ' **/package-lock.json'
8236
83- # Step 4: Apply patches from the 'patches' directory if it exists.
8437 - name : Apply patches (if any)
8538 run : |
8639 if [ -d patches ] && [ "$(ls -A patches)" ]; then
87- set -e
88- quilt push -a
40+ quilt push -a || true
8941 fi
9042
91- # Step 5: Generate a version string for this specific build.
92- # It's based on the commit SHA to create a unique identifier.
9343 - name : Set Development Version
9444 id : version
9545 run : |
@@ -98,32 +48,24 @@ jobs:
9848 echo "VERSION=$VERSION" >> $GITHUB_ENV
9949 echo "Generated version for this build: $VERSION"
10050
101- # Step 6: The main build process for vscode, now using npm.
10251 - name : Build vscode
10352 run : |
10453 cd vscode
10554 export DISABLE_V8_COMPILE_CACHE=1
10655 export UV_THREADPOOL_SIZE=4
10756
108- # Install dependencies using npm
10957 npm install
11058
111- # The logic for temporarily removing and re-adding ripgrep remains
11259 VSCODE_RIPGREP_VERSION=$(jq -r '.dependencies."@vscode/ripgrep"' package.json)
11360 mv package.json package.json.orig
11461 jq 'del(.dependencies."@vscode/ripgrep")' package.json.orig > package.json
11562
116- # Re-run install to remove ripgrep
11763 npm install
118-
119- # Add ripgrep back using npm
12064 npm install --ignore-scripts "@vscode/ripgrep@${VSCODE_RIPGREP_VERSION}"
12165
12266 ARCH_ALIAS=linux-x64
123- # Run the gulp build task using npx
12467 npx gulp vscode-reh-web-${ARCH_ALIAS}-min
12568
126- # Step 7: Find the exact path of the original build output directory.
12769 - name : Find build output
12870 id : find_output
12971 run : |
13577 echo "Build output found at: $BUILD_PATH"
13678 echo "build_path=$BUILD_PATH" >> $GITHUB_OUTPUT
13779
138- # Step 8: Rename the build output directory to sagemaker-code-editor
13980 - name : Rename build output directory
14081 id : rename_output
14182 run : |
14586 echo "Renamed build output directory to: $PARENT_DIR/sagemaker-code-editor"
14687 echo "build_path=$PARENT_DIR/sagemaker-code-editor" >> $GITHUB_OUTPUT
14788
148- # Step 9: Create a compressed tarball of the renamed build output.
14989 - name : Create tarball archive
15090 run : |
15191 TARBALL="sagemaker-code-editor-${{ env.VERSION }}.tar.gz"
@@ -155,22 +95,8 @@ jobs:
15595 echo "Creating '$TARBALL' from '$BUILD_DIR_NAME' in '$PARENT_DIR'"
15696 tar czf $TARBALL -C "$PARENT_DIR" "$BUILD_DIR_NAME"
15797
158- # Step 10: Upload the tarball as a build artifact.
15998 - name : Upload build artifact
16099 uses : actions/upload-artifact@v4
161100 with :
162101 name : npm-package
163102 path : sagemaker-code-editor-${{ env.VERSION }}.tar.gz
164- # Run end-to-end tests after the build is complete
165- run-e2e-tests :
166- name : Run e2e tests
167- runs-on : ubuntu-latest
168- needs : build # Ensure e2e tests run after build
169- steps :
170- # Checkout repository code
171- - name : Checkout code
172- uses : actions/checkout@v4
173-
174- # Output placeholder message for e2e tests
175- - name : Test of e2e test
176- run : echo "Test of e2e test"
0 commit comments