Files
vscode/.github/workflows/pr.yml
T
Giuseppe CianciandCopilot 5f3d6235d8 build: verify codex protocol client is regenerated in lockstep
Add a PR CI check that fails when the committed codex app-server protocol
client (src/vs/platform/agentHost/node/codex/protocol/generated/**) does not
match what `codex app-server generate-ts` produces for the @openai/codex
dev-dependency version, but only when a PR actually changes the generated
client or the version pin.

- build/codex/generate-protocol.mjs: export the reusable pieces (generate,
  resolveCodexBinary, readBinaryVersion, readPinnedVersion, paths) and only
  run main() when invoked directly, so the check can import it side-effect
  free. Types provided by generate-protocol.d.mts.
- build/codex/check-protocol-sync.ts: gate on a git diff touching the
  generated dir or codex-version.txt (its README.md excluded — preserved
  across regen), regenerate into a scratch dir with the dev-dependency binary,
  byte-compare against the committed client, and assert the pin matches. Never
  touches the working tree.
- build/codex/test/checkProtocolSync.test.ts: unit tests for the gate + diff
  helpers; wired in via the build/package.json test glob (adds `codex`).
- package.json: `codex:check-protocol` script.
- .github/workflows/pr.yml: run the gated check in the Compile & Hygiene job.
- generated/README.md: document the check.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-10 13:40:10 +02:00

430 lines
13 KiB
YAML

name: Code OSS
on:
pull_request:
branches:
- main
- 'release/*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
VSCODE_QUALITY: 'oss'
jobs:
compile:
name: Compile & Hygiene
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64, "JobId=compile-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
steps:
- name: Checkout microsoft/vscode
uses: actions/checkout@v6
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v6
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-compile
key-args: "compile $(node -p process.arch)"
- 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: Type check /build/ scripts
run: npm run typecheck
working-directory: build
- name: Prepare built-in extensions cache key
shell: pwsh
run: node build/azure-pipelines/common/computeBuiltInDepsCacheKey.ts > .build/builtindepshash
- name: Restore built-in extensions cache
id: cache-builtin-extensions
uses: actions/cache/restore@v5
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: Compile & Hygiene
run: npm exec -- npm-run-all2 -lp core-ci hygiene eslint valid-layers-check define-class-fields-check vscode-dts-compile-check tsec-compile-check test-build-scripts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check Codex protocol client is in sync
run: |
git fetch --no-tags --depth=1 origin "$CODEX_SYNC_BASE" || true
node build/codex/check-protocol-sync.ts --if-changed --base "$CODEX_SYNC_BASE"
env:
CODEX_SYNC_BASE: ${{ github.event.pull_request.base.sha }}
- name: Check cyclic dependencies
run: node build/lib/checkCyclicDependencies.ts out-build
linux-cli-tests:
name: Linux
uses: ./.github/workflows/pr-linux-cli-test.yml
with:
job_name: CLI
rustup_toolchain: 1.88
linux-electron-tests:
name: Linux
uses: ./.github/workflows/pr-linux-test.yml
with:
job_name: Electron
electron_tests: true
smoke_tests: false
linux-electron-smoke-tests:
name: Linux
uses: ./.github/workflows/pr-linux-test.yml
with:
job_name: Electron-Smoke
electron_tests: true
unit_and_integration_tests: false
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
smoke_tests: false
macos-electron-smoke-tests:
name: macOS
uses: ./.github/workflows/pr-darwin-test.yml
with:
job_name: Electron-Smoke
electron_tests: true
unit_and_integration_tests: false
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
smoke_tests: false
windows-electron-smoke-tests:
name: Windows
uses: ./.github/workflows/pr-win32-test.yml
with:
job_name: Electron-Smoke
electron_tests: true
unit_and_integration_tests: false
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
copilot-check-test-cache:
name: Copilot - Check Test Cache
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64, "JobId=copilot-check-test-cache-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
permissions:
contents: read
pull-requests: read
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-node@v6
with:
node-version-file: extensions/copilot/.nvmrc
- name: Restore node_modules cache
id: cache-node-modules
uses: ./.github/actions/restore-node-modules
with:
key-prefix: copilot-node_modules-linux
key-args: "$(node -p process.platform) $(node -p process.arch)"
- name: Install root dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts --no-workspaces
- name: Install copilot dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
working-directory: extensions/copilot
run: npm ci
- name: Ensure no duplicate cache keys
working-directory: extensions/copilot
run: npx tsx test/base/cache-cli check
- name: Ensure no untrusted cache changes
if: github.event_name == 'pull_request'
working-directory: extensions/copilot
run: npx tsx build/pr-check-cache-files.ts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
PULL_REQUEST: ${{ github.event.pull_request.number }}
copilot-check-telemetry:
name: Copilot - Check Telemetry
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64, "JobId=copilot-check-telemetry-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-node@v6
with:
node-version-file: extensions/copilot/.nvmrc
- name: Validate telemetry events
working-directory: extensions/copilot
run: npx --package=@vscode/telemetry-extractor --yes vscode-telemetry-extractor -s . > /dev/null
copilot-linux-tests:
name: Copilot - Test (Linux)
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-ubuntu-22.04-x64, "JobId=copilot-linux-tests-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: extensions/copilot/.nvmrc
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
architecture: 'x64'
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0'
- name: Install setuptools
run: pip install setuptools
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb libgtk-3-0 libgbm1
- name: Restore node_modules cache
id: cache-node-modules
uses: ./.github/actions/restore-node-modules
with:
key-prefix: copilot-node_modules-linux
key-args: "$(node -p process.platform) $(node -p process.arch)"
- name: Install root dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts --no-workspaces
- name: Install copilot dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
working-directory: extensions/copilot
run: npm ci
- name: TypeScript type checking
working-directory: extensions/copilot
run: npm run typecheck
- name: Lint
working-directory: extensions/copilot
run: npm run lint
- name: Compile
working-directory: extensions/copilot
run: npm run compile
- name: Run vitest unit tests
working-directory: extensions/copilot
run: npm run test:unit
- name: Run simulation tests with cache
working-directory: extensions/copilot
run: npm run simulate-ci
- name: Run Completions Core prompt tests
working-directory: extensions/copilot
run: npm run test:prompt
- name: Run Completions Core lib tests using VS Code
working-directory: extensions/copilot
run: xvfb-run -a npm run test:completions-core
- name: Archive simulation output
if: always()
working-directory: extensions/copilot
run: |
set -e
mkdir -p .simulation-archive
tar -czf .simulation-archive/simulation.tgz -C .simulation .
- name: Upload simulation output
if: always()
uses: actions/upload-artifact@v7
with:
name: copilot-simulation-output-linux-${{ github.run_attempt }}
path: extensions/copilot/.simulation-archive/simulation.tgz
copilot-windows-tests:
name: Copilot - Test (Windows)
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-windows-2022-x64, "JobId=copilot-windows-tests-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ]
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: extensions/copilot/.nvmrc
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
architecture: 'x64'
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0'
- name: Install setuptools
run: pip install setuptools
- name: Restore node_modules cache
id: cache-node-modules
uses: ./.github/actions/restore-node-modules
with:
key-prefix: copilot-node_modules-windows
key-args: "$(node -p process.platform) $(node -p process.arch)"
- name: Install root dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts --no-workspaces
- name: Install copilot dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
working-directory: extensions/copilot
run: npm ci
- name: TypeScript type checking
working-directory: extensions/copilot
run: npm run typecheck
- name: Lint
working-directory: extensions/copilot
run: npm run lint
- name: Compile
working-directory: extensions/copilot
run: npm run compile
- name: Run vitest unit tests
working-directory: extensions/copilot
run: npm run test:unit
- name: Run simulation tests with cache
working-directory: extensions/copilot
run: npm run simulate-ci
- name: Run Completions Core prompt tests
working-directory: extensions/copilot
run: npm run test:prompt
- name: Run Completions Core lib tests using VS Code
working-directory: extensions/copilot
run: npm run test:completions-core