Skip to content

build: update angular shared dev-infra code to 932b9d5 #25000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/dev-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- uses: angular/dev-infra/github-actions/commit-message-based-labels@000ac3f5424551e510250f5a63d3e5917f13af6a
- uses: angular/dev-infra/github-actions/commit-message-based-labels@a2889d30aa4f7ff953f0cdaed212a7a62880644a
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
post_approval_changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- uses: angular/dev-infra/github-actions/post-approval-changes@000ac3f5424551e510250f5a63d3e5917f13af6a
- uses: angular/dev-infra/github-actions/post-approval-changes@a2889d30aa4f7ff953f0cdaed212a7a62880644a
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/lock-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
lock_closed:
runs-on: ubuntu-latest
steps:
- uses: angular/dev-infra/github-actions/lock-closed@000ac3f5424551e510250f5a63d3e5917f13af6a
- uses: angular/dev-infra/github-actions/lock-closed@a2889d30aa4f7ff953f0cdaed212a7a62880644a
with:
lock-bot-key: ${{ secrets.LOCK_BOT_PRIVATE_KEY }}
68 changes: 10 additions & 58 deletions .ng-dev/release.ts
Original file line number Diff line number Diff line change
@@ -1,63 +1,8 @@
import {
BuiltPackage,
ReleaseConfig,
ReleaseAction as _ReleaseAction,
FatalReleaseActionError,
} from '@angular/dev-infra-private/ng-dev';
import {SemVer} from 'semver';
import {ReleaseConfig} from '@angular/dev-infra-private/ng-dev';
import {assertValidFrameworkPeerDependency} from '../tools/release-checks/check-framework-peer-dependency';
import {assertValidUpdateMigrationCollections} from '../tools/release-checks/check-migration-collections';
import {assertValidNpmPackageOutput} from '../tools/release-checks/npm-package-output';
import {fork} from 'child_process';
import {join} from 'path';

// The `ng-dev` release tool exposes the `ReleaseAction` instance through `global`,
// allowing it to be monkey-patched for our release checks. This can be removed
// when the release tool has a public API for release checks.
const actionProto = ((global as any).ReleaseAction ?? _ReleaseAction).prototype;
const _origStageFn = actionProto.stageVersionForBranchAndCreatePullRequest;
const _origVerifyFn = actionProto._verifyPackageVersions;

/** Runs the staging sanity release checks for the given new version. */
async function runStagingReleaseChecks(newVersion: SemVer) {
return new Promise<void>((resolve, reject) => {
// Note: We run the staging release checks in a new node process. This is necessary
// because before staging, the correct publish branch is checked out. If we'd
// directly call into the release checks, the `.ng-dev/release` config would be
// cached by NodeJS and release checks would potentially check for packages which
// no longer exist in the publish branch (or the other way around).
const releaseChecksProcess = fork(join(__dirname, '../tools/release-checks/index.js'), [
newVersion.format(),
]);

releaseChecksProcess.on('close', code => {
if (code !== 0) {
reject(new FatalReleaseActionError());
} else {
resolve();
}
});
});
}

// Patches the `@angular/dev-infra-private` release tool to perform sanity checks
// before staging a release. This is temporary until the dev-infra team has implemented
// a more generic solution to running sanity checks before releasing (potentially building
// some of the checks we have in the components repository into the release tool).
actionProto.stageVersionForBranchAndCreatePullRequest = async function (newVersion: SemVer) {
await runStagingReleaseChecks(newVersion);

return await _origStageFn.apply(this, arguments);
};

// Patches the `@angular/dev-infra-private` release tool to perform sanity
// checks of the NPM package output, before publishing to NPM.
actionProto._verifyPackageVersions = async function (
newVersion: SemVer,
builtPackages: BuiltPackage[],
) {
await assertValidNpmPackageOutput(builtPackages, newVersion);

return await _origVerifyFn.apply(this, arguments);
};

