mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-25 18:46:06 +01:00
* Pin GitHub Actions to full-length commit SHAs * chore: attest to third-party action pinning changes I have reviewed the action-pinning diff authored by OssSecurityBot and verified that each pinned SHA resolves to the same commit the tag it replaces pointed at, and that no workflow logic was altered beyond the `uses:` references. This commit is signed with my key from security/trusted-signing-keys.csv so the attestation is bound to my identity and to this exact tree. Any subsequent push replaces the head and invalidates it. Refs #328868 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: OssSecurityBot <oss-security-bot@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
253 lines
9.3 KiB
YAML
253 lines
9.3 KiB
YAML
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
|
|
unit_and_integration_tests:
|
|
type: boolean
|
|
default: true
|
|
smoke_tests:
|
|
type: boolean
|
|
default: true
|
|
|
|
jobs:
|
|
macOS-test:
|
|
name: ${{ inputs.job_name }}
|
|
runs-on: macos-26-xlarge
|
|
env:
|
|
ARTIFACT_NAME: ${{ (inputs.electron_tests && 'electron') || (inputs.browser_tests && 'browser') || (inputs.remote_tests && 'remote') || 'unknown' }}${{ (!inputs.unit_and_integration_tests && inputs.smoke_tests) && '-smoke' || '' }}
|
|
NPM_ARCH: arm64
|
|
VSCODE_ARCH: arm64
|
|
steps:
|
|
- name: Checkout microsoft/vscode
|
|
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
|
|
with:
|
|
node-version-file: .nvmrc
|
|
|
|
- name: Restore node_modules cache
|
|
id: cache-node-modules
|
|
uses: ./.github/actions/restore-node-modules
|
|
with:
|
|
key-prefix: node_modules-macos
|
|
key-args: "darwin ${{ env.VSCODE_ARCH }} $(node -p process.arch)"
|
|
|
|
- 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 .build folder
|
|
run: mkdir -p .build
|
|
|
|
- name: Prepare built-in extensions cache key
|
|
run: node build/azure-pipelines/common/computeBuiltInDepsCacheKey.ts > .build/builtindepshash
|
|
|
|
- name: Restore built-in extensions cache
|
|
id: cache-builtin-extensions
|
|
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
|
|
with:
|
|
enableCrossOsArchive: true
|
|
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.ts
|
|
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-all2 -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 && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 15
|
|
run: ./scripts/test.sh --tfs "Unit Tests"
|
|
env:
|
|
VSCODE_SKIP_PRELAUNCH: '1'
|
|
|
|
- name: 🧪 Run unit tests (node.js)
|
|
if: ${{ inputs.electron_tests && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 15
|
|
run: npm run test-node
|
|
|
|
- name: 🧪 Run unit tests (Browser, Webkit)
|
|
if: ${{ inputs.browser_tests && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 30
|
|
run: npm run test-browser-no-install -- --browser webkit --tfs "Browser Unit Tests"
|
|
env:
|
|
DEBUG: "*browser*"
|
|
|
|
- name: Compile extensions for integration tests & smoke 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 && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 20
|
|
run: ./scripts/test-integration.sh --tfs "Integration Tests"
|
|
env:
|
|
VSCODE_SKIP_PRELAUNCH: '1'
|
|
|
|
- name: 🧪 Run integration tests (Browser, Webkit)
|
|
if: ${{ inputs.browser_tests && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 20
|
|
run: ./scripts/test-web-integration.sh --browser webkit
|
|
|
|
- name: 🧪 Run integration tests (Remote)
|
|
if: ${{ inputs.remote_tests && inputs.unit_and_integration_tests }}
|
|
timeout-minutes: 20
|
|
run: ./scripts/test-remote-integration.sh
|
|
env:
|
|
VSCODE_SKIP_PRELAUNCH: '1'
|
|
|
|
- name: Compile smoke tests
|
|
if: ${{ inputs.smoke_tests }}
|
|
working-directory: test/smoke
|
|
run: npm run compile
|
|
|
|
- name: Compile Copilot Chat extension for smoke tests
|
|
if: ${{ inputs.smoke_tests }}
|
|
working-directory: extensions/copilot
|
|
run: npm run compile
|
|
|
|
- name: Diagnostics before smoke test run
|
|
if: ${{ inputs.smoke_tests && always() }}
|
|
run: ps -ef
|
|
continue-on-error: true
|
|
|
|
- name: 🧪 Run smoke tests (Electron)
|
|
if: ${{ inputs.electron_tests && inputs.smoke_tests }}
|
|
timeout-minutes: 20
|
|
run: npm run smoketest-no-compile -- --tracing
|
|
|
|
- name: Install Squid for network-isolated smoke tests
|
|
if: ${{ inputs.electron_tests && inputs.smoke_tests }}
|
|
run: brew list squid >/dev/null 2>&1 || brew install squid
|
|
|
|
- name: 🧪 Run Agents Window smoke tests through macOS PAC proxy
|
|
if: ${{ inputs.electron_tests && inputs.smoke_tests }}
|
|
timeout-minutes: 40
|
|
run: bash test/smoke/scripts/run-agents-window-network-proxy.sh
|
|
|
|
- name: 🧪 Run smoke tests (Browser, Chromium)
|
|
if: ${{ inputs.browser_tests && inputs.smoke_tests }}
|
|
timeout-minutes: 20
|
|
run: npm run smoketest-no-compile -- --web --tracing --headless
|
|
|
|
- name: 🧪 Run smoke tests (Remote)
|
|
if: ${{ inputs.remote_tests && inputs.smoke_tests }}
|
|
timeout-minutes: 20
|
|
run: npm run smoketest-no-compile -- --remote --tracing
|
|
|
|
- name: Diagnostics after smoke test run
|
|
if: ${{ inputs.smoke_tests && always() }}
|
|
run: ps -ef
|
|
continue-on-error: true
|
|
|
|
- name: Publish Crash Reports
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
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
|