mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-13 02:45:24 -05:00
Simplify CI detection (#50661)
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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 */
|
||||
@@ -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,
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user