Summary:
This change migrates the prepare_release workflow from CCI to GHA
## Changelog:
[Internal] - Migrate from CCI to GHA
Pull Request resolved: https://github.com/facebook/react-native/pull/44833
Test Plan: Test on GHA
Reviewed By: huntie
Differential Revision: D58289050
Pulled By: cipolleschi
fbshipit-source-id: 134fc7ffb66a18eec1187e14500daec2828cae61
Summary:
On React Native macOS (I am not sure with the current state of React Native), the Xcode Unit and Integration tests are a bit flaky. Rather than set "retry on failure up to 3 times" through the pipeline config (in our case, Azure Pipelines), I realized my earlier PR to use Xcode test plans (https://github.com/facebook/react-native/pull/36443) means we can have Xcode retry the test. This should be faster than retrying it on the pipeline, because it retries just the failing test, not the entire "test" step. I did this on React Native macOS, so I'm doing it upstream so we can remove a diff.
## Changelog:
[INTERNAL] [CHANGED] - Set `retryOnFailure` for Xcode Unit and Integration tests
Pull Request resolved: https://github.com/facebook/react-native/pull/44642
Test Plan: CI should pass (faster)
Reviewed By: cortinico
Differential Revision: D57662523
Pulled By: cipolleschi
fbshipit-source-id: 8de2ab0ea15ba4d38c3b5bf96108c0c7ff5e9f32
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44339
We require the wrapper code for in repository calls to these packages directly from node (i.e. using CommonJS). This wrapper code typically sits at the entrypoint of the build packages (i.e. `index.js`).
NOTE: This unblocks an issue preventing me from landing further work on the `helloworld` cli replacing the community template.
## Problem:
The [flow-api-translator](https://www.npmjs.com/package/flow-api-translator) library doesn't allow CommonJS `module.exports` when generating TypeScript Type Defintions.
## Change
1. At the built time, this strips out our wrapper code and sets up the dist/ folder appropriately for npm distribution.
2. Updated the `package.json` files to consistently share Flow types
Changelog: [Internal] refactor build packages output to remove wrapper.
NOTE: Added better error messages when users deviated from the current pattern:
{F1501571608}
Reviewed By: huntie
Differential Revision: D56762162
fbshipit-source-id: f110b31e4ad780998dbc81a2482891ac8d8c6458
Summary:
We might want to publish some new versions of React Native with experimental feature to allow some partners to test whether those versions fixes some reported issues, before creating a proper stable version for the whole ecosystem.
The infra is mostly [setup for this](https://www.internalfb.com/code/fbsource/[496a64d180faab501b8598aa0ec26d47454fb961]/xplat/js/react-native-github/scripts/releases/utils/version-utils.js?lines=149), already. The only detail we need to take care of is not to move the `next` tag.
## Changelog:
[Internal]
Reviewed By: cortinico, huntie
Differential Revision: D56578456
fbshipit-source-id: 8dcc674aab5f85077c1b3e6580c5aeb99226eff8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44233
The package was added to our build scripts, but shouldn't have been. We're not exporting this package or making it public.
Changelog: [Internal]
This should unblock our OSS CI.
Reviewed By: cipolleschi
Differential Revision: D56513694
fbshipit-source-id: f37c75871253b2570fb933175165d8f0a9593a16
Summary:
This is a copy of the current packages/react-native/template that we exclusively use internally for testing.
Changelog: [Internal]
NOTE: Best contribution would be to scan the file list and ensure there isn't anything that shouldn't be in there.
bypass-github-export-checks
Reviewed By: cortinico, cipolleschi
Differential Revision: D56242484
fbshipit-source-id: 0913ff7acff9b0314b49f48e986674b77dbb908e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44088
This is a power user option for Release Crew members when testing locally — a flag to bypass being blocked on the latest in-progress CircleCI job and instead fetch build artifacts from the most recent successful pipeline (typically `HEAD~1`).
Example use cases where the latest pushed commit isn't impactful:
- An iOS-only fix, meaning Android can be tested now.
- A trivial fix that applies to CI only (e.g. RNTester Podfile.lock update).
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D56138727
fbshipit-source-id: f9884bdb289a92486807e8e033b756466fcec559
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43568
Fixes to restore passing CI checks on main after D55027120.
- Widen validation checks in version utils to accept `0.x.x` (as opposed to `0.[not-'0'].x`).
- Use `tag: test` instead of `tag: latest` for dry run job params.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D55123739
fbshipit-source-id: 9f76dced4e7aa3ce87d6680cd7687ae443305331
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43534
This is no longer used after switching to the new release workflow, which uses the newer and less error-prone `set-version` script.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D55027122
fbshipit-source-id: faa8cfd2af9b54fab611b108df162793c5768695
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43533
Switch to the new unified release workflow by default, now that this has been validated on the `0.74-stable` branch.
- Remove `--use-new-workflow` flag and remove legacy logic.
- Remove legacy `prepare_package_for_release` CI job, and use `run_new_release_workflow` -> `run_release_workflow` as new workflow condition match.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D55027120
fbshipit-source-id: 7c05cdff95ac369ce6cd1201ccfc5718798c4da6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43530
Fixes and changes following D54956345, encountered during the release process for 0.74 RC4 today.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D55017872
fbshipit-source-id: 616b387088db00c6f076f4571b4ab1541467361c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43518
This is a minimum approach to achieve a **single-command publish flow** for React Native, unifying the previous `yarn bump-all-updated-packages` and `yarn trigger-react-native-release` workflow entry points.
This diff aims to change as little as possible to achieve the above — introducing a new job that merges operations to create the versioning commit. The triggered publish jobs are unchanged. In future, we may follow this change with further simplifications down the workflow tree.
**Key changes**
- Adds a new CircleCI workflow, `prepare_release_new`, which versions **all packages** and writes a single release commit.
- This replaces `yarn bump-all-updated-packages`, now implemented with the newer `set-version` script.
- Wires this up as an experiment within `trigger-react-native-release.js`, conditionally running the new workflow when `--use-new-workflow` is passed.
**Not changed**
- The single release commit written will continue to trigger both of the existing CI workflows on push (`publish_release` and `publish_bumped_packages`), which are unchanged.
- The commit summary now includes the `#publish-packages-to-npm` marker, in order to trigger `publish_bumped_packages`.
- Usage: Release Crew members will continue to use the existing local script entry point (as [documented in the releases repo](https://github.com/reactwg/react-native-releases/blob/main/docs/guide-release-process.md#step-7-publish-react-native)), with the opt in flag.
```
yarn trigger-react-native-release --use-new-workflow [...args]
```
After we're happy with the E2E behaviour of this workflow in the next 0.74 RC, I will follow up by dropping the `--use-new-workflow` flag and removing the old scripts (T182533699).
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D54956345
fbshipit-source-id: 35fd7af8f3e60a39507b5d978ccd97472bf03ddb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43513
The previous `update_podfile_lock.sh` script would fail as executed from the repo root (could not locate RNTester dir). Delete this and replace with direct calls in `prepare-package-for-release.js`, which will fail script on error.
{F1469216632}
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D54949214
fbshipit-source-id: 4f032069e803e84f835c279d01332d16787dfafc
Summary:
Changelog: [Internal]
Use our build script for packages and to generate the TypeScript types.
bypass-github-export-checks
Reviewed By: huntie
Differential Revision: D54428870
fbshipit-source-id: 2a1666d30ac472300979b2be078a906d390e919a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43323
This fixes a seemingly pre-existent misconfiguration within our `test_ios_template` E2E test setup in CircleCI.
**Background**
We call `npx react-native-community/cli init` with the `--skip-install` flag, as part of the bootstrapping logic in `scripts/e2e/init-template-e2e.js`. This is necessary because we later want to explicitly call `npm install` with a custom `--registry` for our locally mirrored packages (via Verdaccio).
For some reason, we were observing unexpected differences when this was run under CircleCI:
1. Runs `yarn init`
2. Runs a `yarn add` (unknown pkg)
{F1464781818}
https://app.circleci.com/pipelines/github/facebook/react-native/42725/workflows/f648468b-e916-4501-887d-ad293aa6fccf/jobs/1398950
This is causing a Yarn-based install ahead of where we want — ignoring the `--skip-install` flag.
*I'm still unsure on the exact LOC cause in CLI* (but most likely, it's around the Yarn v3 move).
**Impact of this fix**
- The above meant that, when we were bootstrapping `test_ios_template` previously, packages weren't being read from Verdaccio, but **instead from npm** — using the `"0.74.0"` versions from the *previous branch cut* ❌.
- After D54006327, this behaviour became breaking 💀 — since for the 0.74 -> 0.75 cut, we no longer physically published `"0.75.0-main"` (new format) packages to npm.
**This change**
I'm passing `--pm npm` to `npx react-native-community/cli init` to skip around any Yarn behaviour. This appears to have removed the erroneous `yarn` invocations ✅.
Changelog: [Internal]
bypass-github-export-checks
Reviewed By: cortinico, cipolleschi
Differential Revision: D54536848
fbshipit-source-id: 473b11924955f5787c82a6c81d4527d77b810aa5
Summary:
Addresses a gap when using the `set-version` script to update all packages on `main` (i.e. post branch cut):
- Package versions were not being set consistently. It is safe to version all workspace packages, including `"private"`.
- Our publishing workflow is independent from this, and only considers public packages for submission to npm.
- We also need to update the root `package.json`, which includes `devDependencies` referencing workspace dependencies.
Unblocks https://github.com/facebook/react-native/pull/43132.
Changelog: [Internal]
Reviewed By: lunaleaps
Differential Revision: D54419456
fbshipit-source-id: 93eee669c5cf7c2f16b68a2bf41e9a8ace5521bf
Summary:
Make the snapshot output of this test terser (since `set-version` is a superset of the fully tested `set-rn-version` script). Notably, this removes any instances of `generated` from the snapshot file, which would hide the diff in PRs.
Changelog: [Internal]
Reviewed By: lunaleaps
Differential Revision: D54420338
fbshipit-source-id: e4a94b1fda34efaedf1b309496954be35acd5f98
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43133
I noticed inconsistent handling of terminating newlines in D54006327@V1, and had also been noticing `yarn build` reformatting unrelated sections of `package.json` files.
For now, this logic isn't moved to a shared util, since there will likely be a higher level abstraction for the release scripts in the next batch of improvements.
Changelog: [Internal]
Reviewed By: lunaleaps, cipolleschi
Differential Revision: D54007565
fbshipit-source-id: 74d58362a85be4fae2f9e058b6c6622a026ff0a0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43130
Various fixes/tweaks to the `test-e2e-local` script, impacted by recent changes, found during the release process:
- Fix typo in variable name for `circleciToken` arg.
- Relocate erroneously positioned `process.exit` call (a force exit around Verdaccio, which we will remove in future).
- Add notice on exit around Verdaccio server not being killed successfully (to do in T179377112).
- Switch from Yarn to npm for test project installation — Yarn 3 is not respecting `npmRegistryServer`, see https://github.com/yarnpkg/yarn/issues/2508.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D53951606
fbshipit-source-id: f6e29ef6c9ab33ebf60124757576fcb54219f339
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43053
- Relocate under `scripts/e2e/` (also move util used only by this cript).
- Type as Flow (to catch trivial errors). Some cleanup of `log()` calls as errors.
Changelog: [Internal]
Reviewed By: lunaleaps
Differential Revision: D53813023
fbshipit-source-id: 05caf415ec0bf3739a6f7fec3afd385a195f42e9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43001
More understandable name: ~"React Native init, for E2E testing". Also relocates Verdaccio config and storage location under `scripts/e2e/` (resolving TODO comment).
The intent is for the `scripts/e2e/` dir to also group the existing E2E testing-related scripts — although I will stop here for the current release-related work.
Changelog: [Internal]
Reviewed By: lunaleaps
Differential Revision: D53609332
fbshipit-source-id: fb2f6502a18c4a4ac2368b46af1e3ee42edbadd6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42899
Updates the `test-e2e-local` script to bootstrap `/tmp/RNTestProject/` using the currently checked out repository as the source of truth for all monorepo packages (previously we only did this for the `react-native` package).
This enables release testers to validate a release **before** physically publishing new dependency versions via `yarn bump-all-updated-packages`.
We are able to reuse the `scripts/template/initialize.js` script that is currently used for E2E validation in CI. This sets up a local Verdaccio server during project install.
NOTE: The time taken for `Build packages` + Verdaccio isn't ideal, I may explore a way to reuse the published package state in a future diff. Until then, this extra time (~1 min) will still be much less pain than the `bump-all-updated-packages` + commit process loop.
Changelog:
[Internal] - Update test-e2e-local to use source monorepo packages for RNTestProject
Reviewed By: lunaleaps
Differential Revision: D53484510
fbshipit-source-id: 600a8a3257a4947d7738ab9d908d6549c38545e6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43039
Changelog: [Internal] - `publish-npm.js` is a [script we call in our CI](https://www.internalfb.com/code/fbsource/[c0b8566ac0d66c2c0282eeb597bfb54bedf757c6]/xplat/js/react-native-github/.circleci/configurations/jobs.yml?lines=1243) to publish the react-native package and others.
Currently, the script leverages `exit/process.exit` to terminate early in a couple of places which makes the code hard to test because our tests don't truly early exit when `exit/process.exit` is called.
This change removes any explicit `exit` calls and instead leverages the uncaught error to terminate the process and set the non-zero exit code. This makes our tests more accurate to the real control flow of the script.
I've also updated the tests to better capture what we're actually testing by mocking at a higher level.
Reviewed By: cipolleschi
Differential Revision: D53792754
fbshipit-source-id: 9293bb9a95430c50052db36c0e6f6c1ba348107f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42941
I noticed that programatically running `npm set registry <value>` would fail within the repo root dir (intended run location) (`node` version `18.18.2`).
```
npm ERR! This command does not support workspaces.
```
It turns out this is no longer supported from npm 9.x: https://github.com/npm/cli/issues/6099. **Note**: The workaround discussed in this thread is incompatible/nontrivial with `npx`, so I've opted to remove this behaviour.
**Changes**
- Remove `npm set registry http://localhost:4873` call.
- This is non-breaking due to the [explicit `--registry` arg already present in `run-e2e-ci-tests.js`](https://github.com/facebook/react-native/blob/b366b4b42e0f91eb2b1850c404fadd0f0322fc61/scripts/run-ci-e2e-tests.js#L102). The previous `.npmrc` config value is unnecessary, and probably was being ignored (will be validated for this PR in CircleCI run).
- Add comment against remaining `.npmrc` write, convert to `fs` call.
- Remove unused params on `setupVerdaccio` (moved to constants which will be exported and referenced in the next diff).
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D53609308
fbshipit-source-id: 77d3666b42963cd61f6d3fd0be00cdc19bbb1ec8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43035
Changelog: [Internal] - We early-exited because of poor copy-pasta and the fact that our tests don't properly emulate the behavior of mock `exit`
Will try and clean this up in next diff but want to quickly fix so it unbreaks nightlies
Reviewed By: yungsters
Differential Revision: D53779109
fbshipit-source-id: ff56e498344fcb4851729d98625b6c7010c73795
Summary:
Changelog: [Internal] - `get-and-update-packages` was deleted in D53487874 also actually published the monorepo packages.
Update publish-npm to publish the updated nightly monorepo packages
Reviewed By: cipolleschi
Differential Revision: D53697621
fbshipit-source-id: 21facb49739ba64c43b921117356715be3d8868a
Summary:
Changelog: [Internal] - We still use the `dry-run` build variant in template tests on CircleCI
Previous diff migrated `set-rn-version` to `set-version` for dry-run, prealpha, and nightly build types. I didn't realize that template test flow used `dry-run` builds. I thought it was just for commitlies (which are deprecated).
To properly migrate this site, I need to fix the template test flow to accept monorepo packages at the same version as the dry-run react-native version (1000-<commithash>)
For now, let's just make this change more precise, and only update the nightly flow
See this error: {F1455663616}
Template test flow doesn't fake publish the monorepo packages at this version -- they're still using the versions off of main
Reviewed By: mdvacca
Differential Revision: D53688238
fbshipit-source-id: 6b64baca7eac842f2207fe13a3046b18459228da
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42958
Changelog: [Internal] - Add support to `set-version` that we can bump the monorepo packages on main
This should be used after we cut a release branch. The release crew should then run
`yarn set-version 0.next.0-main --skip-react-native-version`
This makes sure we don't update `react-native` on main branch and keep it at 1000.0.0
This essentially replaces:
`yarn bump-all-updated-packages --release-branch-cutoff`
in this step: https://reactnative.dev/contributing/release-branch-cut-and-rc0#12-bump-minor-version-of-all-monorepo-packages-in-main
The reason for this change is to consolidate all the places where we update the version to one place, set-version.
Currently we do this in many fragmented places
* bump-all-updated-packages
* set-rn-version
* get-and-update-packages (deleted in the prev diff)
In the future, I want to get rid of `skip-react-native-version` but we'll need to remove the `1000.0.0` nomenclature. This unblocks us to just use this script for now.
bypass-github-export-checks
Reviewed By: huntie
Differential Revision: D53648688
fbshipit-source-id: 4f76366f8d340ec5aeaba1d3a26eba8b18a0166c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42903
Changelog: [Internal] - Update publish-npm to use `set-version` for nightly builds
Now that `set-version` basically does what `set-rn-version` does, this diff uses this logic for nightlies only (as dry-run/pre-alpha variants are non-functional right now)
This does not change the flow of build-type `'release'` -- that will still use `set-rn-version` via CircleCI ([job](https://fburl.com/code/6xo3ijwg), [script](https://fburl.com/code/bo8np0tb)) We will eventually replace that too but that will be later.
This allows us to delete `get-and-update-packages.js` which was a helper written specifically for updating monorepo packages for nightlies.
The purpose of this is to eventually conform all version updates to use `set-version` in all types of releases (nightlies, stable)
bypass-github-export-checks
Reviewed By: cipolleschi
Differential Revision: D53487874
fbshipit-source-id: 734b528ef5bd095ac68f86701ae105daa30c7d68
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42964
We've seen npm publishes fail occasionally in CI as part of this script, most recently in S391653. This change adds a single retry, per package, during the execution of this script, in an attempt to reduce the chance of manual interventions after a broken pipeline.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D53607808
fbshipit-source-id: 526d9c33d51ec57702efba3c199bad313c1bf2d4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42944
Updates `find-and-publish-all-bumped-packages` to use the npm registry as the source of truth, similar to tools like Lerna (`lerna publish from-package`). **This enables safe reruns of the publish script**, and replaces the previous Git-diff-detection implementation.
Changelog: [Internal]
Reviewed By: lunaleaps
Differential Revision: D53607807
fbshipit-source-id: 135808b7ce36cf463c9f53a8059500b83f8b6679
Summary:
This adds `react-native/metro-config` to the monorepo build tool and emits the missing typescript declarations.
Right now, we do have typescript declarations on `metro-config`, but not `react-native/metro-config`. Which makes everything a bit harder extend from "[the default React Native metro config](https://github.com/facebook/react-native/pull/36502)" in Expo.
> Note, I also added the same `exports` block from `react-native/dev-middleware` for conformity.
One open question here is, why aren't we exporting _all_ helper functions from `metro-config`? To me, its a bit weird that we need both `metro-config` _and_ `react-native/metro-config` as `loadConfig` isn't exported.
## Changelog:
[INTERNAL] [FIXED] - Emit typescript declaration files for `react-native/metro-config`
Pull Request resolved: https://github.com/facebook/react-native/pull/41836
Test Plan:
Run the build tool, and check if the typescript declarations are emitted for `react-native/metro-config`.
```
yarn build metro-config
```
Reviewed By: hoxyq
Differential Revision: D51943453
Pulled By: huntie
fbshipit-source-id: cfaffe5660053fc9a9fcbe3dacf7f6ccc2bde01b