FIX problem with building all examples in CI (offset was wrong)

This commit is contained in:
Norbert de Langen 2020-05-18 13:03:07 +02:00
parent 811b66ba05
commit 5eda5b9ad8
No known key found for this signature in database
GPG Key ID: 976651DA156C2825

View File

@ -150,18 +150,21 @@ const handleExamples = async (deployables) => {
};
const run = async () => {
const examples = await readdir(p(['examples']));
const list = getDeployables(await readdir(p(['examples'])));
const { length } = examples;
const { length } = list;
const [a, b] = [process.env.CIRCLE_NODE_INDEX || 0, process.env.CIRCLE_NODE_TOTAL || 1];
const step = Math.ceil(length / b);
const offset = step * a;
const list = examples.slice().splice(offset, step);
const deployables = getDeployables(list);
const deployables = list.slice().splice(offset, step);
if (deployables.length) {
logger.log(`will build: ${deployables.join(', ')}`);
logger.log(
`will build: ${deployables.join(', ')} (${
deployables.length
} total - offset: ${offset} | step: ${step})`
);
await handleExamples(deployables);
}