Commit Graph

174 Commits

Author SHA1 Message Date
Joey Perrott 96769867ed fix(dev-infra): ensure hashbang is present in both published and local ng-devs (#39443)
The node hash bang was incidentally removed in the published ng-dev, it should
be included to allow for the command to be run without having to specify node.

PR Close #39443
2020-10-27 09:28:38 -07:00
Joey Perrott d331e09b71 refactor(dev-infra): create ng-dev executable locally in the repo (#39089)
Rather than running ng-dev via ts-node, going forward ng-dev is generated and run
locally via node.  Additionally, the generated file is tested on each commit to
ensure that the local generated version stays up to date.

PR Close #39089
2020-10-22 13:36:14 -07:00
Joey Perrott 767fdccf59 feat(dev-infra): prompt caretaker to confirm the merge branches on merge (#39333)
Perviously, it was not immediately clear what branches a PR would merge
into during the merge process.  This prompt allows for caretakers to
understand and acknowledge where the PR will merge to.

PR Close #39333
2020-10-19 12:06:16 -07:00
Joey Perrott 34dbba4a90 refactor(dev-infra): remove branches created for g3 comparison (#39137)
Previously, temporary branches were created to be used for comparison to
the g3 branch, instead comparisons are now done using the branches
latest shas.

PR Close #39137
2020-10-15 14:11:31 -07:00
George Kalpakas 96dd78e0c6 fix(dev-infra): detect all commit message keywords that can close a PR (#39229)
Previously, the `isCommitClosingPullRequest()` method (used in
`ng-dev release` to detect whether a commit is closing a PR based on
keywords found in the commit message) was only able to detect a subset
of the keywords supported by GitHub.

This is fine currently, because the merge script adds `PR Close #XYZ`
when merging a PR, but it might break in the future.

This commit makes the code more robust by ensuring the method can detect
all keywords supported by GitHub for automatically closing a PR based on
a commit message.

Original discussion:
https://github.com/angular/angular/pull/39135#discussion_r503440973

PR Close #39229
2020-10-12 12:02:48 -07:00
George Kalpakas c9b36f9150 fix(dev-infra): fix error message in `invokeSetNpmDistCommand()` function (#39229)
In #39135, the commit message string was accidentally changed from a
template literal to a regular string literal. This prevented the
`npmDistTag` variable from being correctly displayed in the error
message.

This commit fixes it by switching it back to a template literal.

NOTE:
This was pointed out in
https://github.com/angular/angular/pull/39135#discussion_r503361412, but
the PR was accidentally merged before the review feedback had been
addressed.

PR Close #39229
2020-10-12 12:02:48 -07:00
George Kalpakas c76dda6aeb fix(dev-infra): correctly check for commit that closes PR (#39135)
The `ng-dev release publish` command needs to check whether a commit
closed a pull request. This is implemented via checking the commit
message for specific closing keywords referencing the pull request
number.

The regex used previously failed to correctly ensure that the specified
pull request was referenced. For example, it would allow `#12345` to
also match for `#1234`.

This commit fixes the regex.

PR Close #39135
2020-10-12 10:47:13 -07:00
George Kalpakas 6947ceaf44 refactor(dev-infra): several code style and typo fixes (#39135)
This commit addresses comments from [my review][1] on PR #38656 (which
was merged without comments addressed). The changes are mostly related
to code style and typos.

[1]: https://github.com/angular/angular/pull/38656#pullrequestreview-482129333

PR Close #39135
2020-10-12 10:47:13 -07:00
Andrew Scott b2342d4116 feat(dev-infra): Add github links to caretaker checks (#39185)
This commit adds links to the PR/Issue for queries in the caretaker check.

PR Close #39185
2020-10-09 09:39:33 -07:00
Bjarki ca4ef61c06 build: bump Chromium to next stable version: 84.0.4147 (#39179)
Bump Chrome to the next stable release (84.0.4147) by following the
instructions in dev-infra/browsers/README.md.

With Chrome 86 about to be released as stable, the current local version
(Chrome 83) is starting to lag behind. It also contains a bug that
blocks Angular unit and integration tests from using Trusted Types.

PR Close #39179
2020-10-09 07:53:11 -07:00
Greg Magolan 42a164f522 build: upgrade angular build, integration/bazel and @angular/bazel package to rule_nodejs 2.2.0 (#39182)
Updates to rules_nodejs 2.2.0. This is the first major release in 7 months and includes a number of features as well
as breaking changes.

Release notes: https://github.com/bazelbuild/rules_nodejs/releases/tag/2.0.0

Features of note for angular/angular:

* stdout/stderr/exit code capture; this could be potentially be useful

* TypeScript (ts_project); a simpler tsc rule that ts_library that can be used in the repo where ts_library is too
  heavy weight

Breaking changes of note for angular/angular:

* loading custom rules from npm packages: `ts_library` is no longer loaded from `@npm_bazel_typescript//:index.bzl`
  (which no longer exists) but is now loaded from `@npm//@bazel/typescript:index.bzl`

* with the loading changes above, `load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")` is
  no longer needed in the WORKSPACE which also means that yarn_install does not need to run unless building/testing
  a target that depends on @npm. In angular/angular this is a minor improvement as almost everything depends on @npm.

* @angular/bazel package is also updated in this PR to support the new load location; Angular + Bazel users that
  require it for ng_package (ng_module is no longer needed in OSS with Angular 10) will need to load from
  `@npm//@angular/bazel:index.bzl`. I investigated if it was possible to maintain backward compatability for the old
  load location `@npm_angular_bazel` but it is not since the package itself needs to be updated to load from
  `@npm//@bazel/typescript:index.bzl` instead of `@npm_bazel_typescript//:index.bzl` as it depends on ts_library
  internals for ng_module.

* runfiles.resolve will now throw instead of returning undefined to match behavior of node require

Other changes in angular/angular:

* integration/bazel has been updated to use both ng_module and ts_libary with use_angular_plugin=true.
  The latter is the recommended way for rules_nodejs users to compile Angular 10 with Ivy. Bazel + Angular ViewEngine is
  supported with @angular/bazel <= 9.0.5 and Angular <= 8. There is still Angular ViewEngine example on rules_nodejs
  https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular_view_engine on these older versions but users
  that want to update to Angular 10 and are on Bazel must switch to Ivy and at that point ts_library with
  use_angular_plugin=true is more performant that ng_module. Angular example in rules_nodejs is configured this way
  as well: https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular. As an aside, we also have an
  example of building Angular 10 with architect() rule directly instead of using ts_library with angular plugin:
  https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular_bazel_architect.

NB: ng_module is still required for angular/angular repository as it still builds ViewEngine & @angular/bazel
also provides the ng_package rule. ng_module can be removed in the future if ViewEngine is no longer needed in
angular repo.

* JSModuleInfo provider added to ng_module. this is for forward compat for future rules_nodejs versions.

PR Close #39182
2020-10-08 11:54:59 -07:00
Joey Perrott f3150223da feat(dev-infra): show CI status of all active release trains (#39067)
As part of the ng-dev caretaker check command, show the status of the
lastest CircleCI run for each active release train.

PR Close #39067
2020-10-05 10:23:34 -07:00
Joey Perrott c214cad2b4 Revert "build: upgrade angular build, integration/bazel and @angular/bazel package to rule_nodejs 2.2.0 (#37727)" (#39097)
This reverts commit db56cf18ba.

PR Close #39097
2020-10-02 10:56:53 -07:00
Greg Magolan db56cf18ba build: upgrade angular build, integration/bazel and @angular/bazel package to rule_nodejs 2.2.0 (#37727)
Updates to rules_nodejs 2.2.0. This is the first major release in 7 months and includes a number of features as well
as breaking changes.

Release notes: https://github.com/bazelbuild/rules_nodejs/releases/tag/2.0.0

Features of note for angular/angular:

* stdout/stderr/exit code capture; this could be potentially be useful

* TypeScript (ts_project); a simpler tsc rule that ts_library that can be used in the repo where ts_library is too
  heavy weight

Breaking changes of note for angular/angular:

* loading custom rules from npm packages: `ts_library` is no longer loaded from `@npm_bazel_typescript//:index.bzl`
  (which no longer exists) but is now loaded from `@npm//@bazel/typescript:index.bzl`

* with the loading changes above, `load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")` is
  no longer needed in the WORKSPACE which also means that yarn_install does not need to run unless building/testing
  a target that depends on @npm. In angular/angular this is a minor improvement as almost everything depends on @npm.

* @angular/bazel package is also updated in this PR to support the new load location; Angular + Bazel users that
  require it for ng_package (ng_module is no longer needed in OSS with Angular 10) will need to load from
  `@npm//@angular/bazel:index.bzl`. I investigated if it was possible to maintain backward compatability for the old
  load location `@npm_angular_bazel` but it is not since the package itself needs to be updated to load from
  `@npm//@bazel/typescript:index.bzl` instead of `@npm_bazel_typescript//:index.bzl` as it depends on ts_library
  internals for ng_module.

* runfiles.resolve will now throw instead of returning undefined to match behavior of node require

Other changes in angular/angular:

* integration/bazel has been updated to use both ng_module and ts_libary with use_angular_plugin=true.
  The latter is the recommended way for rules_nodejs users to compile Angular 10 with Ivy. Bazel + Angular ViewEngine is
  supported with @angular/bazel <= 9.0.5 and Angular <= 8. There is still Angular ViewEngine example on rules_nodejs
  https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular_view_engine on these older versions but users
  that want to update to Angular 10 and are on Bazel must switch to Ivy and at that point ts_library with
  use_angular_plugin=true is more performant that ng_module. Angular example in rules_nodejs is configured this way
  as well: https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular. As an aside, we also have an
  example of building Angular 10 with architect() rule directly instead of using ts_library with angular plugin:
  https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular_bazel_architect.

NB: ng_module is still required for angular/angular repository as it still builds ViewEngine & @angular/bazel
also provides the ng_package rule. ng_module can be removed in the future if ViewEngine is no longer needed in
angular repo.

* JSModuleInfo provider added to ng_module. this is for forward compat for future rules_nodejs versions.
  @josephperrott, this touches `packages/bazel/src/external.bzl` which will make the sync to g3 non-trivial.

PR Close #37727
2020-10-01 15:34:36 -07:00
Joey Perrott f7213cb57a fix(dev-infra): correct matching logic for g3 comparison (#39084)
Corrects the matching logic for g3 comparison check, previously more matches were
found than were correct.

PR Close #39084
2020-10-01 15:27:13 -07:00
Andrew Kushnir 4bce21358d feat(dev-infra): add a command to verify NgBot YAML config syntax (#39071)
This commit adds a new command to the `ng-dev` suite, which verifies that the NgBot YAML config is
correct. It also adds this command to the `lint` CircleCI job so that we execute this check while
running CI.

This should help prevent syntax errors similar to the one introduced in:
393ce5574b

PR Close #39071
2020-10-01 12:31:44 -07:00
Joey Perrott 21213e1531 fix(dev-infra): run git fetch in quiet mode (#39068)
Runs git fetch with the -q flag during fetch while comparing the master and
g3 branches.

PR Close #39068
2020-10-01 09:30:15 -07:00
Joey Perrott c8d757624b refactor(dev-infra): use common git client for git environment reset (#39051)
For rebase tooling, use the `GitClient`'s `checkout` method rather than a custom
function doing the same task.

PR Close #39051
2020-09-30 09:36:01 -04:00
Paul Gschwendtner f96dcc5ce0 feat(dev-infra): tool for staging and publishing releases (#38656)
Creates a tool for staging and publishing releases as per the
new branching and versioning that has been outlined in the following
document. The tool is intended to be used across the organization to
ensure consistent branching/versioning and labeling:

https://docs.google.com/document/d/197kVillDwx-RZtSVOBtPb4BBIAw0E9RT3q3v6DZkykU/edit#heading=h.s3qlps8f4zq7dd

The tool implements the actions as outlined in the following
initial plan: https://hackmd.io/2Le8leq0S6G_R5VEVTNK9A.

The implementation slightly diverged in so far that it performs
staging and publishing together so that releasing is a single
convenient command. In case of errors for which re-running the
full command is not sufficient, we want to consider adding
recover functionality. e.g. when the staging completed, but the
actual NPM publishing aborted unexpectedly due to build errors.

PR Close #38656
2020-09-28 16:11:42 -04:00
Paul Gschwendtner 372a6cf8d7 feat(dev-infra): add release command for setting NPM dist tag (#38656)
Introduces a new command for `ng-dev release`, so that the NPM
dist tag can be set for all configured NPM packages. This command
can be useful in case a manual tag needs to be set, but it is
primarily used by the release tooling when a new stable version
is cut, and when the previous patch branch needs to be set as LTS
version through a `v{major}-lts` dist tag.

It is necessary to have this as a command so that the release tool
can execute it for old branches where other packages might have been
configured. This is similar to the separate `ng-dev build` command
that we created.

Note that we also added logic for spawning a process conveniently
with different "console output" modes. This will be useful for
other command invocations in the release tool and it's generally
better than directly using native `child_process` as that one doesn't
log to the dev-infra debug log file.

PR Close #38656
2020-09-28 16:11:42 -04:00
Paul Gschwendtner b9dce19b3d feat(dev-infra): add command for building release output (#38656)
Adds a command for building all release packages. This command
is primarily used by the release tool for building release output
in version branches. The release tool cannot build the release packages
configured in `master` as those packages could differ from the
packages available in a given version branch. Also, the build process
could have changed, so we want to have an API for building
release packages that is guaranteed to be consistent across branches.

PR Close #38656
2020-09-28 16:11:42 -04:00
Paul Gschwendtner 964ac1542a refactor(dev-infra): move existing env-stamp command into subfolder (#38656)
Moves the existing `ng-dev release env-stamp` command into a
subfolder so that the staging/publish tool can have its own
dedicated folder (without being polluted by the env-stamp logic).

Every subcommand should be in its own folder.

PR Close #38656
2020-09-28 16:11:42 -04:00
Paul Gschwendtner 8b01d42e5d feat(dev-infra): add shared testing utilities folder with git mock (#38656)
Adds a new folder to dev-infra where shared testing utilities
could be placed in. This commit already adds initial testing
utilities for dealing with the `GitClient` and SemVer versions.

The `GitClient` in the testing utilities simulates actual Git
behavior in a virtual manner. It's not complete at all, but can
be extended based on our needs. The currently implemented commands
are the most basic ones that we'd need for our release tooling.

PR Close #38656
2020-09-28 16:11:41 -04:00
Paul Gschwendtner 474ecf6d00 feat(dev-infra): add logic for printing active release trains (#38656)
Adds a method for printing active release trains for a configured
project. This is helpful for the release tool that will print
the active release trains. Also this can be useful for the
caretaker status command, where we could print the active
version branches (i.e. "is there currently a feature-freeze branch").

PR Close #38656
2020-09-28 16:11:41 -04:00
Paul Gschwendtner caa7f9808f feat(dev-infra): add logic for determining active LTS branches (#38656)
Adds logic for determining active LTS branches for a given
release configuration. The active LTS branches can be determined
by querying NPM and matching dist tags against a specific
pattern. i.e. `v{major}-lts`.

This logic will be useful for the release tool that supports
publishing of active LTS version branches.

PR Close #38656
2020-09-28 16:11:41 -04:00
Paul Gschwendtner 69bb49e530 refactor(dev-infra): cleanup comments in git utilities (#38656)
Cleans up outdated comments in the shared dev-infra Git
utilities. We also export the Graphql client for consistency
as we expose the `GithubClient` and `GitClient` too.

PR Close #38656
2020-09-28 16:11:41 -04:00
Paul Gschwendtner 9dccaa9570 refactor(dev-infra): move common versioning tooling to shared location (#38656)
We initially added logic for determining active release trains into
the merge script. Given we now build more tools that rely on this
information, we move the logic into a more general "versioning" folder
that can contain common logic following the versioning document for the
Angular organization.

PR Close #38656
2020-09-28 16:11:40 -04:00
Paul Gschwendtner e1c11a36c7 feat(dev-infra): introduce new configuration for release tool (#38656)
Introduces a new configuration for the `ng-dev release` command. This
configuration will be the source of truth for all release packages
and how they can be built.

Additionally, in a temporary manner where each project has its own
way of generating the changelog, the changelog generation can be
configured. This will be removed in the future when there is
canonical changelog generation in the dev-infra shared package.

PR Close #38656
2020-09-28 16:11:40 -04:00
Paul Gschwendtner c1b47bcfaa refactor(dev-infra): expose logic for dealing with LTS branches (#38656)
Exposes logic for dealing with LTS branches, so that the release
tool can re-use it for cutting LTS patch releases.

Eventually, we can move all of this logic to a more dedicated
folder instead of having it inside the merge folder.

PR Close #38656
2020-09-28 16:11:40 -04:00
Paul Gschwendtner d7ff8d765c refactor(dev-infra): use shared github repo interface (#38656)
Instead of maintaining multiple interface for grouping
owner name and repo name, we expose a shared interface
describing a Github repository.

One unfortunate downside is that the GraphQL Github
and Rest API diverge slightly with the key for the
repository name. i.e. rest uses `repo` for the name
of a repository, while GraphQL uses `name` for the name.

If that would be consistent, we could use the rest operator
to pass a repository to the Octokit REST or GraphQL API. This
does not work, so we have a small manual overhead as seen
in the `branches.ts` file.

PR Close #38656
2020-09-28 16:11:40 -04:00
Paul Gschwendtner 3a598cf5ed build: add tsconfig with strict flag to dev-infra package (#38656)
The dev-infra package is currently built with Bazel and ts-node.
In Bazel, the shared tsconfig from the `packages/` folder is used.

This means that the code is built in strict mode, but IDEs and
ts-node do not know about the strictness. This is because the tsconfig
is part of the `packages` folder and not accessible from the
dev-infra package. We fix this by adding an IDE and ts-node specific
tsconfig to the dev-infra package.

This helps with spotting compilation failures before building
with Bazel / waiting for CI to check build state.

PR Close #38656
2020-09-28 16:11:39 -04:00
Paul Gschwendtner b041c118e3 refactor(dev-infra): expose version for determined release trains (#38656)
Previously, the logic for determing the active release trains did not
return the resolved version of a release train. With the publish script
being created, we need this information and can just pass it through,
so that we do not need to fetch and parse the package.json of given
branches multiple times.

PR Close #38656
2020-09-28 16:11:39 -04:00
Paul Gschwendtner 6af638d58e build: set up ora for progress spinners in dev-infra package (#38656)
Sets up the NPM `ora` package in the project and in dev-infra,
so that we can show progress spinners when needed. This is useful
in the publish release script when we wait for a pull request to
be merged.

PR Close #38656
2020-09-28 16:11:39 -04:00
Paul Gschwendtner 9e0e763156 refactor(dev-infra): do not print git commands in silent mode (#38656)
The git client respects the `SpawnSyncOptions` when a command
is executed. Currently it does not hide the command info
messages when commands are run in silent mode.

We fix this as part of this commit, so that the command info
is only printed to `debug` if `stdio` is set to `ignore`.

Additonally, the github token is made public so that it can be
used by commands if other repositories like forks are targeted.

PR Close #38656
2020-09-28 16:11:39 -04:00
Paul Gschwendtner 758d0e2045 refactor(dev-infra): share more github code between commands (#38656)
Instead of repeating the logic for adding the github token to
a repository git url, we add a shared function for automatically
computing the URls with token.

Additionally, URLs for updating/generating tokens have been moved
to a dedicated file in the `utils` folder. Also while being at it,
the yargs github token helper is also moved into the dedicated
Git/Github related util folder.

PR Close #38656
2020-09-28 16:11:38 -04:00
Wagner Maciel b1682526dd refactor(dev-infra): simplify runBenchmark (#38941)
* Make url and params optional in runBenchmark
* Make url optional in openBrowser
* Remove unused code from runBenchmark

PR Close #38941
2020-09-22 15:05:34 -07:00
Andrew Kushnir 2d6105a784 feat(dev-infra): output the number of new and fixed cycles (#38805)
This commit adds a logic to ouput the number of new and fixed cycles after running circular
dependency checker. This information is useful to better understand an impact of changes in case
the number of new/fixed cycles is relatively big.

PR Close #38805
2020-09-18 11:20:08 -07:00
Joey Perrott 55485713a3 fix(dev-infra): skip husky git commit hooks while merging pull requests (#38888)
During the merge process, all validations have already been completed so git commit
hooks can be safely skipped.  This additionally, prevents errors from occuring which
would be caused the commit hooks executing, such as when yarn updates and then yarn
commands are unable to run within the same process.

PR Close #38888
2020-09-18 11:14:55 -07:00
Joey Perrott 722699fb0c fix(dev-infra): handle no caretaker config being defined (#38862)
Properly handle cases where no caretaker config is provided to ng-dev commands

PR Close #38862
2020-09-16 15:22:10 -07:00
Joey Perrott d192c87f6a refactor(dev-infra): refactor commit-message files (#38845)
Refactor the commit-message files to be consistent with how other ng-dev tooling
is structured.

PR Close #38845
2020-09-15 16:05:42 -07:00
Joey Perrott b9ca6d20cc feat(dev-infra): include CI status check in the caretaker check (#38779)
Add a CI status check in the ng-dev caretaker check command.

PR Close #38779
2020-09-15 08:45:02 -07:00
Joey Perrott e00535a2a4 fix(dev-infra): remove ANSI escape codes from log file outputs (#38792)
Remove the ANSI codes from the log file outputs to make the ng-dev log files
more readable.

PR Close #38792
2020-09-15 08:44:00 -07:00
Joey Perrott 78e1ecb161 feat(dev-infra): allow local ng-dev configuration to error on invalid commit messages (#38784)
As part of the commit message conformance check, local commit message checks are
made to be warnings rather than failures. An additional local option is also in
place to allow for the commit message validation failures to be considered errors
instead.

PR Close #38784
2020-09-14 14:34:50 -07:00
Paul Gschwendtner e162da0753 refactor(dev-infra): do not validate config file multiple times (#38808)
Currently we validate the configuration file on each `getConfig`
invocation. We can only validate once since the configuration
is cached.

Also while being at it, renames the cache variables to lower-case as those
do not represent constants (which are convention-wise upper case).

PR Close #38808
2020-09-14 08:34:15 -07:00
Joey Perrott 6768fe9927 fix(dev-infra): correct build setup for dev-infra (#38815)
Correct's the missing dependencies and incorrect build dependencies for the
dev-infra bazel targets.

PR Close #38815
2020-09-11 13:59:30 -07:00
Wagner Maciel da14b72550 refactor(dev-infra): add default params to runBenchmark (#38748)
* Use '' as the default for 'url'
* Use [] as the default for 'params'
* Use true as the default for 'ignoreBrowserSynchronization'

PR Close #38748
2020-09-11 08:44:35 -07:00
Joey Perrott 1373a98e25 feat(dev-infra): Allow local user ng-dev configuration to disable commit message wizard (#38701)
As not all users, particularly contributors consistently contributing with a deep
understanding of our commit message guidelines, will not want to rely on the
commit message wizard, we allow a user to opt out of using this wizard during
commit message creation.

PR Close #38701
2020-09-09 16:31:17 -07:00
Joey Perrott 1ed6913b8b feat(dev-infra): Add support for local user ng-dev configuration (#38701)
Create a utility for loading a local user configuration object to describe
local configuration values, such as skipping the commit message wizard.

PR Close #38701
2020-09-09 16:31:16 -07:00
Joey Perrott f9421184ef refactor(dev-infra): update commit message validation to return validation result (#38703)
Previously, the validateCommitMessage function ran validation and logged the results.
The validateCommitMessage function now returns an object containing the validation
results and the cli action functions are instead responsible for logging the results.

This is being done as a prefactor for a change which allows for commit message
hook validation to be either a blocking error or a warning.

PR Close #38703
2020-09-09 16:22:36 -07:00
Joey Perrott d896c33b0e fix(dev-infra): set build commit message type to allow an optional scope (#38745)
Allow, optionally, a scope to be used with the build type commit message.

PR Close #38745
2020-09-09 09:06:33 -07:00