diff --git a/.github/workflows/pr-darwin-test.yml b/.github/workflows/pr-darwin-test.yml new file mode 100644 index 00000000000..0f536f4cb36 --- /dev/null +++ b/.github/workflows/pr-darwin-test.yml @@ -0,0 +1,242 @@ +on: + workflow_call: + inputs: + job_name: + type: string + required: true + electron_tests: + type: boolean + default: false + browser_tests: + type: boolean + default: false + remote_tests: + type: boolean + default: false + +jobs: + macOS-test: + name: ${{ inputs.job_name }} + runs-on: macos-14-xlarge + env: + ARTIFACT_NAME: ${{ (inputs.electron_tests && 'electron') || (inputs.browser_tests && 'browser') || (inputs.remote_tests && 'remote') || 'unknown' }} + NPM_ARCH: arm64 + VSCODE_ARCH: arm64 + steps: + - name: Checkout microsoft/vscode + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + env: + NODEJS_ORG_MIRROR: https://github.com/joaomoreno/node-mirror/releases/download + + - name: Prepare node_modules cache key + run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.js darwin $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash + + - name: Restore node_modules cache + id: cache-node-modules + uses: actions/cache@v4 + with: + path: .build/node_modules_cache + key: "node_modules-${{ 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 dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: | + set -e + c++ --version + xcode-select -print-path + python3 -m pip install --break-system-packages setuptools + + 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: ${{ env.NPM_ARCH }} + VSCODE_ARCH: ${{ env.VSCODE_ARCH }} + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Avoid using dlopen to load Kerberos on macOS which can cause missing libraries + # https://github.com/mongodb-js/kerberos/commit/04044d2814ad1d01e77f1ce87f26b03d86692cf2 + # flipped the default to support legacy linux distros which shouldn't happen + # on macOS. + GYP_DEFINES: "kerberos_use_rtld=false" + + - name: Create node_modules archive + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: | + set -e + node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt + mkdir -p .build/node_modules_cache + tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt + + - name: Create .build folder + run: mkdir -p .build + + - name: Prepare built-in extensions cache key + run: node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash + + - name: Restore built-in extensions cache + id: cache-builtin-extensions + uses: actions/cache@v4 + with: + path: .build/builtInExtensions + key: "builtin-extensions-${{ hashFiles('.build/builtindepshash') }}" + + - 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: Transpile client and extensions + run: npm run gulp transpile-client-esbuild transpile-extensions + + - name: Download Electron and Playwright + run: | + set -e + + for i in {1..3}; do # try 3 times (matching retryCountOnTaskFailure: 3) + if npm exec -- npm-run-all -lp "electron ${{ env.VSCODE_ARCH }}" "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" + + - name: 🧪 Run unit tests (node.js) + if: ${{ inputs.electron_tests }} + timeout-minutes: 15 + run: npm run test-node + + - name: 🧪 Run unit tests (Browser, Webkit) + if: ${{ inputs.browser_tests }} + timeout-minutes: 30 + run: npm run test-browser-no-install -- --browser webkit --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" + + - name: 🧪 Run integration tests (Browser, Webkit) + if: ${{ inputs.browser_tests }} + timeout-minutes: 20 + run: ./scripts/test-web-integration.sh --browser webkit + + - name: 🧪 Run integration tests (Remote) + if: ${{ inputs.remote_tests }} + timeout-minutes: 20 + run: ./scripts/test-remote-integration.sh + + - 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 + run: ps -ef + 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 + + - 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 + + - name: Diagnostics after smoke test run + run: ps -ef + continue-on-error: true + if: always() + + - name: Publish Crash Reports + uses: actions/upload-artifact@v4 + if: failure() + continue-on-error: true + with: + name: ${{ format('crash-dump-macos-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }} + path: .build/crashes + if-no-files-found: ignore + + # In order to properly symbolify above crash reports + # (if any), we need the compiled native modules too + - name: Publish Node Modules + uses: actions/upload-artifact@v4 + if: failure() + continue-on-error: true + with: + name: ${{ format('node-modules-macos-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }} + path: node_modules + if-no-files-found: ignore + + - name: Publish Log Files + uses: actions/upload-artifact@v4 + if: always() + continue-on-error: true + with: + name: ${{ format('logs-macos-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }} + path: .build/logs + if-no-files-found: ignore diff --git a/.github/workflows/pr-linux-cli-test.yml b/.github/workflows/pr-linux-cli-test.yml new file mode 100644 index 00000000000..7466c639cae --- /dev/null +++ b/.github/workflows/pr-linux-cli-test.yml @@ -0,0 +1,46 @@ +on: + workflow_call: + inputs: + job_name: + type: string + required: true + rustup_toolchain: + type: string + required: true + +jobs: + linux-cli-test: + name: ${{ inputs.job_name }} + runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64 ] + env: + RUSTUP_TOOLCHAIN: ${{ inputs.rustup_toolchain }} + steps: + - name: Checkout microsoft/vscode + uses: actions/checkout@v4 + + - name: Install Rust + run: | + set -e + curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain $RUSTUP_TOOLCHAIN + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Set Rust version + run: | + set -e + rustup default $RUSTUP_TOOLCHAIN + rustup update $RUSTUP_TOOLCHAIN + rustup component add clippy + + - name: Check Rust versions + run: | + set -e + rustc --version + cargo --version + + - name: Clippy lint + run: cargo clippy -- -D warnings + working-directory: cli + + - name: 🧪 Run unit tests + run: cargo test + working-directory: cli diff --git a/.github/workflows/pr-linux-test.yml b/.github/workflows/pr-linux-test.yml new file mode 100644 index 00000000000..6e75ada8b84 --- /dev/null +++ b/.github/workflows/pr-linux-test.yml @@ -0,0 +1,288 @@ +on: + workflow_call: + inputs: + job_name: + type: string + required: true + electron_tests: + type: boolean + default: false + browser_tests: + type: boolean + default: false + remote_tests: + type: boolean + default: false + +jobs: + linux-test: + name: ${{ inputs.job_name }} + runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64 ] + env: + ARTIFACT_NAME: ${{ (inputs.electron_tests && 'electron') || (inputs.browser_tests && 'browser') || (inputs.remote_tests && 'remote') || 'unknown' }} + NPM_ARCH: x64 + VSCODE_ARCH: x64 + steps: + - name: Checkout microsoft/vscode + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + env: + NODEJS_ORG_MIRROR: https://github.com/joaomoreno/node-mirror/releases/download + + - name: Setup system services + run: | + set -e + # 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 $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash + + - name: Restore node_modules cache + id: cache-node-modules + uses: actions/cache@v4 + with: + path: .build/node_modules_cache + key: "node_modules-${{ 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 dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + working-directory: build + run: | + set -e + + 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: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - 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: ${{ env.NPM_ARCH }} + VSCODE_ARCH: ${{ env.VSCODE_ARCH }} + 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 + node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt + mkdir -p .build/node_modules_cache + tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt + + - name: Create .build folder + run: mkdir -p .build + + - name: Prepare built-in extensions cache key + run: node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash + + - name: Restore built-in extensions cache + id: cache-builtin-extensions + uses: actions/cache@v4 + with: + path: .build/builtInExtensions + key: "builtin-extensions-${{ hashFiles('.build/builtindepshash') }}" + + - 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: Transpile client and extensions + run: npm run gulp transpile-client-esbuild transpile-extensions + + - name: Download Electron and Playwright + run: | + set -e + + for i in {1..3}; do # try 3 times (matching retryCountOnTaskFailure: 3) + if npm exec -- npm-run-all -lp "electron ${{ env.VSCODE_ARCH }}" "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() + + - name: Publish Crash Reports + uses: actions/upload-artifact@v4 + if: failure() + continue-on-error: true + with: + name: ${{ format('crash-dump-linux-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }} + path: .build/crashes + if-no-files-found: ignore + + # In order to properly symbolify above crash reports + # (if any), we need the compiled native modules too + - name: Publish Node Modules + uses: actions/upload-artifact@v4 + if: failure() + continue-on-error: true + with: + name: ${{ format('node-modules-linux-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }} + path: node_modules + if-no-files-found: ignore + + - name: Publish Log Files + uses: actions/upload-artifact@v4 + if: always() + continue-on-error: true + with: + name: ${{ format('logs-linux-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }} + path: .build/logs + if-no-files-found: ignore diff --git a/.github/workflows/pr-win32-test.yml b/.github/workflows/pr-win32-test.yml new file mode 100644 index 00000000000..35b39311be5 --- /dev/null +++ b/.github/workflows/pr-win32-test.yml @@ -0,0 +1,279 @@ +on: + workflow_call: + inputs: + job_name: + type: string + required: true + electron_tests: + type: boolean + default: false + browser_tests: + type: boolean + default: false + remote_tests: + type: boolean + default: false + +jobs: + windows-test: + name: ${{ inputs.job_name }} + runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-windows-2022-x64 ] + env: + ARTIFACT_NAME: ${{ (inputs.electron_tests && 'electron') || (inputs.browser_tests && 'browser') || (inputs.remote_tests && 'remote') || 'unknown' }} + NPM_ARCH: x64 + VSCODE_ARCH: x64 + steps: + - name: Checkout microsoft/vscode + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + env: + NODEJS_ORG_MIRROR: https://github.com/joaomoreno/node-mirror/releases/download + + - name: Prepare node_modules cache key + shell: pwsh + run: | + mkdir .build -ea 0 + node build/azure-pipelines/common/computeNodeModulesCacheKey.js win32 ${{ env.VSCODE_ARCH }} $(node -p process.arch) > .build/packagelockhash + + - name: Restore node_modules cache + uses: actions/cache@v4 + id: node-modules-cache + with: + path: .build/node_modules_cache + key: "node_modules-${{ hashFiles('.build/packagelockhash') }}" + + - name: Extract node_modules cache + if: steps.node-modules-cache.outputs.cache-hit == 'true' + shell: pwsh + run: 7z.exe x .build/node_modules_cache/cache.7z -aoa + + - name: Install dependencies + if: steps.node-modules-cache.outputs.cache-hit != 'true' + shell: pwsh + run: | + . build/azure-pipelines/win32/exec.ps1 + $ErrorActionPreference = "Stop" + + for ($i = 1; $i -le 5; $i++) { + try { + exec { npm ci } + break + } + catch { + if ($i -eq 5) { + Write-Error "npm ci failed after 5 attempts" + throw + } + Write-Host "npm ci failed attempt $i, retrying..." + Start-Sleep -Seconds 2 + } + } + env: + npm_config_arch: ${{ env.NPM_ARCH }} + npm_config_foreground_scripts: "true" + VSCODE_ARCH: ${{ env.VSCODE_ARCH }} + ELECTRON_SKIP_BINARY_DOWNLOAD: 1 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create node_modules archive + if: steps.node-modules-cache.outputs.cache-hit != 'true' + shell: pwsh + run: | + . build/azure-pipelines/win32/exec.ps1 + $ErrorActionPreference = "Stop" + exec { node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt } + exec { mkdir -Force .build/node_modules_cache } + exec { 7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt } + + - name: Create .build folder + shell: pwsh + run: mkdir .build -ea 0 + + - name: Prepare built-in extensions cache key + shell: pwsh + run: node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash + + - name: Restore built-in extensions cache + id: cache-builtin-extensions + uses: actions/cache@v4 + with: + path: .build/builtInExtensions + key: "builtin-extensions-${{ hashFiles('.build/builtindepshash') }}" + + - 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: Transpile client and extensions + shell: pwsh + run: npm run gulp "transpile-client-esbuild" "transpile-extensions" + + - name: Download Electron and Playwright + shell: pwsh + run: | + for ($i = 1; $i -le 3; $i++) { + try { + npm exec -- -- npm-run-all -lp "electron ${{ env.VSCODE_ARCH }}" "playwright-install" + break + } + catch { + if ($i -eq 3) { + Write-Error "Download failed after 3 attempts" + throw + } + Write-Host "Download failed attempt $i, retrying..." + Start-Sleep -Seconds 2 + } + } + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: 🧪 Run unit tests (Electron) + if: ${{ inputs.electron_tests }} + shell: pwsh + run: .\scripts\test.bat --tfs "Unit Tests" + timeout-minutes: 15 + + - name: 🧪 Run unit tests (node.js) + if: ${{ inputs.electron_tests }} + shell: pwsh + run: npm run test-node + timeout-minutes: 15 + + - name: 🧪 Run unit tests (Browser, Chromium) + if: ${{ inputs.browser_tests }} + shell: pwsh + run: node test/unit/browser/index.js --browser chromium --tfs "Browser Unit Tests" + env: + DEBUG: "*browser*" + timeout-minutes: 20 + + - name: Build integration tests + shell: pwsh + run: | + . build/azure-pipelines/win32/exec.ps1 + $ErrorActionPreference = "Stop" + exec { 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: Diagnostics before integration test runs + shell: pwsh + run: .\build\azure-pipelines\win32\listprocesses.bat + continue-on-error: true + if: always() + + - name: 🧪 Run integration tests (Electron) + if: ${{ inputs.electron_tests }} + shell: pwsh + run: .\scripts\test-integration.bat --tfs "Integration Tests" + timeout-minutes: 20 + + - name: 🧪 Run integration tests (Browser, Chromium) + if: ${{ inputs.browser_tests }} + shell: pwsh + run: .\scripts\test-web-integration.bat --browser chromium + timeout-minutes: 20 + + - name: 🧪 Run integration tests (Remote) + if: ${{ inputs.remote_tests }} + shell: pwsh + run: .\scripts\test-remote-integration.bat + timeout-minutes: 20 + + - name: Diagnostics after integration test runs + shell: pwsh + run: .\build\azure-pipelines\win32\listprocesses.bat + continue-on-error: true + if: always() + + - name: Diagnostics before smoke test run + shell: pwsh + run: .\build\azure-pipelines\win32\listprocesses.bat + continue-on-error: true + if: always() + + - name: Compile smoke tests + working-directory: test/smoke + shell: pwsh + run: npm run compile + + - name: Compile extensions for smoke tests + shell: pwsh + run: npm run gulp compile-extension-media + + - name: 🧪 Run smoke tests (Electron) + if: ${{ inputs.electron_tests }} + timeout-minutes: 20 + shell: pwsh + run: npm run smoketest-no-compile -- -- --tracing + + - name: 🧪 Run smoke tests (Browser, Chromium) + if: ${{ inputs.browser_tests }} + timeout-minutes: 20 + shell: pwsh + run: npm run smoketest-no-compile -- -- --web --tracing --headless + + - name: 🧪 Run smoke tests (Remote) + if: ${{ inputs.remote_tests }} + timeout-minutes: 20 + shell: pwsh + run: npm run smoketest-no-compile -- -- --remote --tracing + + - name: Diagnostics after smoke test run + shell: pwsh + run: .\build\azure-pipelines\win32\listprocesses.bat + continue-on-error: true + if: always() + + - name: Publish Crash Reports + uses: actions/upload-artifact@v4 + if: failure() + continue-on-error: true + with: + name: ${{ format('crash-dump-windows-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }} + path: .build/crashes + if-no-files-found: ignore + + # In order to properly symbolify above crash reports + # (if any), we need the compiled native modules too + - name: Publish Node Modules + uses: actions/upload-artifact@v4 + if: failure() + continue-on-error: true + with: + name: ${{ format('node-modules-windows-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }} + path: node_modules + if-no-files-found: ignore + + - name: Publish Log Files + uses: actions/upload-artifact@v4 + if: always() + continue-on-error: true + with: + name: ${{ format('logs-windows-{0}-{1}-{2}', env.VSCODE_ARCH, env.ARTIFACT_NAME, github.run_attempt) }} + path: .build/logs + if-no-files-found: ignore diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000000..004e125ec04 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,148 @@ +name: Code OSS + +on: + pull_request: + branches: + - main + - 'release/*' + +permissions: {} + +jobs: + compile: + name: Compile & Hygiene + runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64 ] + steps: + - name: Checkout microsoft/vscode + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + env: + NODEJS_ORG_MIRROR: https://github.com/joaomoreno/node-mirror/releases/download + + - name: Prepare node_modules cache key + run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.js compile $(node -p process.arch) > .build/packagelockhash + + - name: Restore node_modules cache + id: cache-node-modules + uses: actions/cache@v4 + with: + path: .build/node_modules_cache + key: "node_modules-${{ 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 tools + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: sudo apt update -y && sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev + + - name: Install dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: | + set -e + + 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: + 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 + node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt + mkdir -p .build/node_modules_cache + tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt + + - name: Compile /build/ folder + run: npm run compile + working-directory: build + + - name: Check /build/ folder + run: .github/workflows/check-clean-git-state.sh + + - name: Compile & Hygiene + run: npm exec -- npm-run-all -lp core-ci-pr extensions-ci-pr hygiene eslint valid-layers-check define-class-fields-check vscode-dts-compile-check tsec-compile-check + + linux-cli-tests: + name: Linux + uses: ./.github/workflows/pr-linux-cli-test.yml + with: + job_name: CLI + rustup_toolchain: 1.85 + + linux-electron-tests: + name: Linux + uses: ./.github/workflows/pr-linux-test.yml + with: + job_name: Electron + electron_tests: true + + linux-browser-tests: + name: Linux + uses: ./.github/workflows/pr-linux-test.yml + with: + job_name: Browser + browser_tests: true + + linux-remote-tests: + name: Linux + uses: ./.github/workflows/pr-linux-test.yml + with: + job_name: Remote + remote_tests: true + + macos-electron-tests: + name: macOS + uses: ./.github/workflows/pr-darwin-test.yml + with: + job_name: Electron + electron_tests: true + + macos-browser-tests: + name: macOS + uses: ./.github/workflows/pr-darwin-test.yml + with: + job_name: Browser + browser_tests: true + + macos-remote-tests: + name: macOS + uses: ./.github/workflows/pr-darwin-test.yml + with: + job_name: Remote + remote_tests: true + + windows-electron-tests: + name: Windows + uses: ./.github/workflows/pr-win32-test.yml + with: + job_name: Electron + electron_tests: true + + windows-browser-tests: + name: Windows + uses: ./.github/workflows/pr-win32-test.yml + with: + job_name: Browser + browser_tests: true + + windows-remote-tests: + name: Windows + uses: ./.github/workflows/pr-win32-test.yml + with: + job_name: Remote + remote_tests: true diff --git a/.vscode-test.js b/.vscode-test.js index 823ef615f4f..e46484cb9df 100644 --- a/.vscode-test.js +++ b/.vscode-test.js @@ -97,7 +97,7 @@ const config = defineConfig(extensions.map(extension => { }; config.mocha ??= {}; - if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { + if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { let suite = ''; if (process.env.VSCODE_BROWSER) { suite = `${process.env.VSCODE_BROWSER} Browser Integration ${config.label} tests`; @@ -112,7 +112,10 @@ const config = defineConfig(extensions.map(extension => { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml` + ) } }; } diff --git a/build/lib/fetch.js b/build/lib/fetch.js index 078706cdd00..9f2b974b7ac 100644 --- a/build/lib/fetch.js +++ b/build/lib/fetch.js @@ -36,7 +36,7 @@ function fetchUrls(urls, options) { })); } async function fetchUrl(url, options, retries = 10, retryDelay = 1000) { - const verbose = !!options.verbose || !!process.env['CI'] || !!process.env['BUILD_ARTIFACTSTAGINGDIRECTORY']; + const verbose = !!options.verbose || !!process.env['CI'] || !!process.env['BUILD_ARTIFACTSTAGINGDIRECTORY'] || !!process.env['GITHUB_WORKSPACE']; try { let startTime = 0; if (verbose) { diff --git a/build/lib/fetch.ts b/build/lib/fetch.ts index 47a65b88fb5..f09b53e121c 100644 --- a/build/lib/fetch.ts +++ b/build/lib/fetch.ts @@ -42,7 +42,7 @@ export function fetchUrls(urls: string[] | string, options: IFetchOptions): es.T } export async function fetchUrl(url: string, options: IFetchOptions, retries = 10, retryDelay = 1000): Promise { - const verbose = !!options.verbose || !!process.env['CI'] || !!process.env['BUILD_ARTIFACTSTAGINGDIRECTORY']; + const verbose = !!options.verbose || !!process.env['CI'] || !!process.env['BUILD_ARTIFACTSTAGINGDIRECTORY'] || !!process.env['GITHUB_WORKSPACE']; try { let startTime = 0; if (verbose) { diff --git a/extensions/configuration-editing/src/test/index.ts b/extensions/configuration-editing/src/test/index.ts index ee8aeb0c6eb..c361b97928d 100644 --- a/extensions/configuration-editing/src/test/index.ts +++ b/extensions/configuration-editing/src/test/index.ts @@ -24,13 +24,15 @@ if (process.env.VSCODE_BROWSER) { suite = 'Integration Configuration-Editing Tests'; } -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/css-language-features/server/test/index.js b/extensions/css-language-features/server/test/index.js index 1699883a574..0c9be2d9710 100644 --- a/extensions/css-language-features/server/test/index.js +++ b/extensions/css-language-features/server/test/index.js @@ -15,13 +15,15 @@ const options = { timeout: 60000 }; -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/emmet/src/test/index.ts b/extensions/emmet/src/test/index.ts index e36bb6f7c77..51b4929af06 100644 --- a/extensions/emmet/src/test/index.ts +++ b/extensions/emmet/src/test/index.ts @@ -24,13 +24,15 @@ if (process.env.VSCODE_BROWSER) { suite = 'Integration Emmet Tests'; } -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/git/src/test/index.ts b/extensions/git/src/test/index.ts index c18561aaa66..da526f4d4c7 100644 --- a/extensions/git/src/test/index.ts +++ b/extensions/git/src/test/index.ts @@ -24,13 +24,15 @@ if (process.env.VSCODE_BROWSER) { suite = 'Integration Git Tests'; } -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/github/src/test/index.ts b/extensions/github/src/test/index.ts index 6573ab1daa4..382e728bfb2 100644 --- a/extensions/github/src/test/index.ts +++ b/extensions/github/src/test/index.ts @@ -14,13 +14,15 @@ const options: import('mocha').MochaOptions = { timeout: 60000 }; -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/html-language-features/server/test/index.js b/extensions/html-language-features/server/test/index.js index 50e250b78b8..93ffe7d6c09 100644 --- a/extensions/html-language-features/server/test/index.js +++ b/extensions/html-language-features/server/test/index.js @@ -15,13 +15,15 @@ const options = { timeout: 60000 }; -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/ipynb/src/test/index.ts b/extensions/ipynb/src/test/index.ts index 290194bfb2f..d70cf2e0628 100644 --- a/extensions/ipynb/src/test/index.ts +++ b/extensions/ipynb/src/test/index.ts @@ -24,13 +24,15 @@ if (process.env.VSCODE_BROWSER) { suite = 'Integration .ipynb Tests'; } -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/markdown-language-features/src/test/index.ts b/extensions/markdown-language-features/src/test/index.ts index 91e28d38e95..f9bd44aab27 100644 --- a/extensions/markdown-language-features/src/test/index.ts +++ b/extensions/markdown-language-features/src/test/index.ts @@ -24,13 +24,15 @@ if (process.env.VSCODE_BROWSER) { suite = 'Integration Markdown Tests'; } -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/notebook-renderers/src/test/index.ts b/extensions/notebook-renderers/src/test/index.ts index c7a818354b7..ff61996ea9c 100644 --- a/extensions/notebook-renderers/src/test/index.ts +++ b/extensions/notebook-renderers/src/test/index.ts @@ -24,13 +24,15 @@ if (process.env.VSCODE_BROWSER) { suite = 'Integration notebook output renderer Tests'; } -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/index.ts b/extensions/vscode-api-tests/src/singlefolder-tests/index.ts index 6798fc5a1e0..d7cce06ea62 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/index.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/index.ts @@ -24,13 +24,15 @@ if (process.env.VSCODE_BROWSER) { suite = 'Integration Single Folder Tests'; } -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/vscode-api-tests/src/workspace-tests/index.ts b/extensions/vscode-api-tests/src/workspace-tests/index.ts index 314a2e0d8f4..2010b075565 100644 --- a/extensions/vscode-api-tests/src/workspace-tests/index.ts +++ b/extensions/vscode-api-tests/src/workspace-tests/index.ts @@ -24,13 +24,15 @@ if (process.env.VSCODE_BROWSER) { suite = 'Integration Workspace Tests'; } -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/vscode-colorize-perf-tests/src/index.ts b/extensions/vscode-colorize-perf-tests/src/index.ts index 4376f31accd..65554f64ceb 100644 --- a/extensions/vscode-colorize-perf-tests/src/index.ts +++ b/extensions/vscode-colorize-perf-tests/src/index.ts @@ -14,13 +14,15 @@ const options: import('mocha').MochaOptions = { timeout: 60000 }; -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/extensions/vscode-colorize-tests/src/index.ts b/extensions/vscode-colorize-tests/src/index.ts index 51634213040..ea6a3357a63 100644 --- a/extensions/vscode-colorize-tests/src/index.ts +++ b/extensions/vscode-colorize-tests/src/index.ts @@ -20,7 +20,9 @@ if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: path.join( + process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } diff --git a/src/vs/base/common/platform.ts b/src/vs/base/common/platform.ts index 4bc8f61532b..cf76f7ce0e1 100644 --- a/src/vs/base/common/platform.ts +++ b/src/vs/base/common/platform.ts @@ -77,7 +77,7 @@ if (typeof nodeProcess === 'object') { _isLinux = (nodeProcess.platform === 'linux'); _isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION']; _isElectron = isElectronProcess; - _isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY']; + _isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY'] || !!nodeProcess.env['GITHUB_WORKSPACE']; _locale = LANGUAGE_DEFAULT; _language = LANGUAGE_DEFAULT; const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG']; diff --git a/test/smoke/test/index.js b/test/smoke/test/index.js index 8e9646c0d65..b7c1277a6c6 100644 --- a/test/smoke/test/index.js +++ b/test/smoke/test/index.js @@ -25,13 +25,14 @@ const options = { grep: opts['f'] || opts['g'] }; -if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { options.reporter = 'mocha-multi-reporters'; options.reporterOptions = { reporterEnabled: 'spec, mocha-junit-reporter', mochaJunitReporterReporterOptions: { testsuitesTitle: `${suite} ${process.platform}`, - mochaFile: join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + mochaFile: join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE || __dirname, + `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) } }; } @@ -45,7 +46,7 @@ mocha.run(failures => { const rootPath = join(__dirname, '..', '..', '..'); const logPath = join(rootPath, '.build', 'logs'); - if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { + if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { console.log(` ################################################################### # # diff --git a/test/unit/browser/index.js b/test/unit/browser/index.js index d112d64ea80..7789165f19e 100644 --- a/test/unit/browser/index.js +++ b/test/unit/browser/index.js @@ -89,12 +89,13 @@ const isDebug = !!args.debug; const withReporter = (function () { if (args.tfs) { { + const testResultsRoot = process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE; return (browserType, runner) => { new mocha.reporters.Spec(runner); new MochaJUnitReporter(runner, { reporterOptions: { testsuitesTitle: `${args.tfs} ${process.platform}`, - mochaFile: process.env.BUILD_ARTIFACTSTAGINGDIRECTORY ? path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${browserType}-${args.tfs.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) : undefined + mochaFile: testResultsRoot ? path.join(testResultsRoot, `test-results/${process.platform}-${process.arch}-${browserType}-${args.tfs.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) : undefined } }); }; @@ -249,7 +250,7 @@ async function runTestsInBrowser(testModules, browserType, browserChannel) { if (args.build) { target.searchParams.set('build', 'true'); } - if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { + if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE) { target.searchParams.set('ci', 'true'); } diff --git a/test/unit/electron/index.js b/test/unit/electron/index.js index f69104799ca..2072d9c2bde 100644 --- a/test/unit/electron/index.js +++ b/test/unit/electron/index.js @@ -326,12 +326,13 @@ app.on('ready', () => { const reporters = []; if (args.tfs) { + const testResultsRoot = process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || process.env.GITHUB_WORKSPACE; reporters.push( new mocha.reporters.Spec(runner), new MochaJUnitReporter(runner, { reporterOptions: { testsuitesTitle: `${args.tfs} ${process.platform}`, - mochaFile: process.env.BUILD_ARTIFACTSTAGINGDIRECTORY ? path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${args.tfs.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) : undefined + mochaFile: testResultsRoot ? path.join(testResultsRoot, `test-results/${process.platform}-${process.arch}-${args.tfs.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) : undefined } }), ); diff --git a/test/unit/electron/renderer.js b/test/unit/electron/renderer.js index 661be873561..af451fbab8e 100644 --- a/test/unit/electron/renderer.js +++ b/test/unit/electron/renderer.js @@ -88,7 +88,7 @@ Object.assign(globalThis, { __mkdirPInTests: path => fs.promises.mkdir(path, { recursive: true }), }); -const IS_CI = !!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY; +const IS_CI = !!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY || !!process.env.GITHUB_WORKSPACE; const _tests_glob = '**/test/**/*.test.js';