From 5472c28fa1ddc002a93803a14ed5c6c865ca4dd8 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 2 Sep 2021 16:29:47 +0200 Subject: [PATCH] build: check .ng-dev tool configuration in CI (#43322) Checks the `.ng-dev` tool configuration in CI, compared to doing it locally when the caretaker intends to perform a merge and then realizes the config is broken. PR Close #43322 --- .circleci/config.yml | 1 + .ng-dev/merge.ts | 45 +++++++++++++++++-------------------------- .ng-dev/release.ts | 2 +- .ng-dev/tsconfig.json | 10 ++++++++++ package.json | 3 ++- 5 files changed, 32 insertions(+), 29 deletions(-) create mode 100644 .ng-dev/tsconfig.json diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d231cf97ee..d3d454d0985 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -291,6 +291,7 @@ jobs: - run: yarn -s ng-dev pullapprove verify - run: yarn -s ng-dev ngbot verify - run: yarn -s ng-dev commit-message validate-range $CI_GIT_BASE_REVISION $CI_GIT_REVISION + - run: yarn -s check-tooling-setup test: executor: diff --git a/.ng-dev/merge.ts b/.ng-dev/merge.ts index 4ebfb995701..5d62f3ad82c 100644 --- a/.ng-dev/merge.ts +++ b/.ng-dev/merge.ts @@ -1,33 +1,24 @@ -import {DevInfraMergeConfig} from '@angular/dev-infra-private/ng-dev/pr/merge/config'; -import {getDefaultTargetLabelConfiguration} from '@angular/dev-infra-private/ng-dev/pr/merge/defaults'; -import {github} from './github'; -import {release} from './release'; +import {MergeConfig} from '@angular/dev-infra-private/ng-dev/pr/merge/config'; /** * Configuration for the merge tool in `ng-dev`. This sets up the labels which * are respected by the merge script (e.g. the target labels). */ -export const merge: DevInfraMergeConfig['merge'] = async api => { - return { - githubApiMerge: false, - claSignedLabel: 'cla: yes', - mergeReadyLabel: /^action: merge(-assistance)?/, - caretakerNoteLabel: /^(action: merge-assistance)|(PullApprove: disable)/, - commitMessageFixupLabel: 'commit message fixup', - breakingChangeLabel: 'flag: breaking change', - // We can pick any of the NPM packages as we are in a monorepo where all packages are - // published together with the same version and branching. - labels: await getDefaultTargetLabelConfiguration(api, github, release), - requiredBaseCommits: { - // PRs that target either `master` or the patch branch, need to be rebased - // on top of the latest commit message validation fix. - // These SHAs are the commits that update the required license text in the header. - 'master': '5aeb9a4124922d8ac08eb73b8f322905a32b0b3a', - '10.0.x': '27b95ba64a5d99757f4042073fd1860e20e3ed24', - }, - // `dev-infra` and `docs-infra` are not affecting the public NPM packages. Similarly, - // the `bazel` package is not considered part of the public API so that features - // can land in patch branches. - targetLabelExemptScopes: ['dev-infra', 'docs-infra', 'bazel'] - }; +export const merge: MergeConfig = { + githubApiMerge: false, + claSignedLabel: 'cla: yes', + mergeReadyLabel: /^action: merge(-assistance)?/, + caretakerNoteLabel: /^(action: merge-assistance)|(PullApprove: disable)/, + commitMessageFixupLabel: 'commit message fixup', + requiredBaseCommits: { + // PRs that target either `master` or the patch branch, need to be rebased + // on top of the latest commit message validation fix. + // These SHAs are the commits that update the required license text in the header. + 'master': '5aeb9a4124922d8ac08eb73b8f322905a32b0b3a', + '10.0.x': '27b95ba64a5d99757f4042073fd1860e20e3ed24', + }, + // `dev-infra` and `docs-infra` are not affecting the public NPM packages. Similarly, + // the `bazel` package is not considered part of the public API so that features + // can land in patch branches. + targetLabelExemptScopes: ['dev-infra', 'docs-infra', 'bazel'] }; diff --git a/.ng-dev/release.ts b/.ng-dev/release.ts index ec31bd1c077..e6442a92403 100644 --- a/.ng-dev/release.ts +++ b/.ng-dev/release.ts @@ -22,7 +22,7 @@ export const release: ReleaseConfig = { '@angular/service-worker', '@angular/upgrade', ], - buildPackages: async (stampForRelease: boolean) => { + buildPackages: async (stampForRelease: boolean|undefined) => { // The buildTargetPackages function is loaded at runtime as the loading the script causes an // invocation of bazel. const {buildTargetPackages} = require(join(__dirname, '../scripts/build/package-builder')); diff --git a/.ng-dev/tsconfig.json b/.ng-dev/tsconfig.json new file mode 100644 index 00000000000..9e9c1b74652 --- /dev/null +++ b/.ng-dev/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "strict": true, + "target": "es2015", + "module": "commonjs", + "noEmit": true, + "skipLibCheck": true, + "types": [] + }, +} diff --git a/package.json b/package.json index 73265ba4733..13bb805cd51 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "symbol-extractor:check": "node tools/symbol-extractor/run_all_symbols_extractor_tests.js test", "symbol-extractor:update": "node tools/symbol-extractor/run_all_symbols_extractor_tests.js accept", "ts-circular-deps:check": "yarn -s ng-dev ts-circular-deps check --config ./packages/circular-deps-test.conf.js", - "ts-circular-deps:approve": "yarn -s ng-dev ts-circular-deps approve --config ./packages/circular-deps-test.conf.js" + "ts-circular-deps:approve": "yarn -s ng-dev ts-circular-deps approve --config ./packages/circular-deps-test.conf.js", + "check-tooling-setup": "yarn tsc --project .ng-dev/tsconfig.json" }, "// 1": "dependencies are used locally and by bazel", "dependencies": {