Skip to content

Commit

Permalink
Simplify CI detection (#50661)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Sep 6, 2022
1 parent 9ac1fce commit 3c3820b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -46,7 +46,7 @@ jobs:
- run: npm ci

- name: Linter
run: npm run lint:ci
run: npm run lint

browser-integration:
runs-on: ubuntu-latest
Expand Down
3 changes: 0 additions & 3 deletions Gulpfile.js
Expand Up @@ -372,9 +372,6 @@ const lint = eslint(".");
lint.displayName = "lint";
task("lint", lint);
task("lint").description = "Runs eslint on the compiler and scripts sources.";
task("lint").flags = {
" --ci": "Runs eslint additional rules",
};

const buildCancellationToken = () => buildProject("src/cancellationToken");
const cleanCancellationToken = () => cleanProject("src/cancellationToken");
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -109,7 +109,6 @@
"clean": "gulp clean",
"gulp": "gulp",
"lint": "gulp lint",
"lint:ci": "gulp lint --ci",
"setup-hooks": "node scripts/link-hooks.js"
},
"browser": {
Expand Down
10 changes: 7 additions & 3 deletions scripts/build/options.js
Expand Up @@ -2,9 +2,11 @@
const minimist = require("minimist");
const os = require("os");

const ci = ["1", "true"].includes(process.env.CI);

/** @type {CommandLineOptions} */
module.exports = minimist(process.argv.slice(2), {
boolean: ["dirty", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built"],
boolean: ["dirty", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci"],
string: ["browser", "tests", "break", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"],
alias: {
/* eslint-disable quote-props */
Expand Down Expand Up @@ -33,12 +35,13 @@ module.exports = minimist(process.argv.slice(2), {
reporter: process.env.reporter || process.env.r,
lint: process.env.lint || true,
fix: process.env.fix || process.env.f,
workers: process.env.workerCount || ((os.cpus().length - (process.env.CI ? 0 : 1)) || 1),
workers: process.env.workerCount || ((os.cpus().length - (ci ? 0 : 1)) || 1),
failed: false,
keepFailed: false,
lkg: true,
dirty: false,
built: false
built: false,
ci,
}
});

Expand Down Expand Up @@ -67,6 +70,7 @@ if (module.exports.built) {
* @property {string|number} timeout
* @property {boolean} failed
* @property {boolean} keepFailed
* @property {boolean} ci
*
* @typedef {import("minimist").ParsedArgs & TypedOptions} CommandLineOptions
*/
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/tests.js
Expand Up @@ -123,7 +123,7 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode)
errorStatus = exitCode;
error = new Error(`Process exited with status code ${errorStatus}.`);
}
else if (process.env.CI === "true") {
else if (cmdLineOptions.ci) {
// finally, do a sanity check and build the compiler with the built version of itself
log.info("Starting sanity check build...");
// Cleanup everything except lint rules (we'll need those later and would rather not waste time rebuilding them)
Expand Down

0 comments on commit 3c3820b

Please sign in to comment.