mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
Parallelize E2E tests to cut CI time in half (#16417)
* Experiment with parallellizing E2E * Fix lint * Try parallelism 8 * Apply suggestions from code review Co-authored-by: Mark Stacey <markjstacey@gmail.com> Co-authored-by: Mark Stacey <markjstacey@gmail.com>
This commit is contained in:
parent
f3efe5a0bd
commit
02088e445d
@ -516,6 +516,7 @@ jobs:
|
||||
|
||||
test-e2e-chrome:
|
||||
executor: node-browsers
|
||||
parallelism: 8
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
@ -543,6 +544,7 @@ jobs:
|
||||
|
||||
test-e2e-chrome-mv3:
|
||||
executor: node-browsers
|
||||
parallelism: 8
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
@ -570,6 +572,7 @@ jobs:
|
||||
|
||||
test-e2e-firefox-snaps:
|
||||
executor: node-browsers
|
||||
parallelism: 2
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
@ -597,6 +600,7 @@ jobs:
|
||||
|
||||
test-e2e-chrome-snaps:
|
||||
executor: node-browsers
|
||||
parallelism: 2
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
@ -624,6 +628,7 @@ jobs:
|
||||
|
||||
test-e2e-firefox:
|
||||
executor: node-browsers-medium-plus
|
||||
parallelism: 8
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
|
@ -13,6 +13,14 @@ const getTestPathsForTestDir = async (testDir) => {
|
||||
return testPaths;
|
||||
};
|
||||
|
||||
function chunk(array, chunkSize) {
|
||||
const result = [];
|
||||
for (let i = 0; i < array.length; i += chunkSize) {
|
||||
result.push(array.slice(i, i + chunkSize));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const { argv } = yargs(hideBin(process.argv))
|
||||
.usage(
|
||||
@ -66,7 +74,14 @@ async function main() {
|
||||
args.push('--retries', retries);
|
||||
}
|
||||
|
||||
for (const testPath of testPaths) {
|
||||
// For running E2Es in parallel in CI
|
||||
const currentChunkIndex = process.env.CIRCLE_NODE_INDEX ?? 0;
|
||||
const totalChunks = process.env.CIRCLE_NODE_TOTAL ?? 1;
|
||||
const chunkSize = Math.ceil(testPaths.length / totalChunks);
|
||||
const chunks = chunk(testPaths, chunkSize);
|
||||
const currentChunk = chunks[currentChunkIndex];
|
||||
|
||||
for (const testPath of currentChunk) {
|
||||
await runInShell('node', [...args, testPath]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user