From cfa3e5aab1dbd5666d27c9c9266f92b774794778 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 23 Jun 2020 11:56:07 -0400 Subject: [PATCH 1/7] Split the GH actions CI into multiple stages --- .github/workflows/ci.yml | 15 +++++++++------ src/compiler/builderState.ts | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 251303b0c952b..d73f2274af6a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,12 +30,15 @@ jobs: run: | npm uninstall typescript --no-save npm uninstall tslint --no-save - - name: npm install and test - run: | - npm install - npm update - npm test - + - run: npm install + - run: npm update + + - name: Tests + run: npm test --no-lint + + - name: Linter + run: npm lint + - name: Validate the browser can import TypeScript run: gulp test-browser-integration \ No newline at end of file diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 315e67bdbb2d5..616c3d8f5d940 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -15,7 +15,7 @@ namespace ts { /** * Information of the file eg. its version, signature etc */ - fileInfos: ReadonlyMap; + fileInfos: ReadonlyMap /** * Contains the map of ReferencedSet=Referenced files of the file if module emit is enabled * Otherwise undefined From 46e0564841d21f491aa4fb6927da928f30ae0176 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 23 Jun 2020 12:09:52 -0400 Subject: [PATCH 2/7] Add the -- for npm --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d73f2274af6a4..2bf0ed1a95673 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,10 +34,10 @@ jobs: - run: npm update - name: Tests - run: npm test --no-lint + run: npm test -- --no-lint - name: Linter - run: npm lint + run: npm run lint - name: Validate the browser can import TypeScript run: gulp test-browser-integration From 61a3f63c965350f9f8a4a315f7982d51b9413d89 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 23 Jun 2020 12:37:10 -0400 Subject: [PATCH 3/7] Improve the CI reports --- .github/tsc.json | 18 ++++++++++++++++++ .github/workflows/ci.yml | 5 ++++- src/compiler/builderState.ts | 6 +++--- 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 .github/tsc.json diff --git a/.github/tsc.json b/.github/tsc.json new file mode 100644 index 0000000000000..158f7e83d3a1b --- /dev/null +++ b/.github/tsc.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "owner": "tsc", + "pattern": [ + { + "regexp": "^(?:\\s+\\d+\\>)?([^\\s].*)\\((\\d+),(\\d+)\\)\\s*:\\s+(error|warning|info)\\s+(\\w{1,2}\\d+)\\s*:\\s*(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "code": 5, + "message": 6 + } + ] + } + ] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bf0ed1a95673..aee3e80c78152 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,11 +33,14 @@ jobs: - run: npm install - run: npm update + - name: Register Problem Matcher for TSC + run: echo "##[add-matcher].github/tsc.json" + - name: Tests run: npm test -- --no-lint - name: Linter - run: npm run lint + run: npm run lint:ci - name: Validate the browser can import TypeScript run: gulp test-browser-integration diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 616c3d8f5d940..283ac6d0b3b90 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -15,7 +15,7 @@ namespace ts { /** * Information of the file eg. its version, signature etc */ - fileInfos: ReadonlyMap + fileInfos: ReadonlyMap; /** * Contains the map of ReferencedSet=Referenced files of the file if module emit is enabled * Otherwise undefined @@ -90,8 +90,8 @@ namespace ts { */ function getReferencedFileFromImportedModuleSymbol(symbol: Symbol) { if (symbol.declarations && symbol.declarations[0]) { - const declarationSourceFile = getSourceFileOfNode(symbol.declarations[0]); - return declarationSourceFile && declarationSourceFile.resolvedPath; + const declarationSourceFile = getSourceFileOfNode(symbol.declarations[0]) + return declarationSourceFile && declarationSourceFile.resolvedPath } } From 9469a0bb9165fd541a018414c2318d81dd4255e8 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 23 Jun 2020 12:44:15 -0400 Subject: [PATCH 4/7] Use stylish formatting on CI --- .github/workflows/ci.yml | 1 + Gulpfile.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aee3e80c78152..2a08d7bd3d183 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,7 @@ jobs: - run: npm install - run: npm update + # Re: https://github.com/actions/setup-node/pull/125 - name: Register Problem Matcher for TSC run: echo "##[add-matcher].github/tsc.json" diff --git a/Gulpfile.js b/Gulpfile.js index 095ea5025c4d0..73a1107593fa2 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -354,7 +354,6 @@ const eslint = (folder) => async () => { "node_modules/eslint/bin/eslint", "--cache", "--cache-location", `${folder}/.eslintcache`, - "--format", "autolinkable-stylish", "--rulesdir", "scripts/eslint/built/rules", "--ext", ".ts", ]; @@ -363,6 +362,14 @@ const eslint = (folder) => async () => { args.push("--fix"); } + // Use stylish format on CI, so that it can be picked up by GH Action's rule matchers + if (cmdLineOptions.ci) { + args.push("--format", "stylish"); + } + else { + args.push("--format", "autolinkable-stylish"); + } + args.push(folder); log(`Linting: ${args.join(" ")}`); From f2311986a6752ccc08dae56998c3e4b0c8244a37 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 23 Jun 2020 13:39:18 -0400 Subject: [PATCH 5/7] Break TSC instead --- Gulpfile.js | 2 +- src/compiler/builderState.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gulpfile.js b/Gulpfile.js index 73a1107593fa2..41f193261e990 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -374,7 +374,7 @@ const eslint = (folder) => async () => { log(`Linting: ${args.join(" ")}`); return exec(process.execPath, args); -} +}; const lintScripts = eslint("scripts"); lintScripts.displayName = "lint-scripts"; diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 283ac6d0b3b90..239b2cf19129d 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -90,8 +90,8 @@ namespace ts { */ function getReferencedFileFromImportedModuleSymbol(symbol: Symbol) { if (symbol.declarations && symbol.declarations[0]) { - const declarationSourceFile = getSourceFileOfNode(symbol.declarations[0]) - return declarationSourceFile && declarationSourceFile.resolvedPath + const declarationSourceFile = getSourceFileOfNode(symbol.declarations[0]); + return declarationSourceFile && declarationSo } } From cdb2652267fcef48040ac5efe4b718d17019ae4b Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 23 Jun 2020 13:55:00 -0400 Subject: [PATCH 6/7] Try add the problem register for TSC only on node 12 --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a08d7bd3d183..89ab0b888b12d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,8 @@ jobs: # Re: https://github.com/actions/setup-node/pull/125 - name: Register Problem Matcher for TSC run: echo "##[add-matcher].github/tsc.json" + if: (contains(matrix.node-version, '12') + - name: Tests run: npm test -- --no-lint From 470530411a1d6d508b90868dc4b602d5dc1bd352 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Wed, 24 Jun 2020 11:12:18 -0400 Subject: [PATCH 7/7] Fix GH Actions syntax maybe --- .github/workflows/ci.yml | 2 -- src/compiler/builderState.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89ab0b888b12d..2a08d7bd3d183 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,8 +36,6 @@ jobs: # Re: https://github.com/actions/setup-node/pull/125 - name: Register Problem Matcher for TSC run: echo "##[add-matcher].github/tsc.json" - if: (contains(matrix.node-version, '12') - - name: Tests run: npm test -- --no-lint diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 239b2cf19129d..315e67bdbb2d5 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -91,7 +91,7 @@ namespace ts { function getReferencedFileFromImportedModuleSymbol(symbol: Symbol) { if (symbol.declarations && symbol.declarations[0]) { const declarationSourceFile = getSourceFileOfNode(symbol.declarations[0]); - return declarationSourceFile && declarationSo + return declarationSourceFile && declarationSourceFile.resolvedPath; } }