/**
* Packages that will be published as part of the project.
Expand Down Expand Up @@ -104,4 +49,11 @@ export const release: ReleaseConfig = {
const {performNpmReleaseBuild} = await import('../scripts/build-packages-dist');
return performNpmReleaseBuild();
},
prereleaseCheck: async (newVersionStr, builtPackagesWithInfo) => {
const newVersion = new SemVer(newVersionStr);

await assertValidFrameworkPeerDependency(newVersion);
await assertValidUpdateMigrationCollections(newVersion);
await assertValidNpmPackageOutput(builtPackagesWithInfo, newVersion);
},
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@angular/bazel": "14.0.0-rc.1",
"@angular/cli": "14.0.0-rc.1",
"@angular/compiler-cli": "14.0.0-rc.1",
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#60ee618299679aa32219529a59448833cc4dd943",
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#932b9d5f6227d1a2dfa2a416fa317c2e55584994",
"@angular/localize": "14.0.0-rc.1",
"@angular/platform-browser-dynamic": "14.0.0-rc.1",
"@angular/platform-server": "14.0.0-rc.1",
Expand Down
8 changes: 4 additions & 4 deletions tools/release-checks/check-framework-peer-dependency.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {error, FatalReleaseActionError} from '@angular/dev-infra-private/ng-dev';
import {error, ReleasePrecheckError} from '@angular/dev-infra-private/ng-dev';
import {SemVer} from 'semver';
import {join} from 'path';
import {existsSync, readFileSync} from 'fs';
Expand Down Expand Up @@ -34,7 +34,7 @@ export async function assertValidFrameworkPeerDependency(newVersion: SemVer) {
),
);
error(chalk.red(` Please manually update the version range ` + `in: ${bzlConfigPath}`));
throw new FatalReleaseActionError();
throw new ReleasePrecheckError();
}
}

Expand All @@ -50,7 +50,7 @@ function _extractAngularVersionPlaceholderOrThrow(): string {
`the Angular peerDependency placeholder value. Looked for: ${bzlConfigPath}`,
),
);
throw new FatalReleaseActionError();
throw new ReleasePrecheckError();
}

const configFileContent = readFileSync(bzlConfigPath, 'utf8');
Expand All @@ -63,7 +63,7 @@ function _extractAngularVersionPlaceholderOrThrow(): string {
`Looked in: ${bzlConfigPath}`,
),
);
throw new FatalReleaseActionError();
throw new ReleasePrecheckError();
}
return matches[1];
}
4 changes: 2 additions & 2 deletions tools/release-checks/check-migration-collections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {error} from '@angular/dev-infra-private/ng-dev';
import {error, ReleasePrecheckError} from '@angular/dev-infra-private/ng-dev';
import chalk from 'chalk';
import {existsSync, readFileSync} from 'fs';
import {dirname, join} from 'path';
Expand Down Expand Up @@ -32,7 +32,7 @@ export async function assertValidUpdateMigrationCollections(newVersion: semver.S
if (failures.length) {
error(chalk.red(` ✘ Failures in ng-update migration collection detected:`));
failures.forEach(f => error(f));
process.exit(1);
throw new ReleasePrecheckError();
}
}

Expand Down
4 changes: 2 additions & 2 deletions tools/release-checks/npm-package-output/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {SemVer} from 'semver';
import {checkReleasePackage} from './check-package';
import {BuiltPackage, error} from '@angular/dev-infra-private/ng-dev';
import {BuiltPackage, error, ReleasePrecheckError} from '@angular/dev-infra-private/ng-dev';
import chalk from 'chalk';

/** Asserts that the given built packages are valid for public consumption. */
Expand All @@ -16,6 +16,6 @@ export async function assertValidNpmPackageOutput(

if (!passing) {
error(chalk.red(` ✘ NPM package output does not pass all release validations.`));
process.exit(1);
throw new ReleasePrecheckError();
}
}
61 changes: 30 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
"@angular-devkit/core" "14.0.0-rc.1"
rxjs "6.6.7"

