mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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:
|
test-e2e-chrome:
|
||||||
executor: node-browsers
|
executor: node-browsers
|
||||||
|
parallelism: 8
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
@ -543,6 +544,7 @@ jobs:
|
|||||||
|
|
||||||
test-e2e-chrome-mv3:
|
test-e2e-chrome-mv3:
|
||||||
executor: node-browsers
|
executor: node-browsers
|
||||||
|
parallelism: 8
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
@ -570,6 +572,7 @@ jobs:
|
|||||||
|
|
||||||
test-e2e-firefox-snaps:
|
test-e2e-firefox-snaps:
|
||||||
executor: node-browsers
|
executor: node-browsers
|
||||||
|
parallelism: 2
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
@ -597,6 +600,7 @@ jobs:
|
|||||||
|
|
||||||
test-e2e-chrome-snaps:
|
test-e2e-chrome-snaps:
|
||||||
executor: node-browsers
|
executor: node-browsers
|
||||||
|
parallelism: 2
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
@ -624,6 +628,7 @@ jobs:
|
|||||||
|
|
||||||
test-e2e-firefox:
|
test-e2e-firefox:
|
||||||
executor: node-browsers-medium-plus
|
executor: node-browsers-medium-plus
|
||||||
|
parallelism: 8
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
|
@ -13,6 +13,14 @@ const getTestPathsForTestDir = async (testDir) => {
|
|||||||
return testPaths;
|
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() {
|
async function main() {
|
||||||
const { argv } = yargs(hideBin(process.argv))
|
const { argv } = yargs(hideBin(process.argv))
|
||||||
.usage(
|
.usage(
|
||||||
@ -66,7 +74,14 @@ async function main() {
|
|||||||
args.push('--retries', retries);
|
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]);
|
await runInShell('node', [...args, testPath]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user