Skip to content

Commit

Permalink
Tools: Build package sequentially on CI to try to prevent various fil…
Browse files Browse the repository at this point in the history
…e access errors
  • Loading branch information
laurent22 committed Jan 1, 2022
1 parent 3cf0841 commit 5d4ebc6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
16 changes: 16 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ const tasks = {
await utils.execCommandVerbose('git', ['push']);
},
},
build: {
fn: async () => {
// Building everything in parallel seems to be unreliable on CI as
// certain scripts randomly fail with missing files or folder, or
// cannot delete certain directories (eg. copyPluginAssets or
// copyApplicationAssets). Because of this, on CI, we run the build
// sequencially. Locally we run it in parallel, which is much
// faster, especially when having to rebuild after adding a
// dependency.
if (process.env.IS_CONTINUOUS_INTEGRATION === '1') {
await utils.execCommandVerbose('yarn', ['run', 'buildSequential']);
} else {
await utils.execCommandVerbose('yarn', ['run', 'buildParallel']);
}
},
},
};

utils.registerGulpTasks(gulp, tasks);
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"node": ">=16"
},
"scripts": {
"build": "yarn workspaces foreach --verbose --interlaced --parallel run build && yarn run tsc",
"buildParallel": "yarn workspaces foreach --verbose --interlaced --parallel --jobs 2 run build && yarn run tsc",
"buildSequential": "yarn workspaces foreach --verbose --interlaced run build && yarn run tsc",
"buildApiDoc": "yarn workspace joplin start apidoc ../../readme/api/references/rest_api.md",
"buildCommandIndex": "gulp buildCommandIndex",
"buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out ../joplin-website/docs/api/references/plugin_api packages/lib/services/plugins/api/",
Expand All @@ -28,9 +29,9 @@
"linter-ci": "eslint --resolve-plugins-relative-to . --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
"linter-precommit": "eslint --resolve-plugins-relative-to . --fix --ext .js --ext .jsx --ext .ts --ext .tsx",
"linter": "eslint --resolve-plugins-relative-to . --fix --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
"postinstall": "yarn run build",
"publishAll": "git pull && yarn run build && lerna version --yes --no-private --no-git-tag-version && gulp completePublishAll",
"releaseAndroid": "yarn run build && export PATH=\"/usr/local/opt/openjdk@11/bin:$PATH\" && node packages/tools/release-android.js",
"postinstall": "gulp build",
"publishAll": "git pull && yarn run buildParallel && lerna version --yes --no-private --no-git-tag-version && gulp completePublishAll",
"releaseAndroid": "yarn run buildParallel && export PATH=\"/usr/local/opt/openjdk@11/bin:$PATH\" && node packages/tools/release-android.js",
"releaseAndroidClean": "node packages/tools/release-android.js",
"releaseCli": "node packages/tools/release-cli.js",
"releaseClipper": "node packages/tools/release-clipper.js",
Expand Down
1 change: 1 addition & 0 deletions packages/tools/gulp/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ utils.execCommandVerbose = function(commandName, args = []) {
console.info(`> ${commandName}`, args && args.length ? args : '');
const promise = execa(commandName, args);
promise.stdout.pipe(process.stdout);
promise.stderr.pipe(process.stderr);
return promise;
};

Expand Down

0 comments on commit 5d4ebc6

Please sign in to comment.