Merge remote-tracking branch 'origin/main' into rebornix/minimum-newt

This commit is contained in:
Peng Lyu
2025-09-17 09:43:29 -07:00
53 changed files with 948 additions and 240 deletions

View File

@@ -1,10 +1,7 @@
name: Copilot Setup Steps
# This workflow customizes the ephemeral GitHub Copilot coding agent environment.
# It preinstalls dependencies and warms caches to speed up iterative agent tasks.
# NOTE: The single job MUST be named `copilot-setup-steps`.
# Supported customizations: runs-on, permissions, steps, container, services, snapshot, timeout-minutes.
name: "Copilot Setup Steps"
# Automatically run the setup steps when they are changed to allow for easy validation, and
# allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
@@ -15,68 +12,98 @@ on:
- .github/workflows/copilot-setup-steps.yml
jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: macos-14-xlarge
timeout-minutes: 30
# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
contents: read
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
# You can define any steps you want, and they will run before the agent starts.
# If you do not check out your code, Copilot will do this for you.
steps:
- name: Checkout repository
- name: Checkout microsoft/vscode
uses: actions/checkout@v5
- name: Setup Node.js (from .nvmrc + npm cache)
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
cache: npm
- name: Compute node_modules cache key
- name: Setup system services
run: |
set -e
mkdir -p .build
node build/azure-pipelines/common/computeNodeModulesCacheKey.js copilot $(node -p process.arch) > .build/packagelockhash
# Start X server
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get update
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y pkg-config \
xvfb \
libgtk-3-0 \
libxkbfile-dev \
libkrb5-dev \
libgbm1 \
rpm
sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
sudo chmod +x /etc/init.d/xvfb
sudo update-rc.d xvfb defaults
sudo service xvfb start
- name: Prepare node_modules cache key
run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.js linux x64 $(node -p process.arch) > .build/packagelockhash
- name: Restore node_modules cache
id: cache-node-modules
uses: actions/cache/restore@v4
with:
path: .build/node_modules_cache
key: node_modules-copilot-${{ hashFiles('.build/packagelockhash') }}
key: "node_modules-linux-${{ hashFiles('.build/packagelockhash') }}"
- name: Extract node_modules cache
if: steps.cache-node-modules.outputs.cache-hit == 'true'
run: tar -xzf .build/node_modules_cache/cache.tgz
- name: Install build essentials (cache miss only)
- name: Install build dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
working-directory: build
run: |
set -e
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends \
build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libkrb5-dev libnotify-bin
- name: Install dependencies (retry up to 5x)
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: |
set -e
for i in {1..5}; do
if npm ci; then
break
fi
for i in {1..5}; do # try 5 times
npm ci && break
if [ $i -eq 5 ]; then
echo "npm ci failed too many times" >&2
echo "Npm install failed too many times" >&2
exit 1
fi
echo "Retrying npm ci ($i)..."
sleep 5
echo "Npm install failed $i, trying again..."
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create node_modules archive (cache miss only)
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: |
set -e
source ./build/azure-pipelines/linux/setup-env.sh
for i in {1..5}; do # try 5 times
npm ci && break
if [ $i -eq 5 ]; then
echo "Npm install failed too many times" >&2
exit 1
fi
echo "Npm install failed $i, trying again..."
done
env:
npm_config_arch: x64
VSCODE_ARCH: x64
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create node_modules archive
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: |
set -e
@@ -84,11 +111,10 @@ jobs:
mkdir -p .build/node_modules_cache
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
- name: Transpile sources (non-blocking)
continue-on-error: true
run: npm run gulp transpile-client-esbuild transpile-extensions
- name: Create .build folder
run: mkdir -p .build
- name: Compute built-in extensions cache key
- name: Prepare built-in extensions cache key
run: node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
- name: Restore built-in extensions cache
@@ -97,15 +123,138 @@ jobs:
with:
enableCrossOsArchive: true
path: .build/builtInExtensions
key: builtin-extensions-${{ hashFiles('.build/builtindepshash') }}
key: "builtin-extensions-${{ hashFiles('.build/builtindepshash') }}"
- name: Download built-in extensions (if cache miss)
- name: Download built-in extensions
if: steps.cache-builtin-extensions.outputs.cache-hit != 'true'
run: node build/lib/builtInExtensions.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Environment summary
# - name: Transpile client and extensions
# run: npm run gulp transpile-client-esbuild transpile-extensions
- name: Download Electron and Playwright
run: |
echo "Node: $(node -v)" || true
echo "NPM: $(npm -v)" || true
du -sh node_modules 2>/dev/null || true
df -h || true
set -e
for i in {1..3}; do # try 3 times (matching retryCountOnTaskFailure: 3)
if npm exec -- npm-run-all -lp "electron x64" "playwright-install"; then
echo "Download successful on attempt $i"
break
fi
if [ $i -eq 3 ]; then
echo "Download failed after 3 attempts" >&2
exit 1
fi
echo "Download failed on attempt $i, retrying..."
sleep 5 # optional: add a small delay between retries
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: 🧪 Run unit tests (Electron)
# if: ${{ inputs.electron_tests }}
# timeout-minutes: 15
# run: ./scripts/test.sh --tfs "Unit Tests"
# env:
# DISPLAY: ":10"
# - name: 🧪 Run unit tests (node.js)
# if: ${{ inputs.electron_tests }}
# timeout-minutes: 15
# run: npm run test-node
# - name: 🧪 Run unit tests (Browser, Chromium)
# if: ${{ inputs.browser_tests }}
# timeout-minutes: 30
# run: npm run test-browser-no-install -- --browser chromium --tfs "Browser Unit Tests"
# env:
# DEBUG: "*browser*"
# - name: Build integration tests
# run: |
# set -e
# npm run gulp \
# compile-extension:configuration-editing \
# compile-extension:css-language-features-server \
# compile-extension:emmet \
# compile-extension:git \
# compile-extension:github-authentication \
# compile-extension:html-language-features-server \
# compile-extension:ipynb \
# compile-extension:notebook-renderers \
# compile-extension:json-language-features-server \
# compile-extension:markdown-language-features \
# compile-extension-media \
# compile-extension:microsoft-authentication \
# compile-extension:typescript-language-features \
# compile-extension:vscode-api-tests \
# compile-extension:vscode-colorize-tests \
# compile-extension:vscode-colorize-perf-tests \
# compile-extension:vscode-test-resolver
# - name: 🧪 Run integration tests (Electron)
# if: ${{ inputs.electron_tests }}
# timeout-minutes: 20
# run: ./scripts/test-integration.sh --tfs "Integration Tests"
# env:
# DISPLAY: ":10"
# - name: 🧪 Run integration tests (Browser, Chromium)
# if: ${{ inputs.browser_tests }}
# timeout-minutes: 20
# run: ./scripts/test-web-integration.sh --browser chromium
# - name: 🧪 Run integration tests (Remote)
# if: ${{ inputs.remote_tests }}
# timeout-minutes: 20
# run: ./scripts/test-remote-integration.sh
# env:
# DISPLAY: ":10"
# - name: Compile smoke tests
# working-directory: test/smoke
# run: npm run compile
# - name: Compile extensions for smoke tests
# run: npm run gulp compile-extension-media
# - name: Diagnostics before smoke test run (processes, max_user_watches, number of opened file handles)
# run: |
# set -e
# ps -ef
# cat /proc/sys/fs/inotify/max_user_watches
# lsof | wc -l
# continue-on-error: true
# if: always()
# - name: 🧪 Run smoke tests (Electron)
# if: ${{ inputs.electron_tests }}
# timeout-minutes: 20
# run: npm run smoketest-no-compile -- --tracing
# env:
# DISPLAY: ":10"
# - name: 🧪 Run smoke tests (Browser, Chromium)
# if: ${{ inputs.browser_tests }}
# timeout-minutes: 20
# run: npm run smoketest-no-compile -- --web --tracing --headless
# - name: 🧪 Run smoke tests (Remote)
# if: ${{ inputs.remote_tests }}
# timeout-minutes: 20
# run: npm run smoketest-no-compile -- --remote --tracing
# env:
# DISPLAY: ":10"
# - name: Diagnostics after smoke test run (processes, max_user_watches, number of opened file handles)
# run: |
# set -e
# ps -ef
# cat /proc/sys/fs/inotify/max_user_watches
# lsof | wc -l
# continue-on-error: true
# if: always()