"@angular-devkit/architect@0.1400.0-rc.2":
version "0.1400.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1400.0-rc.2.tgz#4ea95c11113c229b86be48bc2b425110b6cd7995"
integrity sha512-k2ZGmKhbsMTg2htaSRO1rQW6xVN9lAAwaWIwOijTFehWxeSoAQUJd3V2e/jOy9hQSrrnkg6GI0p2VPie6Xw38A==
"@angular-devkit/architect@0.1400.0-rc.3":
version "0.1400.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.1400.0-rc.3.tgz#54e328a203f98f243298b014bf4ce2abfde32a06"
integrity sha512-lv0HB50hyrKZDpImI3lk8BVzmD0zUIPARZ/2/wpS3ZCY5lpNSHZSGiN7SnMB9Y2h+RpbjTYeF7/5WLs0cXA6UA==
dependencies:
"@angular-devkit/core" "14.0.0-rc.2"
"@angular-devkit/core" "14.0.0-rc.3"
rxjs "6.6.7"

"@angular-devkit/build-angular@14.0.0-rc.1":
Expand Down Expand Up @@ -103,15 +103,15 @@
optionalDependencies:
esbuild "0.14.38"

"@angular-devkit/build-angular@14.0.0-rc.2":
version "14.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-14.0.0-rc.2.tgz#49dd67da8be72c2f3db6ee0f2a5cc4288b34a966"
integrity sha512-xOx11LAZ4JfYekmGxGOdfs98sKR+4a375SqYw/KAtqGjmF69FllIw9YmXqwFzSwQs3vAVt0aDd3NMWUEbW9qQQ==
"@angular-devkit/build-angular@14.0.0-rc.3":
version "14.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-14.0.0-rc.3.tgz#c168049a4e78b9ef6bed58521979aa5344983547"
integrity sha512-Blta5TUS548p8yxdR4pBYdEuzp7XkVxX38EhrFiPEAqgXyqDM8LwxCk8o9XwqLM9LtgqGd86x5RCx6YgTntUdw==
dependencies:
"@ampproject/remapping" "2.2.0"
"@angular-devkit/architect" "0.1400.0-rc.2"
"@angular-devkit/build-webpack" "0.1400.0-rc.2"
"@angular-devkit/core" "14.0.0-rc.2"
"@angular-devkit/architect" "0.1400.0-rc.3"
"@angular-devkit/build-webpack" "0.1400.0-rc.3"
"@angular-devkit/core" "14.0.0-rc.3"
"@babel/core" "7.17.10"
"@babel/generator" "7.17.10"
"@babel/helper-annotate-as-pure" "7.16.7"
Expand All @@ -122,7 +122,7 @@
"@babel/runtime" "7.17.9"
"@babel/template" "7.16.7"
"@discoveryjs/json-ext" "0.5.7"
"@ngtools/webpack" "14.0.0-rc.2"
"@ngtools/webpack" "14.0.0-rc.3"
ansi-colors "4.1.1"
babel-loader "8.2.5"
babel-plugin-istanbul "6.1.1"
Expand Down Expand Up @@ -181,12 +181,12 @@
"@angular-devkit/architect" "0.1400.0-rc.1"
rxjs "6.6.7"

"@angular-devkit/build-webpack@0.1400.0-rc.2":
version "0.1400.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1400.0-rc.2.tgz#6515ce601d34a6d6652c40a78ebca9dcfb955582"
integrity sha512-TBeQKt5MdwTFILLXTPibzMepvqaV81/XluRua86U2gCOMWS0zWptecLVqCwaOL60jCe8pio7u/8PxrirsHF0Cw==
"@angular-devkit/build-webpack@0.1400.0-rc.3":
version "0.1400.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.1400.0-rc.3.tgz#b862775a13b12eb0334afaa837f63d22aceaf909"
integrity sha512-AF+7lg4evuFGMYaU5S26zQm3bqRIjF2cA1HIwNFjwSLVBT/NC7+vZKY8HeyIXkeWid2LTiwgb+qZ/Qm1ei+1lg==
dependencies:
"@angular-devkit/architect" "0.1400.0-rc.2"
"@angular-devkit/architect" "0.1400.0-rc.3"
rxjs "6.6.7"

