Skip to content

Cherry-picking monorepo CI scripts to 0.71-stable - #35946

Merged
kelset merged 8 commits into
react:0.71-stablefrom
hoxyq:0.71-stable-fresh-ci-scripts
Jan 25, 2023
Merged

Cherry-picking monorepo CI scripts to 0.71-stable#35946
kelset merged 8 commits into
react:0.71-stablefrom
hoxyq:0.71-stable-fresh-ci-scripts

Conversation

@hoxyq

Copy link
Copy Markdown
Contributor

Summary

Cherry-picking all commits related to Phase 2 of react-native-community/discussions-and-proposals#480. This adds scripts to 0.71-stable branch, scripts may be used for package versions bumps and versions alignment across packages.

Changelog

[Internal] [Added] - added CI scripts for monorepo

Test Plan

  • CircleCI

@hoxyq
hoxyq requested a review from kelsetJanuary 24, 2023 10:07
@facebook-github-botfacebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Jan 24, 2023
@react-native-botreact-native-bot added the Type: Enhancement A new feature or enhancement of an existing feature. label Jan 24, 2023
@hoxyq

Copy link
Copy Markdown
ContributorAuthor

@kelset Looks like js tests and iOS on 0.71-stable are broken: https://github.com/facebook/react-native/commits/0.71-stable

@kelset

Copy link
Copy Markdown
Contributor

@kelset Looks like js tests and iOS on 0.71-stable are broken: 0.71-stable (commits)

yeah that's expected, let me see if I can deal with them locally - the iOS ones are related to pods (side effect of how we do releases), the JS ones are related to the non-monorepo shape... should be all locally addressable

