Update changes #142
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| # Run unit tests before building the application | |
| run-unit-tests: | |
| name: Run unit tests | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| # Checkout repository code | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Verify CSP line exists in target TypeScript file | |
| - name: Check CSP configuration in webClientServer.ts | |
| shell: sh | |
| run: | | |
| TARGET_FILE="patched-vscode/src/vs/server/node/webClientServer.ts" | |
| 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;'" | |
| if [ ! -f "$TARGET_FILE" ]; then | |
| echo "❌ FAIL: Target file $TARGET_FILE does not exist." | |
| exit 1 | |
| fi | |
| if grep -F "$REQUIRED_TEXT" "$TARGET_FILE" > /dev/null; then | |
| echo "✅ PASS: Required CSP text exists." | |
| else | |
| echo "❌ FAIL: Required CSP text NOT found in $TARGET_FILE" | |
| exit 1 | |
| fi | |
| # The main job for building the application | |
| build: | |
| name: Build sagemaker-code-editor | |
| runs-on: ubuntu-22.04 | |
| # Ensure unit tests pass before building | |
| needs: run-unit-tests | |
| timeout-minutes: 180 | |
| env: | |
| DISABLE_V8_COMPILE_CACHE: 1 | |
| steps: | |
| - name: Checkout repo with submodules | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| 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 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| cache-dependency-path: '**/package-lock.json' | |
| - name: Apply patches (if any) | |
| run: | | |
| if [ -d patches ] && [ "$(ls -A patches)" ]; then | |
| { | |
| quilt push -a --leave-rejects --color=auto | |
| } || { | |
| printf "\nPatching error, review logs!\n" | |
| find ./vscode -name "*.rej" | |
| exit 1 | |
| } | |
| fi | |
| - name: Set Development Version | |
| id: version | |
| run: | | |
| SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) | |
| VERSION="0.0.0-dev-${SHORT_SHA}" | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "Generated version for this build: $VERSION" | |
| - name: Build vscode | |
| run: | | |
| cd vscode | |
| export DISABLE_V8_COMPILE_CACHE=1 | |
| export UV_THREADPOOL_SIZE=4 | |
| npm install -g node-gyp | |
| # Install dependencies using npm, skip optional and native modules | |
| npm install | |
| # Run the gulp build task with memory optimizations | |
| ARCH_ALIAS=linux-x64 | |
| node --max-old-space-size=32768 --optimize-for-size \ | |
| ./node_modules/gulp/bin/gulp.js \ | |
| "vscode-reh-web-${ARCH_ALIAS}-min" | |
| - name: Find build output | |
| id: find_output | |
| run: | | |
| BUILD_PATH=$(find . -name "vscode-reh-web-linux-x64" -type d | head -n 1) | |
| if [ -z "$BUILD_PATH" ]; then | |
| echo "::error::Build output directory 'vscode-reh-web-linux-x64' not found!" | |
| exit 1 | |
| fi | |
| echo "Build output found at: $BUILD_PATH" | |
| echo "build_path=$BUILD_PATH" >> $GITHUB_OUTPUT | |
| - name: Rename build output directory | |
| id: rename_output | |
| run: | | |
| ORIG_PATH="${{ steps.find_output.outputs.build_path }}" | |
| PARENT_DIR=$(dirname "$ORIG_PATH") | |
| mv "$ORIG_PATH" "$PARENT_DIR/sagemaker-code-editor" | |
| echo "Renamed build output directory to: $PARENT_DIR/sagemaker-code-editor" | |
| echo "build_path=$PARENT_DIR/sagemaker-code-editor" >> $GITHUB_OUTPUT | |
| - name: Create tarball archive | |
| run: | | |
| TARBALL="sagemaker-code-editor-${{ env.VERSION }}.tar.gz" | |
| BUILD_DIR_PATH="${{ steps.rename_output.outputs.build_path }}" | |
| PARENT_DIR=$(dirname "$BUILD_DIR_PATH") | |
| BUILD_DIR_NAME=$(basename "$BUILD_DIR_PATH") | |
| echo "Creating '$TARBALL' from '$BUILD_DIR_NAME' in '$PARENT_DIR'" | |
| tar czf $TARBALL -C "$PARENT_DIR" "$BUILD_DIR_NAME" | |
| - name: Upload build artifact | |
| if: env.ACT == '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: npm-package | |
| path: sagemaker-code-editor-${{ env.VERSION }}.tar.gz | |
| # Run end-to-end tests after the build is complete | |
| run-e2e-tests: | |
| name: Run e2e tests | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-22.04 | |
| needs: build # Ensure e2e tests run after build | |
| steps: | |
| # Checkout repository code | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Output placeholder message for e2e tests | |
| - name: Test of e2e test | |
| run: echo "Test of e2e test" |