Граф коммитов

358 Коммитов

Автор SHA1 Сообщение Дата
Saad Najmi 7208cd6384 Switch to xcbeautify (#36131)
Summary:
`xcpretty` is no longer maintained. Let's switch to `xcbeautify`, which is faster and is maintained. I'm also biased because `xcpretty` hid an error from me that `xcbeautify` did not.

## Changelog

[INTERNAL] [CHANGED] - Move CI from `xcpretty` to `xcbeautify`

Pull Request resolved: https://github.com/facebook/react-native/pull/36131

Test Plan:
Locally yarn `yarn test-ios` and got output that looks like this:

<img width="1245" alt="Screenshot 2023-02-11 at 9 34 07 PM" src="https://user-images.githubusercontent.com/6722175/218291538-07760f94-7e52-4919-b603-8a35a623fc9a.png">

I also confirmed a junit report that looks like this was generated:
```xml
<testsuites name="Selected tests" tests="193" failures="0">
    <testsuite name="RCTLoggingTests" tests="1" failures="0">
        <testcase classname="RCTLoggingTests" name="testLogging" time="0.175" />
    </testsuite>
    <testsuite name="RCTUIManagerScenarioTests" tests="3" failures="0">
        <testcase classname="RCTUIManagerScenarioTests" name="testManagingChildrenToAddRemoveAndMove" time="0.001" />
        <testcase classname="RCTUIManagerScenarioTests" name="testManagingChildrenToAddViews" time="0.000" />
        <testcase classname="RCTUIManagerScenarioTests" name="testManagingChildrenToRemoveViews" time="0.001" />
    </testsuite>
    ...
```

Reviewed By: cortinico

Differential Revision: D43232774

Pulled By: cipolleschi

fbshipit-source-id: fda4e217d4df55b5088026d6911d3dc6c8c9e824
2023-02-15 04:20:20 -08:00
Ruslan Lesiutin 28d8f25c76 fix: update executor for packages publishing workflow (#36146)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36146

Changelog: [Internal]

- While working on 0.71.3, it was discovered that `react-native-codegen` package is being published almost empty (without `lib` folder)
- The reason for it is that `prepare` script is not being executed
- The main reason for it is npm v6, which requires adding `unsafe-perm` flag for it: https://www.vinayraghu.com/blog/npm-unsafe-perm
- Instead of using this flag, changing executor to `nodelts`, which has node v18 and npm v8
- Also adding `run_yarn` before running the script, because `react-native/codegen` uses external dependencies (such as rimraf) for its build scripts

Reviewed By: cipolleschi

Differential Revision: D43248175

fbshipit-source-id: d12b93decbf408713e309fe8be75d8d5ec994868
2023-02-14 07:06:53 -08:00
Nicola Corti 9eaf6f5bdb Move test-docker-android from GH Actions to CircleCI (#36093)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36093

The Test Docker Android job is flaky as sometimes fetching artifacts from remote
returns different hashes.
I'm moving the job to CircleCI (so it's faster) + I'm using the `buck_fetch.sh`
script we already have which has a retry logic.

Changelog:
[Internal] [Changed] - Move test-docker-android from GH Actions to CircleCI

Reviewed By: javache

Differential Revision: D43121477

fbshipit-source-id: 1df114fd3ad9445a4a5dc7834bf811c3476322cd
2023-02-08 12:51:09 -08:00
Nicola Corti 2607602b8a Reduce flakyness by not downloading extra packages (#36077)
Summary:
Yesterday CircleCI was extremely flaky due to us trying to `apt install` extra packages. This mitigates one scenario where we try to redownload `jq` and `shellcheck`.

I've moved to use a container which contains those packages already

## Changelog

[INTERNAL] - Reduce flakyness by not downloading extra packages

Pull Request resolved: https://github.com/facebook/react-native/pull/36077

Test Plan: Will wait for a green CI

Reviewed By: cipolleschi

Differential Revision: D43080349

Pulled By: cortinico

fbshipit-source-id: 6527c5ad129f47d8b5f02bf207e1af67a095afa1
2023-02-07 07:22:30 -08:00
Nicola Corti 9e4b4ef2d5 Remove the `react-native-bot` context from CircleCI
Summary:
While working on T143721371 I've noticed that we still have an exposed context
for `react-native-bot` which gives access to `PAT_TOKEN` and `PAT_USERNAME`.
As those two variables are unused, we can fully clean this us.

Changelog:
[Internal] [Changed] - Remove the `react-native-bot` context from CircleCI

Reviewed By: cipolleschi

Differential Revision: D42886196

fbshipit-source-id: 4eba7a53557fe7af7d87650052630eea2d2d3934
2023-01-31 08:00:08 -08:00
Riccardo Cipolleschi 8056cd7f05 Add Tests in CircleCI to check dynamic frameworks with the old arch (#36003)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36003

This diff adds 4 tests in CircleCI to make sure we don't regress in the support of Dynamic Frameworks for the old architecture.

## Changelog
[iOS][Fixed] - Add CircleCI tests for dynamic frameworks with the Old Architecture.

Reviewed By: cortinico

Differential Revision: D42829895

fbshipit-source-id: 5669be45d4f55161a11a6ece161b2a2aa384a644
2023-01-30 04:25:26 -08:00
Nicola Corti d30bd1bb21 Migrate nightly from scheduled workflow to scheduled pipeline (#35977)
Summary:
I'm moving nightlies from scheduled workflow to scheduled pipeline.
We're not able to manually retrigger nightlies as they're a scheduled workflow and don't expose a parameter. Here I'm cleaning it up.

Plus I'm:
1. Removing the `main_only` reference which is unused
2. Setting up the `run_release_workflow` and `run_nightly_workflow` parameters.

## Changelog

[INTERNAL] - Migrate nightly from scheduled workflow to scheduled pipeline

Pull Request resolved: https://github.com/facebook/react-native/pull/35977

Test Plan: Will wait for CI results.

Reviewed By: cipolleschi

Differential Revision: D42776969

Pulled By: cortinico

fbshipit-source-id: d4ef9654d23cb91f85ce2b38e75e27dc0c575e95
2023-01-27 01:33:21 -08:00
Nicola Corti 477f546d1b Bump CMake to 3.22.1 to properly honor CMAKE_BUILD_TYPE (#35857)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35857

It seems like there is an incompatibility between NDK 23 (shipped in 0.71)
and the usage of custom `CMAKE_BUILD_TYPE` we do for Hermes.

Specifically the `-DCMAKE_BUILD_TYPE=Release` we specify for the debug
variant of Hermes is partially ignored by the new Android native build toolchain.
See https://github.com/android/ndk/issues/463 for mentions on how the
toolchains requires CMake 3.20+

As AGP 7.3 defaults to use CMake 3.18 unless specified, and NDK 23 unless specified.
AGP 7.4 defaults to use CMake 3.22 unless specified, and NDK 23 unless specified.
See: https://developer.android.com/studio/releases/gradle-plugin#7-4-0

Here I'm:
1. Bumping the docker image to an image that contains the CMake 3.22
2. Updating the logic for building `react-native` & `hermes-engine` to use 3.22
3. Provide fallbacks if the user specified `CMAKE_VERSION`

Template tests will run on AGP 7.3 and will still use CMake 3.18, but I forecast
no problem there as the user is not supposed to specify custom `CMAKE_BUILD_TYPE`.
This is only a problem as we build `hermes-engine` with custom build types.

Changelog:
[Android] [Fixed] - Bump CMake to 3.22.1 to properly honor CMAKE_BUILD_TYPE

Reviewed By: cipolleschi

Differential Revision: D42544864

fbshipit-source-id: efd0f51120370fb808337c201df31d71f4ddfdbc
2023-01-18 09:49:27 -08:00
Riccardo Cipolleschi 4c5fa6e372 fix: use properly exclude parameter of matrix (#35794)
Summary:
Update the CircleCI configuration to use the proper `exclude` parameter of matrix rather then bootstrap a machine and then kill it.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
## Changelog
[Internal] - Use the `exclude` parameter of matrices to avoid spinning up unnecessary machines

Pull Request resolved: https://github.com/facebook/react-native/pull/35794

Test Plan: The number of jobs on CircleCI should decrease.

Reviewed By: dmytrorykun

Differential Revision: D42475445

Pulled By: cipolleschi

fbshipit-source-id: 3d733ac459a3bc9747440a62cb2caecb7a235fec
2023-01-12 07:36:45 -08:00
Nicola Corti 573734f4e6 Remove PAT_TOKEN and PAT_USERNAME from CircleCI (#35808)
Summary:
This is a cleanup change needed after the CircleCI security incident.
We should be using the `Authorization: Bearer` header to trigger `rn-diff-purge` instead of using username & password authentication.

Source: https://docs.github.com/rest/reference/repos#create-a-repository-dispatch-event

## Changelog

[INTERNAL] - Remove PAT_TOKEN and PAT_USERNAME from CircleCI

Pull Request resolved: https://github.com/facebook/react-native/pull/35808

Test Plan:
I've tested this locally with:

```
curl -X POST https://api.github.com/repos/react-native-community/rn-diff-purge/dispatches \
                    -H "Accept: application/vnd.github.v3+json" \
                    -H "Authorization: Bearer [...]" \
                    -d "{\"event_type\": \"publish\", \"client_payload\": { \"version\": \"test.test.test\" }}"
```

and the run was succesfully fired by react-native-bot:
https://github.com/react-native-community/rn-diff-purge/actions/runs/3894079133

Reviewed By: lunaleaps

Differential Revision: D42456065

Pulled By: cortinico

fbshipit-source-id: 475e9ca80760522cc08bad37d85c5af6727922d3
2023-01-11 10:58:25 -08:00
Ruslan Lesiutin ec28c5bbaa feat(react-native-github): a script to automate patch version bumping of packages (#35767)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
2023-01-10 13:23:06 -08:00
Nicola Corti 97e844fad0 Update fingerprint for SSH deploy key (#35791)
Summary:
Rotating a private SSH key we had left to rotate.

## Changelog

[INTERNAL] - Update fingerprint for SSH deploy key

Pull Request resolved: https://github.com/facebook/react-native/pull/35791

Test Plan: n/a

Reviewed By: cipolleschi

Differential Revision: D42413025

Pulled By: cortinico

fbshipit-source-id: 571f304e8cc2dad19c41e5413ed3c7d4c078ba60
2023-01-09 04:34:41 -08:00
Nicola Corti 44cb07b40a Remove unused .netrc file from CircleCI (#35785)
Summary:
Removing a stale configuration that was configuring username/password before publishing to NPM. This is effectively unused + the Github Token there is invalid therefore can be removed.

## Changelog

[INTERNAL] - Remove unused .netrc file from CircleCI

Pull Request resolved: https://github.com/facebook/react-native/pull/35785

Test Plan: n/a

Reviewed By: cipolleschi

Differential Revision: D42385163

Pulled By: cortinico

fbshipit-source-id: 0dbbf44459d59f792da4221d6100800a2f4efda2
2023-01-06 07:19:02 -08:00
Riccardo Cipolleschi cb9eaa6db0 Refactor hermes logic to make it branch agnostic (#35709)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35709

This change refactors the logic to choose which version of hermes we have to pick

## Changelog:
[iOS][Changed] - Refactor hermes choosing logic

Reviewed By: cortinico, dmytrorykun

Differential Revision: D42211405

fbshipit-source-id: d19c0f2c523c5596d18a1f904e3b26d96ea1a77a
2023-01-05 06:58:38 -08:00
Ruslan Lesiutin 7f29357c7c refactor(scripts): use forEachPackage instead of `yarn workspaces info` (#35633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35633

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: 2c62c1a5eb41d711c563f9f7b0de3d67fc11823d
2022-12-14 03:04:06 -08:00
Ruslan Lesiutin 83afdafae4 feat(react-native-github): automate publishing bumped packages via circleci (#35621)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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: c5d0ed5b852b744a699ecb88861ea3e82200e1f3
2022-12-14 02:17:16 -08:00
Dmitry Rykun 65e0f79f69 Backport fix: update CircleCI config to use the RN version in Hermes workspace caching (#35617)
Summary:
This is a backport of 0edcbc30c8. It fixes inconsistencies in caching strategies of Hermes tarball and Hermes workspace on CircleCI.

## Changelog

[INTERNAL] [FIXED] - Update CircleCI config to use the RN version in Hermes workspace caching.

Pull Request resolved: https://github.com/facebook/react-native/pull/35617

Test Plan:
1. Create and push a new branch.
2. Change version in. react-native/package.json
3. Push those changes.

Before:
CircleCI restores cached Hermes workspace for the old version.

After:
CircleCI creates new workspace for the new version.

Reviewed By: cipolleschi

Differential Revision: D41970943

Pulled By: dmytrorykun

fbshipit-source-id: 7e343b7a8d4b1c5a63016ec53538abe4ad7808cc
2022-12-13 04:19:43 -08:00
Blake Friedman d9666962f7 Fix test_windows by caching choco deps (#35399)
Summary:
A flakey CDN is 404'ing the Java dep.  Caching the Choco dependencies should stop this.

## Changelog

[Internal] [Fixed] - Cache Choco dependencies to stop erratic 404s on Java 8 install.

Pull Request resolved: https://github.com/facebook/react-native/pull/35399

Test Plan: Bump the PR to see if it's caching.

Reviewed By: huntie

Differential Revision: D41684462

Pulled By: blakef

fbshipit-source-id: f3eac9e8a00be33f7c3f0996f35abb63146cb3c4
2022-12-02 07:32:30 -08:00
Riccardo Cipolleschi 4e8526c829 Add CircleCI tests for use frameworks (#35497)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35497

In 0.71.0-RC.2, we had a regression in `use_frameworks!`.

This adds some CircleCI jobs to make sure we do not regress on those. It also updates the template to support these tests.

## Changelog
[iOS][Added] - CircleCI jobs to keep the use_framework! setup in check for the Old Arch

Reviewed By: cortinico

Differential Revision: D41551288

fbshipit-source-id: 531fabb1a7b6aceab2926bb83cf2887129df1776
2022-11-29 08:53:50 -08:00
LeoTM f75b92a12b Bump node version from 16 to 18 (#35443)
Summary:
Node 18: https://nodejs.org/de/blog/announcements/v18-release-announce/

Node 16 EOL: 2023-09-11
https://nodejs.org/en/blog/announcements/nodejs16-eol/

Node 18 EOL: 2025-04-30

Follow-up
- https://github.com/facebook/react-native/pull/34171
- https://github.com/facebook/react-native/pull/32980

Ref
- https://github.com/react-native-community/docker-android/pull/187

cc ramonmedel cortinico gengjiawen

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[JavaScript] [Changed] - Bump node version from 16 to 18

Pull Request resolved: https://github.com/facebook/react-native/pull/35443

Test Plan: Everything builds and runs as expected

Reviewed By: cipolleschi

Differential Revision: D41531161

Pulled By: cortinico

fbshipit-source-id: 305888f55ed179f75bef34548aebf22fc2951308
2022-11-25 06:44:21 -08:00
Riccardo Cipolleschi 319631f003 fix: update CircleCI config to use the RN version in tarball caching (#35471)
Summary:
This PR updates the Cache strategy for the tarballs to include the React Native version we are building. In this way, when we publish a new Release/RC we are sure that we are going to rebuild a nmew
tarball. This should fix caching problems like:

- we have misconfigured the build script for the Hermes tarball, we then fix it, but we distribute the wrong cached artifacts
- the cached artifact has the wrong version

## Changelog

[Internal] - Fixed Hermes Tarball Cache Logic

Pull Request resolved: https://github.com/facebook/react-native/pull/35471

Test Plan:
1. CircleCI
The real way to check this is in the next RC cycle or in the next nightly.

Reviewed By: cortinico

Differential Revision: D41530651

Pulled By: cipolleschi

fbshipit-source-id: 45e8fd3b62c8e108d393d9463ff6762dfc6d3ec8
2022-11-25 05:14:42 -08:00
Ruslan Lesiutin 6a45f2ce79 refactor(circleci/template): publish all packages to Verdaccio before template initialization (#35459)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35459

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

Reviewed By: cipolleschi

Differential Revision: D41521496

fbshipit-source-id: 6183ab02c697d9d08e9dca5b323bd7a11a749c3a
2022-11-24 13:56:09 -08:00
Nicola Corti 50c6ee40ea Build RNTester Release inside buildAll (#35464)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35464

This extends the buildAll task to build both RNTester Debug and Release
We can finally do this now as debug and release are fully isolated
and don't clash on each other.

Changelog:
[Internal] [Changed] - Build RNTester Release inside buildAll

Reviewed By: cipolleschi

Differential Revision: D41521995

fbshipit-source-id: 37ec5e3b55080372f01f2736c1bb020b3776b193
2022-11-24 11:22:54 -08:00
Nicola Corti 09843a0094 Store RN Tester and Template APKs for Android on CI (#35463)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35463

This will allow us to easily retrieve debug/release APK for
both RN-Tester and the Template jobs for every run of the CI.

Changelog:
[Internal] [Changed] - Store RN Tester and Template APKs for Android on CI

Reviewed By: cipolleschi

Differential Revision: D41521977

fbshipit-source-id: e2ed60921fd005425d3915323b18dde2851e7fc2
2022-11-24 10:21:57 -08:00
Nicola Corti 0c6a4f8c59 Remove AVD code from Android CI
Summary:
We don't really run AVD (Emulators on CI) so those steps
are entirely unnecessary and skipped every time. I'm removing them.

Changelog:
[Internal] [Changed] - Remove AVD code from Android CI

Reviewed By: cipolleschi

Differential Revision: D41521976

fbshipit-source-id: 2737ef0dfc84198ab9b837819c16ae46280ba43f
2022-11-24 10:21:57 -08:00
Ruslan Lesiutin e11cfe98e9 feat(react-native/template): use verdaccio to publish local packages before testing template app (#35444)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
2022-11-23 13:20:00 -08:00
Riccardo Cipolleschi f12b12c999 Improve version checks to avoid mistakes in the versioning (#35296)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Reviewed By: cortinico

Differential Revision: D41161756

fbshipit-source-id: 4172195c5e031c1eaf7b33bb74f381c04e9adaf5
2022-11-21 10:52:17 -08:00
Riccardo Cipolleschi e36c492ace Remove version from the tarball (#35285)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35285

While doing the release 0f 0.71.0-RC0, we noticed that having the RN version in the hermes tarball was causing more harm than good.

With the version in the name, we ended up with multiple tarballs for debug and release and we were not able to explicitly pick the right tarball given a build.

This change remove the version from the tarball name.

## Changelog
[General][Changed] - Remove React Native version from Hermes tarball name

Reviewed By: lunaleaps

Differential Revision: D41156353

fbshipit-source-id: 8899d5e1e1555bc728d923f3b78d1261e6ff09c7
2022-11-14 08:31:30 -08:00
Oleksandr Melnykov 394486eec5 Bump OSS Android build to SDK 33 (#35196)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35196

Changelog:
[Android][Changed] - Bump Android compile and target SDK to 33

Reviewed By: cortinico

Differential Revision: D41007003

fbshipit-source-id: e7866107fdcfafa778faa6c7f31835b8dd15647a
2022-11-08 19:12:02 -08:00
Lorenzo Sciandra cfa25e0a4a fix(release scripts): backport fixes from 0.71 into main (#35258)
Summary:
This PR backport two fixes we did in 0.71 to unblock the release process:
* the change in `publish-npm` is needed because of the introduction of .strict() from 4f3ca8facf
* the removal of the other script (added originally here e4b5d3eec9) is because:
  1) that step is not needed anymore (we don't publish/upload hermes artifacts to the GH release)
  2) by the time this job gets run the release crew has already setup the GH release
  3) the logic for the versioning was broken and even on the 0.71-rc pipeline it was tagging stuff as 1000.0.0

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Fixed] - Fix release scripts for "release" pipeline scenario

Pull Request resolved: https://github.com/facebook/react-native/pull/35258

Test Plan: The fact that 0.71-rc0 was released is the  for this.

Reviewed By: jacdebug

Differential Revision: D41120888

Pulled By: cipolleschi

fbshipit-source-id: 06d108f0659ad1db53c6324fe1d735f52c34a3c5
2022-11-08 10:03:29 -08:00
Riccardo Cipolleschi ddba780c0c fix: Change checkout cache strategy (#35259)
Summary:
This PR updates he cache strategy for the `checkout_with_cache command`.

The previous strategy was using three keys in descending priority order to restore from the cache:
* `<< parameters.checkout_base_cache_key >>-{{ arch }}-{{ .Branch }}-{{ .Revision }}`
* `<< parameters.checkout_base_cache_key >>-{{ arch }}-{{ .Branch }}`
*`<< parameters.checkout_base_cache_key >>-{{ arch }}`

When it saves, it always saves using the first key.

The restore works as it follows:
1. It tries to restore the cache using the first key
2. If it fails, it checks whether there is a cache hit for a key that matches the second key as a pattern
3. If it fails, it checks whether there is a cache hit for a key that matches the third pattern
4. Otherwise, it is a cache miss.

This does not work well. Imagine that you submit some code in commit `xxxx` for branch `abc`.
The CI run the first time, it misses all the three keys and checks out the code normally.
Then, it stores the checked out code in the `checkout_key-abc-xxxx` key.

Then, you submit a commit `yyyy` in the same branch.
The CI starts, it tries with the key `checkout_key-abc-yyyy` but it misses
It tries with the key `checkout_key-abc` and it finds the cache for `checkout_key-abc-xxxx` and it restores it, forgetting about your changes.

While doing the release, we created a tag in a commit X. Then we manually had to remove it, but the CI had a cached version of .git with the tag for
the `0.71-stable` branch. And the release failed because the tag was already existing.

### Why this should work

With this solution, we are going to cache using the commit. If there is no cache for a specific commit, it will be a miss. It won't try to be smart and
retrieve the code from previous caches.

This should prevent stale caches and if we manually remove a tag, and then we do a new commit, it should work.

This is a good trade-off that allows to pay the checkout cost only for the first batch of jobs of the pipeline.

**NOTE:** This still won't work if we don't do a new commit.

## Changelog

[General] [Fixed] - Change Cache strategy to avoid cache bumps in Release

Pull Request resolved: https://github.com/facebook/react-native/pull/35259

Test Plan: 1. CircleCI must be green

Reviewed By: jacdebug

Differential Revision: D41120895

Pulled By: cipolleschi

fbshipit-source-id: 2b45da01803197dbe4a25a313a9dfc53a976d096
2022-11-08 06:50:25 -08:00
Nicola Corti 6a43fafd78 Cleanup the template documentation after RNGP & hermesEnabled to gradle.properties (#35108)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35108

I've rewritten the comment in the android/app/build.gradle.
They were really old, contained wrong links and most of the people ignored it.

I've also moved the enabling of Hermes to the `gradle.properties` file.
RNGP still supports the old method, but we must be sure that we notify
library authors if they were reading project.ext.react.enableHermes in the past
(also the website needs to be updated).

I've also cleaned up the CircleCI setup as now we can specify Hermes enabled/disabled
via the CLI (this will also make easier to do e2e testing).

Changelog:
[Android] [Changed] - Cleanup the template documentation after RNGP & hermesEnabled to gradle.properties

Reviewed By: cipolleschi

Differential Revision: D40762872

fbshipit-source-id: 2c09245e0a923faac53cc6c8a89e99788ae47f8a
2022-10-27 14:40:27 -07:00
Nicola Corti 8b8a5e06ce Bump the Android Docker image to 6.0 (for NDK 23) (#35079)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35079

This bumps the Docker image for React Native Android to 6.0
shipping the NDK 23 with it, finalizing all the work needed
to support NDK 23.

Changelog:
[Internal] [Changed] - Bump the Android Docker image to 6.0 (for NDK 23)

Reviewed By: cipolleschi

Differential Revision: D40675449

fbshipit-source-id: 5fb53080ce796263cd592dbc489743e6295060ba
2022-10-25 13:20:03 -07:00
Nicola Corti c96c76eb91 Update the template to use RNGP (#35075)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35075

This diff updates the New App template for Android to use the React Native Gradle Plugin.
With this we can:
1. Get rid of all the C++ code.
2. Remove a lot of New Architecture logic in the build.gradle
3. Reuse the prebuilts of React Native/Hermes via prefab

Changelog:
[Android] [Changed] - Update the template to use RNGP

Reviewed By: cipolleschi

Differential Revision: D40673732

fbshipit-source-id: 70935248993d1e24904c982e75f12ad580faa9d8
2022-10-25 13:13:14 -07:00
Héctor Ramos e4b5d3eec9 Circle CI: Upload both tarballs to releases, dry-run the release workflow on every commit (#35015)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35015

React Native releases are cut every few months. Without testing, the workflow is prone to breakage.

Dry-run the release workflow on every commit in order to surface any issues as they are introduced instead of at release time.

Fixed issues that surfaced during testing of this workflow:
- Upload both Hermes tarballs

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D40483764

fbshipit-source-id: 5ca6bd4dcdfd64c24882ffb202edbfd701efd462
2022-10-19 17:54:22 -07:00
Nicola Corti b0f7b0c66b Publish both Hermes Debug and Release inside `react-native-artifacts`
Summary:
I'm extending `react-native-artifacts` to expose both
Hermes Debug and Release for iOS.

Changelog:
[Internal] [Changed] - Publish both Hermes Debug and Release inside `react-native-artifacts`

Reviewed By: mdvacca

Differential Revision: D40512210

fbshipit-source-id: 9676c95eaab45365c9c264585c491cd1bde04db5
2022-10-19 09:53:49 -07:00
Héctor Ramos d2fde62f8f Circle CI: Build Release and Debug tarballs for every commit (#35013)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35013

Previously, release builds were only built for stable RN releases. This creates a discrepancy between CI jobs that run on commits versus CI jobs that run on releases. We are working on reducing these differences in order to limit the number of issues we may face when cutting a React Native release.

Now, build_hermes_macos will be run as a matrix of Debug/Release builds in every workflow.

Updated build_hermes_macos to take 'flavor' as a Enum, not a string.

Store hermesc in separate directories as Circle CI does not allow two different jobs (e.g. build_hermes_macosDebug and build_hermes_macosRelease) to write to the same path when storing artifacts.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D40308952

fbshipit-source-id: b96b9a6c7cf8d0becafcf2fdcb761540816ae336
2022-10-18 14:25:38 -07:00
Nicola Corti 5d8a712fd5 Configure CircleCI to publish artifacts to Maven Central (#34983)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34983

This sets up our CircleCI logic to publish artifacts to Maven Central.
I will check if tomorrow's nightly successfully landed on Maven Central
Snapshot repository.

I've added a --dry-run to the the close and release step of the publishing
to avoid accidentally publishing to Maven Central. We'll remove this if
we decide to go with the Maven Central publishing.

Changelog:
[Internal] [Changed] - Configure CircleCI to publish artifacts to Maven Central

Reviewed By: jacdebug, huntie

Differential Revision: D40377691

fbshipit-source-id: 36a74074ea95097bb7268352e40f4d2670f3cd65
2022-10-14 07:30:29 -07:00
Héctor Ramos 7f1729a94f Circle CI: Replace string parameters with enums where applicable (#34962)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34962

For jobs that take a string parameter, where that string parameter is expected to be one of a set of accepted values, use an enum instead.

If an unexpected value is passed to a enum parameter, then `circleci config validate` will flag the issue.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D40310118

fbshipit-source-id: b8416c415705ff6eba80cc5f0d9bfe670569f732
2022-10-13 13:03:45 -07:00
Héctor Ramos 2f5adbb192 Circle CI: Fix release workflow (#34960)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34960

Due to a missing cmake dependency, the prepare_package_for_release job will fail.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D40310829

fbshipit-source-id: b8d33397f012a9366bb44634877e6033b4d01caf
2022-10-12 16:19:28 -07:00
Héctor Ramos 8950837e7d Circle CI: Test both Hermes and JSC on iOS (#34963)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34963

Run iOS tests with JSC and Hermes.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D40310674

fbshipit-source-id: 0ccb45b2334b6c8993f897c60e72572972791290
2022-10-12 15:23:55 -07:00
Héctor Ramos 51f2027922 Circle CI: Reduce build_hermes_macos Hermes SDK cache size by 75% (#34886)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34886

## Reduced cache size

The `build_hermes_macos` job can spend over 20 minutes restoring cached build artifacts (over 5 GB), when only `build_macosx` and `destroot` are required to be cached: `build_macosx` as it may contain a pre-built `hermesc` from previous builds, and `destroot` which contains the artifacts for previous iOS/macOS builds.

This is the `build_hermes_macos` Restore Cache step, before the changes in this diff:

```
Found a cache from build 308044 at v1-hermes-build_hermes_macos-debug-PEiMHp9XQ13KtYFQMKoT27DmHkkoxOi_PJUyW7PacZE=
Size: 5.2 GiB
Cached paths:
  * /Users/distiller/react-native/sdks/hermes/build_host_hermesc
  * /Users/distiller/react-native/sdks/hermes/build_iphoneos
  * /Users/distiller/react-native/sdks/hermes/build_catalyst
  * /Users/distiller/react-native/sdks/hermes/build_iphonesimulator
  * /Users/distiller/react-native/sdks/hermes/build_macosx
  * /Users/distiller/react-native/sdks/hermes/destroot

Downloading cache archive...
Unarchiving cache...
```

Size: 5.2 GiB
Time to restore cache: 183s

This is the `build_hermes_macos` Restore Cache step, after the changes in this diff:

```
Found a cache from build 310128 at v2-hermes-build_hermes_macos-debug-e7WmoA0+mfveXq1zsMYpgR6BYqVuuDjmVeLLyjqPJWk=
Size: 1.3 GiB
Cached paths:
  * /Users/distiller/react-native/sdks/hermes/build_macosx
  * /Users/distiller/react-native/sdks/hermes/destroot

Downloading cache archive...
Unarchiving cache...
```

Size: 1.3 GiB
Time to restore cache: 42s

**This is a size reduction of 75%, and execution time reduction of 77%.**

This savings will apply to every workflow that runs afterwards until the Hermes cache is invalidated due to a new commit landing in `facebook/hermes`.

## Added `export_hermesc`

As part of the work mentioned above, a reusable `export_hermesc` command was added, which will export hermesc for use in downstream steps. Either of the macOS or iOS build scripts will generate this binary. As we now only cache the macOS build dir, that version is loaded from cache by default if available:
- If the cache contains hermesc, both the macOS and iOS builds will use it.
- If the cache does not contain hermesc, then the iOS job will use the hermesc that was built by the macOS job previously.
- The `export_hermesc` command will work regardless of the order of the Hermes build scripts

## Refactoring of magic strings into reusable yaml references

Some additional changes to the Circle CI config were done in order to reduce repetition of artifacts/cache paths that are re-used across workflows.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D40153737

fbshipit-source-id: b9f07302ccc9bac1ce72a09b944d3210e6db2ec1
2022-10-12 09:55:31 -07:00
Héctor Ramos 21c8837c12 Bump Circle CI macOS container to Xcode 14.0.1, Ruby to 2.7.6, CocoaPods 1.11.3 (#34884)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34884

Xcode 14 is now stable. Updating CI to use latest Xcode command line tools.

The Circle CI 14.0.1 container ships with Ruby 2.7.6 and CocoaPods 1.11.3, see full manifest here: https://circle-macos-docs.s3.amazonaws.com/image-manifest/v8824/index.html

Changelog: [iOS][Changed] Bump to Ruby 2.7.6 and CocoaPods 1.11.3

Reviewed By: mdvacca

Differential Revision: D40148796

fbshipit-source-id: b1eab68e159ec3237ff2ef596163b73fc1e511e4
2022-10-11 18:27:25 -07:00
Héctor Ramos 31bedd9815 Add hermes/create-tarball.js script (#34875)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34875

Create common script for generating a Hermes tarball after Hermes is built from source.

Use after building Hermes from source to create a tarball of the resulting build artifacts. The path to the tarball can be passed to CocoaPods via a `HERMES_ENGINE_TARBALL_PATH` envvar in order to use these pre-built Hermes artifacts when installing the `hermes-engine` pod with `pod install`.

Use in Circle CI when creating a Hermes tarball for caching and for use in stable React Native releases.

Usage:

```
pod install

# When Hermes is built from source via CocoaPods, the build artifacts will be located in the Pods directory for hermes-engine

node ./scripts/hermes/create-tarball.js \
  --inputDir ./sdks/hermes \
  --buildType Debug \
  --releaseVersion 1000.0.0 \
  --outputDir .
```

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D40124378

fbshipit-source-id: f9712e87526ccc737afac4599b0ab0a7bb3f3956
2022-10-07 10:21:25 -07:00
Héctor Ramos af4e061523 Circle CI: do not share .git cache across different operating systems (#34885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34885

We use workflows extensively in Circle CI, so caching a git checkout should help speed up tests when downstream jobs need to checkout the repository. In the current configuration, the Windows job is most likely to run and write to the .git cache first, which results in permission issues when the .git cache is loaded onto macOS or linux hosts.

By splitting the cache by architecture, we may lose on some reusability across jobs with distinct architectures, but it ensures we avoid cross-platform permission issues.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D40150781

fbshipit-source-id: 4a4b2a4da5e20f754b72db0c9852c7c1616b610c
2022-10-07 10:21:25 -07:00
Ruslan Lesiutin 47d23374c2 feat(.circleci): support both architectures in rntester app (#34864)
Summary:
Added a new job to testing RNTester app on both architectures

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Added] - Support both architectures to test RNTester iOS app

Pull Request resolved: https://github.com/facebook/react-native/pull/34864

Test Plan: CircleCI jobs

Reviewed By: cortinico, cipolleschi

Differential Revision: D40062371

fbshipit-source-id: 1a28890edc57b64232d647d85694b34d50a9cd64
2022-10-04 10:15:30 -07:00
Riccardo Cipolleschi 8bb9717faa Back out "RN: Switch to `Choco-Install` from Windows Hermes CI" (#34818)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34818

Original commit changeset: 69c03845d2f2

I had to back this out because Choco-Install is not recognized by CircleCI and currently the OSS pipeline is broken.

This didn't happen in previous Jobs because Hermes has not changed and the build was skipped.
See [this job](https://app.circleci.com/pipelines/github/facebook/react-native/16088/workflows/d9e1c028-9422-4609-ba9f-6c35460efbb5/jobs/303255?invite=true#step-104-40) for example.

## Changelog
[General][Fixed] - Fix the Windows Pipeline

Reviewed By: cortinico

Differential Revision: D39928281

fbshipit-source-id: be641efe026a9d3f7cd75943e9b7a39ab1673e18
2022-09-29 07:22:39 -07:00
Tim Yung 1a28058ac3 RN: Switch to `Choco-Install` from Windows Hermes CI (#34811)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34811

Switches the Windows Hermes CI step to use `Choco-Install` which implicitly supports retries for more reliable builds.

See: https://github.com/actions/runner-images/pull/721

Changelog:
[Internal]

Reviewed By: rickhanlonii

Differential Revision: D39890407

fbshipit-source-id: 69c03845d2f2160fb39219dd4a5fff90a00de278
2022-09-28 10:57:07 -07:00
Tim Yung 833661452d RN: Make `retry3` Portable in CI Scripts
Summary:
Moves the `retry3` utility function into its own file so that it can be reused in other steps that are not related to Android.

Changelog:
[Internal]

Reviewed By: rickhanlonii, cipolleschi

Differential Revision: D39889996

fbshipit-source-id: bf79cc19ad6178af0a0d8117a81116e0c32f4333
2022-09-28 10:57:07 -07:00
Héctor Ramos ce4aa93173 Build separate tarballs for Hermes with and without debugger (#34704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34704

Create separate hermes-engine tarballs for release and debug builds, and only include the debugger in debug builds.
Changes the hermes-engine podspec to use a debug Hermes build by default in order to preserve the inclusion of the debugger.

Upcoming changes should split the hermes-engine Pod to allow Xcode to use release and debug builds as needed.

Changelog:
[iOS][Changed] - Use debug Hermes builds by default

Reviewed By: cipolleschi

Differential Revision: D39326467

fbshipit-source-id: 94c5fe7db80194d22fced6717c5efc7accd36d48
2022-09-22 13:41:51 -07:00