Ruslan Lesiutinand others added 7 commits January 24, 2023 14:02
… template initialization
Summary:
Changelog:
[Internal] [Changed] - now bootstrapping Verdaccio before template app initialization, this is required because react-native migh depend on some package which version is not yet published to npm
Differential Revision: D41521496
fbshipit-source-id: 7a32d4de80ff1de0840760380cda410bed626808
…rcleci (#35621)
Summary:
Pull Request resolved: #35621
Changelog: [Internal]
1. Added `for-each-package.js` script. This can be used to iterate through all of the packages inside `/packages` with the access to package manifest. This soon can be used as a replacement for `yarn workspaces --info`
2. Added `find-and-publish-all-bumped-packages.js` script. This script iterates through all the packages and detects if the version was changed via `git log -p` (same as `git diff`). If so, it tries to publish it to npm.
3. Added corresponding job and workflow to CircleCI config, which will use this script
Reviewed By: cortinico
Differential Revision: D41972733
fbshipit-source-id: d9de31365d5a68381d3326674ca12608472a6f96
Summary:
Changelog: [Internal]
These changes add usage of `forEachPackage` as a replacement for `yarn --json workspaces info`.
This is because at some point in release cycle there is a script which removed `workspaces` block from react-native's `package.json`, so `yarn --info workspaces info` produces an error
Reviewed By: cortinico
Differential Revision: D41996732
fbshipit-source-id: f1f89c6766aed213df6f1fb18305925ff2e4928c
…rcleci
Summary:
Changelog: [Internal]
1. Added `for-each-package.js` script. This can be used to iterate through all of the packages inside `/packages` with the access to package manifest. This soon can be used as a replacement for `yarn workspaces --info`
2. Added `find-and-publish-all-bumped-packages.js` script. This script iterates through all the packages and detects if the version was changed via `git log -p` (same as `git diff`). If so, it tries to publish it to npm.
3. Added corresponding job and workflow to CircleCI config, which will use this script
Differential Revision: D41972733
fbshipit-source-id: 6a8b8c2995943d6c8421cbe19cd291069655183b
… of packages (#35767)
Summary:
Pull Request resolved: #35767
Changelog: [Internal]
Introducing a script, which can be used to identify all packages inside `/packages`, which contain any changes after the last time its version was changed
How it works step by step:
```
check that no git changes are present
for each package:
if package is private -> skip
grep id of the last commit that changed package
grep id of the last commit that changed version of the package
if these ids are different:
bump package patch version
commit changes if required
```
Can be executed only in git environment and by running: `node ./scripts/bump-all-updated-packages`
---
Also adding a separate script `align-package-versions.js`, which can be used to update versions of packages inside consumer packages
```
check that no git changes are present
for each package x:
for each package y:
if y has x as dependency:
validate that y uses the latest version of x
if some changes were made:
run yarn
```
---
Q: Why `run_yarn` step was removed from CircleCI flow?
A: For *-stable branches, there are no yarn workspaces and all packages are specified as direct dependencies, so if we update `react-native/assets-registry` to the next version, we won't be able to run `yarn` for react-native root package, because updated version is not yet published to npm
To avoid this, we first need publish new versions and then update them in consumer packages
---
The final flow:
1. Developer uses `node ./scripts/bump-all-updated-packages` to bump versions of all updated packages.
2. Commit created from step 1 being merged or directly pushed to `main` or `*-stable` branches
3. A workflow from CircleCI publishes all updated versions to npm
4. Developer can use `align-package-versions.js` script to create required changes to align all packages versions
Reviewed By: cortinico
Differential Revision: D42295344
fbshipit-source-id: 54b667adb3ee5f28d19ee9c7991570451549aac2
…repo/__tests__
Summary:
Changelog: [Internal]
just a small cleanup, moved all tests related to monorepo scripts under `/scripts/monorepo`
Reviewed By: cortinico
Differential Revision: D42308455
fbshipit-source-id: 7743a2af1381ff748556c15b89cf980f8f907674
… version of the package (#35810)
Summary:
Pull Request resolved: #35810
Changelog: [Internal]
`bump-all-updated-packages` script now supports `release-branch-cutoff` argument
If this argument is provided, the script will bump each public package to next minor version
Updated [wiki](https://github.com/facebook/react-native/wiki/Release-and-its-automated-processes) with relevant information about how to use it
Reviewed By: cortinico
Differential Revision: D42455329
fbshipit-source-id: a40d2f5dc356f22d3182da3a118c6383b634817d
@hoxyq
hoxyqforce-pushed the 0.71-stable-fresh-ci-scripts branch from 28da0eb to 12f65b5CompareJanuary 24, 2023 14:02
…before testing template app (#35444)
Summary:
Pull Request resolved: #35444
Changelog:
[Internal][Changed] - now using Verdaccio to publish necessary packages for template app
- Adds script `/scripts/template/install-dependencies.js`, which incapsulates the logic of installing dependencies of template app
- The idea of the script is to run verdaccio and publish all necessary packages to node_modules, since these packages might not yet be present on npm
- This should also potentially resolve some template app test failures on CircleCI related to package-ifying Animated, VirtualizedList, FlatList modules
Reviewed By: cortinico
Differential Revision: D41498086
fbshipit-source-id: 48fbbb1c9334e7a9e7657e6275b7b04f9ce290b5
@hoxyq
hoxyqforce-pushed the 0.71-stable-fresh-ci-scripts branch from 12f65b5 to 526c194CompareJanuary 24, 2023 14:34

@kelsetkelset left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks clean (after all, you've worked on this quite a while and went through quite a few reviews already!) and I've even downloaded it locally and tested that the commands yarn align-package-versions and yarn bump-all-updated-packages work just fine 👍

Once merged, we'll be able to verify if CI stays green (as it currently is in 0.71-stable) or not, and address any upcoming issues when trying to deliver 0.71.2 early next week - thanks for all your work, this is great 👏

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.p: FacebookPartner: FacebookPartnerType: EnhancementA new feature or enhancement of an existing feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@hoxyq@kelset@Titozzz@facebook-github-bot@react-native-bot