mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
devops: run npm ci steps in parallel (#35915)
This commit is contained in:
parent
a772275765
commit
a48a3ad6fa
@ -239,24 +239,47 @@ for (const pkg of workspace.packages()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class GroupStep extends Step {
|
||||||
|
/** @param {Step[]} steps */
|
||||||
|
constructor(steps) {
|
||||||
|
super({ concurrent: false });
|
||||||
|
this._steps = steps;
|
||||||
|
if (steps.some(s => !s.concurrent))
|
||||||
|
throw new Error('Composite step cannot contain non-concurrent steps');
|
||||||
|
}
|
||||||
|
async run() {
|
||||||
|
console.log('==== Starting parallel group');
|
||||||
|
const start = Date.now();
|
||||||
|
await Promise.all(this._steps.map(step => step.run()));
|
||||||
|
console.log('==== Parallel group finished in', Date.now() - start, 'ms');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @type {Step[]} */
|
||||||
|
const updateSteps = [];
|
||||||
|
|
||||||
// Update test runner.
|
// Update test runner.
|
||||||
steps.push(new ProgramStep({
|
updateSteps.push(new ProgramStep({
|
||||||
command: 'npm',
|
command: 'npm',
|
||||||
args: ['ci', '--save=false', '--fund=false', '--audit=false'],
|
args: ['ci', '--save=false', '--fund=false', '--audit=false'],
|
||||||
shell: true,
|
shell: true,
|
||||||
cwd: path.join(__dirname, '..', '..', 'tests', 'playwright-test', 'stable-test-runner'),
|
cwd: path.join(__dirname, '..', '..', 'tests', 'playwright-test', 'stable-test-runner'),
|
||||||
|
concurrent: true,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Update bundles.
|
// Update bundles.
|
||||||
for (const bundle of bundles) {
|
for (const bundle of bundles) {
|
||||||
steps.push(new ProgramStep({
|
updateSteps.push(new ProgramStep({
|
||||||
command: 'npm',
|
command: 'npm',
|
||||||
args: ['ci', '--save=false', '--fund=false', '--audit=false', '--omit=optional'],
|
args: ['ci', '--save=false', '--fund=false', '--audit=false', '--omit=optional'],
|
||||||
shell: true,
|
shell: true,
|
||||||
cwd: bundle,
|
cwd: bundle,
|
||||||
|
concurrent: true,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
steps.push(new GroupStep(updateSteps));
|
||||||
|
|
||||||
// Generate third party licenses for bundles.
|
// Generate third party licenses for bundles.
|
||||||
steps.push(new ProgramStep({
|
steps.push(new ProgramStep({
|
||||||
command: 'node',
|
command: 'node',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user