mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-14 23:18:36 +00:00
ci: fix electron download from test steps (#292811)
* ci: fix electron download from test steps * build: always repackage electron from oss entry scripts
This commit is contained in:
@@ -15,6 +15,8 @@ steps:
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true) }}:
|
||||
- script: ./scripts/test.sh --build --tfs "Unit Tests"
|
||||
env:
|
||||
VSCODE_SKIP_PRELAUNCH: '1'
|
||||
displayName: 🧪 Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
- script: npm run test-node -- --build
|
||||
@@ -64,6 +66,7 @@ steps:
|
||||
./scripts/test-integration.sh --build --tfs "Integration Tests"
|
||||
env:
|
||||
VSCODE_REMOTE_SERVER_PATH: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)
|
||||
VSCODE_SKIP_PRELAUNCH: '1'
|
||||
displayName: 🧪 Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
@@ -85,6 +88,7 @@ steps:
|
||||
./scripts/test-remote-integration.sh
|
||||
env:
|
||||
VSCODE_REMOTE_SERVER_PATH: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)
|
||||
VSCODE_SKIP_PRELAUNCH: '1'
|
||||
displayName: 🧪 Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ steps:
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true) }}:
|
||||
- script: ./scripts/test.sh --build --tfs "Unit Tests"
|
||||
env:
|
||||
VSCODE_SKIP_PRELAUNCH: '1'
|
||||
displayName: 🧪 Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
- script: npm run test-node -- --build
|
||||
@@ -75,6 +77,7 @@ steps:
|
||||
./scripts/test-integration.sh --build --tfs "Integration Tests"
|
||||
env:
|
||||
VSCODE_REMOTE_SERVER_PATH: $(agent.builddirectory)/vscode-server-linux-$(VSCODE_ARCH)
|
||||
VSCODE_SKIP_PRELAUNCH: '1'
|
||||
displayName: 🧪 Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
@@ -95,6 +98,7 @@ steps:
|
||||
./scripts/test-remote-integration.sh
|
||||
env:
|
||||
VSCODE_REMOTE_SERVER_PATH: $(agent.builddirectory)/vscode-server-linux-$(VSCODE_ARCH)
|
||||
VSCODE_SKIP_PRELAUNCH: '1'
|
||||
displayName: 🧪 Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ steps:
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true) }}:
|
||||
- powershell: .\scripts\test.bat --build --tfs "Unit Tests"
|
||||
env:
|
||||
VSCODE_SKIP_PRELAUNCH: '1'
|
||||
displayName: 🧪 Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
- powershell: npm run test-node -- --build
|
||||
@@ -82,6 +84,8 @@ steps:
|
||||
$env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"
|
||||
$env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\test\vscode-server-win32-$(VSCODE_ARCH)"
|
||||
exec { .\scripts\test-integration.bat --build --tfs "Integration Tests" }
|
||||
env:
|
||||
VSCODE_SKIP_PRELAUNCH: '1'
|
||||
displayName: 🧪 Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
@@ -105,6 +109,8 @@ steps:
|
||||
$env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"
|
||||
$env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\test\vscode-server-win32-$(VSCODE_ARCH)"
|
||||
exec { .\scripts\test-remote-integration.bat }
|
||||
env:
|
||||
VSCODE_SKIP_PRELAUNCH: '1'
|
||||
displayName: 🧪 Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
|
||||
@@ -229,15 +229,9 @@ function getElectron(arch: string): () => NodeJS.ReadWriteStream {
|
||||
}
|
||||
|
||||
async function main(arch: string = process.arch): Promise<void> {
|
||||
const version = electronVersion;
|
||||
const electronPath = path.join(root, '.build', 'electron');
|
||||
const versionFile = path.join(electronPath, versionedResourcesFolder, 'version');
|
||||
const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `${version}`;
|
||||
|
||||
if (!isUpToDate) {
|
||||
await util.rimraf(electronPath)();
|
||||
await util.streamToPromise(getElectron(arch)());
|
||||
}
|
||||
await util.rimraf(electronPath)();
|
||||
await util.streamToPromise(getElectron(arch)());
|
||||
}
|
||||
|
||||
if (import.meta.main) {
|
||||
|
||||
@@ -165,6 +165,8 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
outputChannel.appendLine(`Launching server: "${serverCommandPath}" ${commandArgs.join(' ')}`);
|
||||
const shell = (process.platform === 'win32');
|
||||
// Skip prelaunch to avoid redownloading electron while it may be in use
|
||||
env['VSCODE_SKIP_PRELAUNCH'] = '1';
|
||||
extHostProcess = cp.spawn(serverCommandPath, commandArgs, { env, cwd: vscodePath, shell });
|
||||
} else {
|
||||
const extensionToInstall = process.env['TESTRESOLVER_INSTALL_BUILTIN_EXTENSION'];
|
||||
|
||||
@@ -19,7 +19,9 @@ else
|
||||
fi
|
||||
|
||||
# Get electron
|
||||
npm run electron
|
||||
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
|
||||
npm run electron
|
||||
fi
|
||||
|
||||
popd
|
||||
|
||||
|
||||
@@ -12,8 +12,10 @@ set NAMESHORT=%NAMESHORT:"=%.exe
|
||||
set CODE=".build\electron\%NAMESHORT%"
|
||||
|
||||
:: Download Electron if needed
|
||||
call node build\lib\electron.ts
|
||||
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
|
||||
if "%VSCODE_SKIP_PRELAUNCH%"=="" (
|
||||
call node build\lib\electron.ts
|
||||
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
|
||||
)
|
||||
|
||||
:: Run tests
|
||||
set ELECTRON_ENABLE_LOGGING=1
|
||||
|
||||
@@ -25,7 +25,9 @@ VSCODECRASHDIR=$ROOT/.build/crashes
|
||||
test -d node_modules || npm i
|
||||
|
||||
# Get electron
|
||||
npm run electron
|
||||
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
|
||||
npm run electron
|
||||
fi
|
||||
|
||||
# Unit Tests
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
|
||||
@@ -38,8 +38,10 @@ suite('PolicyExport Integration Tests', () => {
|
||||
? join(rootPath, 'scripts', 'code.bat')
|
||||
: join(rootPath, 'scripts', 'code.sh');
|
||||
|
||||
// Skip prelaunch to avoid redownloading electron while the parent VS Code is using it
|
||||
await exec(`"${scriptPath}" --export-policy-data="${tempFile}"`, {
|
||||
cwd: rootPath
|
||||
cwd: rootPath,
|
||||
env: { ...process.env, VSCODE_SKIP_PRELAUNCH: '1' }
|
||||
});
|
||||
|
||||
// Read both files
|
||||
|
||||
Reference in New Issue
Block a user