"@angular-devkit/core@14.0.0-rc.1":
Expand All @@ -200,10 +200,10 @@
rxjs "6.6.7"
source-map "0.7.3"

"@angular-devkit/core@14.0.0-rc.2":
version "14.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-14.0.0-rc.2.tgz#d979860dddb21fd31191ef7a231887e2af34461d"
integrity sha512-8nZDWfhFnzSv2ps6YSA4MoKdHeMbTo7qiIzVD2oCpGoH5oaWEB4VJUWK5rZHSdK4ww0fpLc96tIDLcx28LNRfw==
"@angular-devkit/core@14.0.0-rc.3":
version "14.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-14.0.0-rc.3.tgz#65e3083451f859032942c4e037daf67095319bf0"
integrity sha512-J+oWWvhJM1bOzsvyyIPxg56L0VEas/OwB9Sa8VdpZL873H03qnAgRdREOCPWhb/G6NBAG+UOFWPl62iMPIF+xw==
dependencies:
ajv "8.11.0"
ajv-formats "2.1.1"
Expand Down Expand Up @@ -327,12 +327,11 @@
dependencies:
tslib "^2.3.0"

"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#60ee618299679aa32219529a59448833cc4dd943":
version "0.0.0-000ac3f5424551e510250f5a63d3e5917f13af6a"
uid "60ee618299679aa32219529a59448833cc4dd943"
resolved "https://github.com/angular/dev-infra-private-builds.git#60ee618299679aa32219529a59448833cc4dd943"
"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#932b9d5f6227d1a2dfa2a416fa317c2e55584994":
version "0.0.0-d1a108d604fba8c761af9377545f90c0385f1f0a"
resolved "https://github.com/angular/dev-infra-private-builds.git#932b9d5f6227d1a2dfa2a416fa317c2e55584994"
dependencies:
"@angular-devkit/build-angular" "14.0.0-rc.2"
"@angular-devkit/build-angular" "14.0.0-rc.3"
"@angular/benchpress" "0.3.0"
"@babel/core" "^7.16.0"
"@bazel/buildifier" "5.1.0"
Expand Down Expand Up @@ -2555,10 +2554,10 @@
resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-14.0.0-rc.1.tgz#1188257876a7c6e40cde7f017729a5f1cb89274a"
integrity sha512-9CqEafLlZD09eqcu1a/rZjiglyBD0ufve8U87kBwOFc7ezWfWi+GLmAIdm3qdTQDcrthqZTKBOugCnxItiJLtA==

"@ngtools/webpack@14.0.0-rc.2":
version "14.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-14.0.0-rc.2.tgz#8ffbe4a0365e63db8c0cf54197314145a517b93c"
integrity sha512-8LapwOR7MAqRDj0CkPaksO40Qqxo/PTwp0UXTz59gxO+/SvHmfoGCijRHPeBXyV7Ct6fevTG0WwvQAovXNen1w==
"@ngtools/webpack@14.0.0-rc.3":
version "14.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-14.0.0-rc.3.tgz#2ba0e2b3b5b75ef91e87fd3024840c3745ad44a0"
integrity sha512-1FnYsG44kjSTJmJNDD7UECUlTKnWox6eKDhescMDW3x0nz0Ijsqnj+VpVdtVwrzbSQZ41l1xFpQbbgU4nVCq9w==

"@nodelib/fs.scandir@2.1.5":
version "2.1.5"
Expand Down