mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
239
Commits
main
..
0.74-stable
@@ -0,0 +1,172 @@
|
||||
# Circle CI
|
||||
|
||||
This directory is home to the Circle CI configuration files. Circle is our continuous integration service provider. You can see the overall status of React Native's builds at https://circleci.com/gh/facebook/react-native
|
||||
|
||||
You may also see an individual PR's build status by scrolling down to the Checks section in the PR.
|
||||
|
||||
## Purposes
|
||||
|
||||
We use CircleCI for mainly 3 purposes:
|
||||
|
||||
1. Testing changes
|
||||
2. Release Nightlies
|
||||
3. Release Stable Versions of React Native
|
||||
|
||||
When testing changes, we run all the tests on commits that lands on `main`. For commits in PR, we try to understand which kind of changes the PR is about and we try to selectively run only the relevant tests. so, for example, if a PR only touches iOS files, we are going to run only iOS tests.
|
||||
|
||||
A Nighly job runs every day at around 9:00 PM, GMT. They run from `main` and they publish a version of React Native using the current state of the codebase, creating a version number that follows the format: `0.<current-version+1>.0-nightly-<YYYYMMDD>-<short-commit-hash>`.
|
||||
The nightly job also publish all the monorepo packages, taking care of updating the transitive dependencies of those packages.
|
||||
|
||||
Stable versions are released manually by the Release Crew and they run from a stable branch. Stable branches have the shape of `0.<version>-stable`.
|
||||
|
||||
## How It Works?
|
||||
|
||||
CircleCI execution is now split in two steps:
|
||||
- Setup
|
||||
- Testing
|
||||
|
||||
The setup step takes care of analyzing the changes in the PR and of deciding which jobs needs to run.
|
||||
|
||||
The testing flow is a set of workflows that executes the required tests.
|
||||
|
||||
### Setup
|
||||
|
||||
The code of the setup workflow lives in the root [`config.yml`](https://github.com/facebook/react-native/blob/main/.circleci/config.yml) file.
|
||||
It uses the `Continuation orb` from CircleCI to start a CI flow that depends on the changes present in the PR.
|
||||
|
||||
If the changes are not coming from a PR (either a simple commit or if the CI is running on main) **we always run all the tests** as a cautionary measure.
|
||||
|
||||
The setup job has also to expose all the pipeline parameters that we would need to pass to the actual workflow. Those parameters are **automatically forwarded** to the workflows that are started as a result of the setup.
|
||||
|
||||
The setup job uses a JS script to carry on its logic. The [`pipeline_selection.js`](https://github.com/facebook/react-native/blob/main/scripts/circleci/pipeline_selection.js) script can be invoked with two commands:
|
||||
- `filter-jobs`
|
||||
- `create-configs`
|
||||
|
||||
The **`filter-jobs`** command takes care of creating a JSON representation of the tests we need to run based on the changes in the PR.
|
||||
|
||||
The **`create-configs`** command consumes the JSON representation to create a CircleCI configuration that can then executes all the required tests.
|
||||
|
||||
#### Creating a Configuration
|
||||
|
||||
To create a configuration, the `pipeline-selection` scripts collates together various pieces of `YML` files that lives in the [`Configurations` folder](https://github.com/facebook/react-native/tree/main/.circleci/configurations).
|
||||
|
||||
The order in which these files are appended is **important** and it always contains the following.:
|
||||
|
||||
1. `top_level.yml`: this file contains some high level directives for CircleCI, like the version, the list of orbs, the cache-keys, and the pipeline parameters that can be used by the workflows.
|
||||
2. `executors.yml`: this file contains the list of the executors used in our jobs and their configurations.
|
||||
3. `commands.yml`: this file contains all the commands that can be used by jobs to executes. Commands are reusable functions that are shared by multiple jobs.
|
||||
4. `jobs.yml`: this file contains the jobs that are used by workflows to carry on some specific tasks. They are composed of sequential commands.
|
||||
5. `workflows.yml`: this file contains the shared workflows that needs to (or can) be always executed, no matter which kind of changes are pushed to CI. An example of these workflows is `analysis` (which is always executed) or `nightly` (which can be executed if a specific pipeline parameter is passed to the CI).
|
||||
|
||||
Then, the `pipeline_selection create-configs` attach some specific test workflows, depending on the changes that are present in the PR. These change-dependent workflows live in the [`test_workflows`](https://github.com/facebook/react-native/tree/main/.circleci/configurations/test_workflows) folder.
|
||||
These workflows are:
|
||||
* `testAll.yml` => runs all the possible tests. This workflow is executed on main and on PRs which change set touches both iOS and Android
|
||||
* `testAndroid.yml` => runs all the build steps and Android tests. This is used on changes that happens on the Android codebase and infra (`ReactAndroid` folder)
|
||||
* `testIOS.yml` => runs all the build steps and iOS tests. This is used on changes that happens on the iOS codebase and infra (`React` folder)
|
||||
* `testE2E.yml` => runs the E2E tests. As of today, E2E tests can be triggered if the commit message contains the `#run-e2e-tests` tag.
|
||||
* `testJS.yml` => For all the changes that do not touch native/platform code, we only run JS tests.
|
||||
|
||||
Notice that if there are changes on files that do not represents code (for example `.md` files like this one or the `Changelog`) we don't run any CI.
|
||||
|
||||
## Test workflows
|
||||
|
||||
The test workflows for native code are composed of 2 parts:
|
||||
- building React Native
|
||||
- testing
|
||||
|
||||
Building React Native requires us to build several parts of it:
|
||||
1. We need to build the Hermes JS engine
|
||||
2. We need to build Android to create prebuilds
|
||||
3. We need to package everything in an npm package that will mimic a React native release
|
||||
4. We need to create a local maven repository
|
||||
|
||||
### Building Hermes Engine
|
||||
|
||||
#### Android
|
||||
The `build_android` workflows takes care of building the Android version of Hermes and to put it properly in a local maven repository.
|
||||
See the [Build Android](#build_android) section below.
|
||||
|
||||
#### iOS
|
||||
Hermes is a very complicated item to build for iOS.
|
||||
It is composed of the Hermes compiler (HermesC) and of the actual engine.
|
||||
|
||||
Hermes is shipped as a universal XCFramework. This means that we need to build all the architecture slices and then put them together in the XCFramework archive.
|
||||
We also need to build 2 configurations: Debug and Release.
|
||||
|
||||
In order to be efficient and to save costs, we parallelize the process as much as possible:
|
||||
|
||||
1. We prepare the environment for building Hermes.
|
||||
2. We build HermesC which is required by all the slices.
|
||||
3. We start 8 jobs to build all the required slices in parallel:
|
||||
1. `iphone` slice, Debug mode
|
||||
1. `iphonesimulator` slice, Debug mode
|
||||
1. `macos` slice, Debug mode
|
||||
1. `catalyst` slice, Debug mode
|
||||
1. `iphone` slice, Release mode
|
||||
1. `iphonesimulator` slice, Release mode
|
||||
1. `macos` slice, Release mode
|
||||
1. `catalyst` slice, Release mode
|
||||
4. We then have 2 jobs to create the Debug and Release tarballs in parallel.
|
||||
1. The Debug job receives the 4 Debug slices
|
||||
1. The Release job receives the 4 Release slices
|
||||
|
||||
The `Debug` and `Release` tarball are then uploaded as artifacts. Notice that these we use these artifacts to **test the release** of React Native.
|
||||
|
||||
While building Hermes, we take also care of building the dSYMs. A dSYM (Debug Symbols) is an archive that contains the Debug Symbols that users can load to de-symbolicate the Hermes Stack traces. These symbols are published when we create a React Native release.
|
||||
|
||||
A lot of these build steps are automated by some shell scripts that lives in the [`react-native/packages/react-native/sdks/hermes-engine/utils` folder](https://github.com/facebook/react-native/tree/main/packages/react-native/sdks/hermes-engine/utils).
|
||||
|
||||
### Build Android
|
||||
|
||||
The android build is all managed by Gradle, so building android should be as easy as calling a [`gradle` command](https://github.com/facebook/react-native/blob/main/.circleci/configurations/jobs.yml#L268-L274).
|
||||
|
||||
The relevant part here is that the build android generates a `maven-local` repository that is passed to the [`build_npm_package`](https://github.com/facebook/react-native/blob/main/.circleci/configurations/jobs.yml#L1182) and that we use to test the releases.
|
||||
|
||||
### Build NPM package
|
||||
|
||||
This job is the responsible to create an NPM package that is suitable to be released or tested in CI.
|
||||
If we are in a release flow (for example the Nightly workflow), it also proceed with the publication.
|
||||
|
||||
The job can be invoked with different parameters:
|
||||
- `dry-run` => it does not publish anything, but prepare the artifacts to be used for testing
|
||||
- `nightly` => it creates the artifacts and publish a nightly version of React Native.
|
||||
- `release` => it creates the artifacts and publish a stable version of React Native.
|
||||
|
||||
The build NPM package takes all the artifacts produced in the previous steps (iOS' Hermes, iOS' Hermes dSYMs, Android's `maven-local`) and creates an npm package packing all the code.
|
||||
|
||||
If in a release mode, it also proceed publishing the NPM package to NPM, and the artifacts to Maven central, which we use to distribute all the artifacts.
|
||||
|
||||
This job also uploads the `maven-local` repository and a zipped version of the npm package to CircleCI's artifacts. We use these artifacts to **test the release** of React Native.
|
||||
|
||||
## Testing React Native
|
||||
React Native tests runs in two different scenarios:
|
||||
- RNTester
|
||||
- A New App
|
||||
|
||||
### RNTester
|
||||
RNTester is our internal testing app. It is a fully working React Native app that lives in the [`react-native/packages/rn-tester` folder](https://github.com/facebook/react-native/tree/main/packages/rn-tester) of the repository.
|
||||
RNTester is an app which contains code that exercise most part of the React Native frameworks.
|
||||
It also has the feature of building React Native **from source**. For that reason, it does not have to wait for the NPM package to be ready, but RNTester's tests can start as soon as the `build_android` step and the step that builds Hermes for iOS are done.
|
||||
|
||||
Notice the Tests on RNTester for iOS consumes the Hermes engine that is built in the previous steps.
|
||||
|
||||
For Android, these tests creates an APK that is uploaded as an artifact in CircleCI. We use these artifacts to **test the releases** of React Native..
|
||||
|
||||
### A New App
|
||||
The React Native repo contains a template app in the [`react-native/packages/react-native/template` folder]() that is used to spin up a new application that is preconfigured with React Native.
|
||||
|
||||
We have several tests that we run starting from the template, testing various configurations:
|
||||
- Debug/Release
|
||||
- JSC/Hermes (two different JS engine we support)
|
||||
- New/Old Architecture (two different Architectures for React Native)
|
||||
|
||||
We want to test all the React Native changes against the template, but we can't publish a React native version on each change that is merged. Therefore, to run tests on the template we use a NPM registry proxy called [Verdaccio](https://verdaccio.org/).
|
||||
|
||||
When running a Template test our CI follows roughly these steps:
|
||||
1. Prepare the executor
|
||||
2. Start a Verdaccio server
|
||||
3. Publish on Verdaccio all the monorepo [packages](https://github.com/facebook/react-native/tree/main/packages) on which React Native depends on.
|
||||
4. Publish on Verdaccio the react-native NPM package that has been created in the NPM step
|
||||
5. Spin up a new React native apps from the template, downloading react-native from Verdaccio.
|
||||
|
||||
In this way, we are sure that we can test all the changes that happen in React Native on a new React Native app.
|
||||
@@ -0,0 +1,114 @@
|
||||
version: 2.1
|
||||
|
||||
# this allows you to use CircleCI's dynamic configuration feature
|
||||
setup: true
|
||||
|
||||
orbs:
|
||||
continuation: circleci/continuation@1.0.0
|
||||
|
||||
parameters:
|
||||
# Real pipelines parameters
|
||||
run_release_workflow:
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
run_nightly_workflow:
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
release_version:
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
release_monorepo_packages_version:
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
release_tag:
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
release_dry_run:
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
choose_ci_jobs:
|
||||
docker:
|
||||
- image: debian:bullseye
|
||||
resource_class: small
|
||||
steps:
|
||||
- run:
|
||||
name: Install Yarn
|
||||
command: |
|
||||
apt update
|
||||
apt install -y wget git curl jq
|
||||
|
||||
apt-get update
|
||||
apt-get install -y ca-certificates curl gnupg
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
|
||||
NODE_MAJOR=18
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
||||
apt-get update
|
||||
|
||||
apt install -y nodejs
|
||||
npm install --global yarn
|
||||
- checkout
|
||||
- run:
|
||||
name: Yarn Install
|
||||
command: yarn install
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- equal: [ main, << pipeline.git.branch >> ]
|
||||
- matches:
|
||||
pattern: /0\.[0-9]+[\.[0-9]+]?-stable/
|
||||
value: << pipeline.git.branch >>
|
||||
steps:
|
||||
- run:
|
||||
name: "[Main or Stable] Create input for config to test everything"
|
||||
command: |
|
||||
mkdir -p /tmp/circleci/
|
||||
echo '{ "run_all": true }' > /tmp/circleci/pipeline_config.json
|
||||
- when:
|
||||
condition:
|
||||
not:
|
||||
or:
|
||||
- equal: [ main, << pipeline.git.branch >> ]
|
||||
- matches:
|
||||
pattern: /0\.[0-9]+[\.[0-9]+]?-stable/
|
||||
value: << pipeline.git.branch >>
|
||||
steps:
|
||||
- run:
|
||||
name: "[PR Branch] Filter jobs"
|
||||
command: |
|
||||
if [[ -z "$CIRCLE_PULL_REQUEST" ]]; then
|
||||
echo "Not in a PR. Can't filter properly outside a PR. Please open a PR so that we can run the proper CI tests."
|
||||
echo "For safety, we run all the tests!"
|
||||
mkdir -p /tmp/circleci/
|
||||
echo '{ "run_all": true }' > /tmp/circleci/pipeline_config.json
|
||||
else
|
||||
PR_NUMBER="${CIRCLE_PULL_REQUEST##*/}"
|
||||
node ./scripts/circleci/pipeline_selection.js filter-jobs
|
||||
fi
|
||||
- run:
|
||||
name: Create config
|
||||
description: Generates a configuration on the fly, depending on the files that have been modified
|
||||
command: |
|
||||
node ./scripts/circleci/pipeline_selection.js create-configs
|
||||
- store_artifacts:
|
||||
path: .circleci/generated_config.yml
|
||||
destination: generated_config.yml
|
||||
- continuation/continue:
|
||||
configuration_path: .circleci/generated_config.yml
|
||||
|
||||
# our single workflow, that triggers the setup job defined above
|
||||
workflows:
|
||||
always-run:
|
||||
jobs:
|
||||
- choose_ci_jobs:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
@@ -0,0 +1,578 @@
|
||||
# -------------------------
|
||||
# COMMANDS
|
||||
# -------------------------
|
||||
commands:
|
||||
# Checkout with cache, on machines that are using Docker the cache is ignored
|
||||
checkout_code_with_cache:
|
||||
parameters:
|
||||
checkout_base_cache_key:
|
||||
default: *checkout_cache_key
|
||||
type: string
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: << parameters.checkout_base_cache_key >>-{{ arch }}-{{ .Branch }}-{{ .Revision }}
|
||||
- checkout
|
||||
- save_cache:
|
||||
key: << parameters.checkout_base_cache_key >>-{{ arch }}-{{ .Branch }}-{{ .Revision }}
|
||||
paths:
|
||||
- ".git"
|
||||
|
||||
setup_ruby:
|
||||
parameters:
|
||||
ruby_version:
|
||||
default: "2.6.10"
|
||||
type: string
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: *gems_cache_key
|
||||
- run:
|
||||
name: Set Required Ruby
|
||||
command: echo << parameters.ruby_version >> > /tmp/required_ruby
|
||||
- restore_cache:
|
||||
key: *rbenv_cache_key
|
||||
- run:
|
||||
name: Install the proper Ruby and run Bundle install
|
||||
command: |
|
||||
# Check if rbenv is installed. CircleCI is migrating to rbenv so we may not need to always install it.
|
||||
|
||||
if [[ -z "$(command -v rbenv)" ]]; then
|
||||
brew install rbenv ruby-build
|
||||
# Load and init rbenv
|
||||
(rbenv init 2> /dev/null) || true
|
||||
echo '' >> ~/.bash_profile
|
||||
echo 'eval "$(rbenv init - bash)"' >> ~/.bash_profile
|
||||
source ~/.bash_profile
|
||||
else
|
||||
echo "rbenv found; Skipping installation"
|
||||
fi
|
||||
|
||||
# Install the right version of ruby
|
||||
if [[ -z "$(rbenv versions | grep << parameters.ruby_version >>)" ]]; then
|
||||
# ensure that `ruby-build` can see all the available versions of Ruby
|
||||
# some PRs received machines in a weird state, this should make the pipelines
|
||||
# more robust.
|
||||
brew update && brew upgrade ruby-build
|
||||
rbenv install << parameters.ruby_version >>
|
||||
fi
|
||||
|
||||
# Set ruby dependencies
|
||||
rbenv global << parameters.ruby_version >>
|
||||
if [[ << parameters.ruby_version >> == "2.6.10" ]]; then
|
||||
rbenv rehash
|
||||
gem install bundler -v 2.4.22
|
||||
else
|
||||
rbenv rehash
|
||||
gem install bundler
|
||||
fi
|
||||
bundle check || bundle install --path vendor/bundle --clean
|
||||
- save_cache:
|
||||
key: *rbenv_cache_key
|
||||
paths:
|
||||
- ~/.rbenv
|
||||
- save_cache:
|
||||
key: *gems_cache_key
|
||||
paths:
|
||||
- vendor/bundle
|
||||
|
||||
run_yarn:
|
||||
parameters:
|
||||
yarn_base_cache_key:
|
||||
default: *yarn_cache_key
|
||||
type: string
|
||||
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- << parameters.yarn_base_cache_key >>-{{ arch }}-{{ checksum "yarn.lock" }}
|
||||
- << parameters.yarn_base_cache_key >>-{{ arch }}
|
||||
- << parameters.yarn_base_cache_key >>
|
||||
- run:
|
||||
name: "Yarn: Install Dependencies"
|
||||
command: |
|
||||
# Skip yarn install on metro bump commits as the package is not yet
|
||||
# available on npm
|
||||
if [[ $(echo "$GIT_COMMIT_DESC" | grep -c "Bump metro@") -eq 0 ]]; then
|
||||
yarn install --non-interactive --cache-folder ~/.cache/yarn
|
||||
fi
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.cache/yarn
|
||||
key: << parameters.yarn_base_cache_key >>-{{ arch }}-{{ checksum "yarn.lock" }}
|
||||
|
||||
build_packages:
|
||||
steps:
|
||||
- run:
|
||||
name: Build packages
|
||||
command: yarn build
|
||||
|
||||
brew_install:
|
||||
parameters:
|
||||
package:
|
||||
description: Homebrew package to install
|
||||
type: string
|
||||
steps:
|
||||
- run:
|
||||
name: "Brew: Install << parameters.package >>"
|
||||
command: brew install << parameters.package >>
|
||||
|
||||
with_rntester_pods_cache_span:
|
||||
parameters:
|
||||
steps:
|
||||
type: steps
|
||||
steps:
|
||||
- run:
|
||||
name: Setup CocoaPods cache
|
||||
# Copy packages/rn-tester/Podfile.lock since it can be changed by pod install
|
||||
command: cp packages/rn-tester/Podfile.lock packages/rn-tester/Podfile.lock.bak
|
||||
- restore_cache:
|
||||
keys:
|
||||
# The committed lockfile is generated using static libraries and USE_HERMES=1 so it could load an outdated cache if a change
|
||||
# only affects the frameworks or hermes config. To help prevent this also cache based on the content of Podfile.
|
||||
- *pods_cache_key
|
||||
- steps: << parameters.steps >>
|
||||
- save_cache:
|
||||
paths:
|
||||
- packages/rn-tester/Pods
|
||||
key: *pods_cache_key
|
||||
|
||||
with_gradle_cache:
|
||||
parameters:
|
||||
steps:
|
||||
type: steps
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- *gradle_cache_key
|
||||
- v3-gradle-{{ .Environment.CIRCLE_JOB }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-
|
||||
- v3-gradle-{{ .Environment.CIRCLE_JOB }}-
|
||||
- v3-gradle-
|
||||
- steps: << parameters.steps >>
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.gradle/caches
|
||||
- ~/.gradle/wrapper
|
||||
- packages/react-native/ReactAndroid/build/downloads
|
||||
- packages/react-native/ReactAndroid/build/third-party-ndk
|
||||
key: *gradle_cache_key
|
||||
|
||||
run_e2e:
|
||||
parameters:
|
||||
platform:
|
||||
description: Target platform
|
||||
type: enum
|
||||
enum: ["android", "ios", "js"]
|
||||
default: "js"
|
||||
retries:
|
||||
description: How many times the job should try to run these tests
|
||||
type: integer
|
||||
default: 3
|
||||
steps:
|
||||
- run:
|
||||
name: "Run Tests: << parameters.platform >> End-to-End Tests"
|
||||
command: node ./scripts/e2e/run-ci-e2e-tests.js --<< parameters.platform >> --retries << parameters.retries >>
|
||||
|
||||
report_bundle_size:
|
||||
parameters:
|
||||
platform:
|
||||
description: Target platform
|
||||
type: enum
|
||||
enum: ["android", "ios"]
|
||||
steps:
|
||||
- run:
|
||||
name: Report size of RNTester.app (analysis-bot)
|
||||
command: GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" scripts/circleci/report-bundle-size.sh << parameters.platform >> || true
|
||||
|
||||
setup_hermes_version:
|
||||
steps:
|
||||
- run:
|
||||
name: Set up Hermes workspace and caching
|
||||
command: |
|
||||
mkdir -p "/tmp/hermes" "/tmp/hermes/download" "/tmp/hermes/hermes"
|
||||
|
||||
if [ -f "$HERMES_VERSION_FILE" ]; then
|
||||
echo "Hermes Version file found! Using this version for the build:"
|
||||
cat $HERMES_VERSION_FILE > /tmp/hermes/hermesversion
|
||||
else
|
||||
echo "Hermes Version file not found!!!"
|
||||
echo "Using the last commit from main for the build:"
|
||||
HERMES_TAG_SHA=$(git ls-remote https://github.com/facebook/hermes main | cut -f 1 | tr -d '[:space:]')
|
||||
echo $HERMES_TAG_SHA > /tmp/hermes/hermesversion
|
||||
fi
|
||||
cat /tmp/hermes/hermesversion
|
||||
|
||||
get_react_native_version:
|
||||
steps:
|
||||
- run:
|
||||
name: Get React Native version
|
||||
command: |
|
||||
VERSION=$(cat packages/react-native/package.json | jq -r '.version')
|
||||
# Save the react native version we are building in a file so we can use that file as part of the cache key.
|
||||
echo "$VERSION" > /tmp/react-native-version
|
||||
echo "React Native Version is $(cat /tmp/react-native-version)"
|
||||
HERMES_VERSION="$(cat /tmp/hermes/hermesversion)"
|
||||
echo "Hermes commit is $HERMES_VERSION"
|
||||
|
||||
get_react_native_version_windows:
|
||||
steps:
|
||||
- run:
|
||||
name: Get React Native version on Windows
|
||||
command: |
|
||||
$VERSION=cat packages/react-native/package.json | jq -r '.version'
|
||||
# Save the react native version we are building in a file so we can use that file as part of the cache key.
|
||||
echo "$VERSION" > /tmp/react-native-version
|
||||
echo "React Native Version is $(cat /tmp/react-native-version)"
|
||||
$HERMES_VERSION=cat C:\Users\circleci\project\tmp\hermes\hermesversion
|
||||
echo "Hermes commit is $HERMES_VERSION"
|
||||
|
||||
with_hermes_tarball_cache_span:
|
||||
parameters:
|
||||
steps:
|
||||
type: steps
|
||||
set_tarball_path:
|
||||
type: boolean
|
||||
default: False
|
||||
flavor:
|
||||
default: "Debug"
|
||||
description: The Hermes build type. Must be one of "Debug", "Release".
|
||||
type: enum
|
||||
enum: ["Debug", "Release"]
|
||||
hermes_tarball_artifacts_dir:
|
||||
type: string
|
||||
default: *hermes_tarball_artifacts_dir
|
||||
steps:
|
||||
- get_react_native_version
|
||||
- when:
|
||||
condition:
|
||||
equal: [ << parameters.flavor >>, "Debug"]
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- *hermes_tarball_debug_cache_key
|
||||
- when:
|
||||
condition:
|
||||
equal: [ << parameters.flavor >>, "Release"]
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- *hermes_tarball_release_cache_key
|
||||
- when:
|
||||
condition: << parameters.set_tarball_path >>
|
||||
steps:
|
||||
- run:
|
||||
name: Set HERMES_ENGINE_TARBALL_PATH envvar if Hermes tarball is present
|
||||
command: |
|
||||
HERMES_TARBALL_ARTIFACTS_DIR=<< parameters.hermes_tarball_artifacts_dir >>
|
||||
if [ ! -d $HERMES_TARBALL_ARTIFACTS_DIR ]; then
|
||||
echo "Hermes tarball artifacts dir not present ($HERMES_TARBALL_ARTIFACTS_DIR). Build Hermes from source."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d ~/react-native ]; then
|
||||
echo "No React Native checkout found. Run `checkout` first."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TARBALL_FILENAME=$(node ~/react-native/packages/react-native/scripts/hermes/get-tarball-name.js --buildType "<< parameters.flavor >>")
|
||||
TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME
|
||||
|
||||
echo "Looking for $TARBALL_FILENAME in $HERMES_TARBALL_ARTIFACTS_DIR"
|
||||
echo "$TARBALL_PATH"
|
||||
|
||||
if [ ! -f $TARBALL_PATH ]; then
|
||||
echo "Hermes tarball not present ($TARBALL_PATH). Build Hermes from source."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Found Hermes tarball at $TARBALL_PATH"
|
||||
echo "export HERMES_ENGINE_TARBALL_PATH=$TARBALL_PATH" >> $BASH_ENV
|
||||
- run:
|
||||
name: Print Hermes version
|
||||
command: |
|
||||
HERMES_TARBALL_ARTIFACTS_DIR=<< parameters.hermes_tarball_artifacts_dir >>
|
||||
TARBALL_FILENAME=$(node ~/react-native/packages/react-native/scripts/hermes/get-tarball-name.js --buildType "<< parameters.flavor >>")
|
||||
TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME
|
||||
if [[ -e $TARBALL_PATH ]]; then
|
||||
tar -xf $TARBALL_PATH
|
||||
echo 'print(HermesInternal?.getRuntimeProperties?.()["OSS Release Version"])' > test.js
|
||||
./destroot/bin/hermes test.js
|
||||
rm test.js
|
||||
rm -rf destroot
|
||||
else
|
||||
echo 'No Hermes tarball found.'
|
||||
fi
|
||||
- steps: << parameters.steps >>
|
||||
- when:
|
||||
condition:
|
||||
equal: [ << parameters.flavor >>, "Debug"]
|
||||
steps:
|
||||
- save_cache:
|
||||
key: *hermes_tarball_debug_cache_key
|
||||
paths: *hermes_tarball_cache_paths
|
||||
- when:
|
||||
condition:
|
||||
equal: [ << parameters.flavor >>, "Release"]
|
||||
steps:
|
||||
- save_cache:
|
||||
key: *hermes_tarball_release_cache_key
|
||||
paths: *hermes_tarball_cache_paths
|
||||
|
||||
store_hermes_apple_artifacts:
|
||||
description: Stores the tarball and the osx binaries
|
||||
parameters:
|
||||
flavor:
|
||||
default: "Debug"
|
||||
description: The Hermes build type. Must be one of "Debug", "Release".
|
||||
type: enum
|
||||
enum: ["Debug", "Release"]
|
||||
steps:
|
||||
- when:
|
||||
condition:
|
||||
equal: [ << parameters.flavor >>, "Debug"]
|
||||
steps:
|
||||
- store_artifacts:
|
||||
path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-debug.tar.gz
|
||||
- when:
|
||||
condition:
|
||||
equal: [ << parameters.flavor >>, "Release"]
|
||||
steps:
|
||||
- store_artifacts:
|
||||
path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-release.tar.gz
|
||||
- store_artifacts:
|
||||
path: /tmp/hermes/osx-bin/<< parameters.flavor >>/hermesc
|
||||
- store_artifacts:
|
||||
path: /tmp/hermes/dSYM/<< parameters.flavor >>/hermes.framework.dSYM
|
||||
|
||||
stop_job_if_apple_artifacts_are_there:
|
||||
description: Stops the current job if there are already the required artifacts
|
||||
parameters:
|
||||
flavor:
|
||||
default: "All"
|
||||
description: The flavor of artifacts to check. Must be one of "Debug", "Release" or "All"
|
||||
type: enum
|
||||
enum: ["Debug", "Release", "All"]
|
||||
steps:
|
||||
- when:
|
||||
condition:
|
||||
equal: [ << parameters.flavor >>, "All"]
|
||||
steps:
|
||||
- run:
|
||||
name: "Export files to be checked"
|
||||
command: |
|
||||
echo "/tmp/hermes/Release_tarball_present" > /tmp/hermes_files
|
||||
echo "/tmp/hermes/Debug_tarball_present" >> /tmp/hermes_files
|
||||
echo "/tmp/hermes/Release_osx_bin" >> /tmp/hermes_files
|
||||
echo "/tmp/hermes/Debug_osx_bin" >> /tmp/hermes_files
|
||||
echo "/tmp/hermes/Release_dSYM" >> /tmp/hermes_files
|
||||
echo "/tmp/hermes/Debug_dSYM" >> /tmp/hermes_files
|
||||
- when:
|
||||
condition:
|
||||
not:
|
||||
equal: [ << parameters.flavor >>, "All"]
|
||||
steps:
|
||||
- run:
|
||||
name: "Export files to be checked"
|
||||
command: |
|
||||
echo "/tmp/hermes/<< parameters.flavor >>_tarball_present" > /tmp/hermes_files
|
||||
echo "/tmp/hermes/<< parameters.flavor >>_osx_bin" >> /tmp/hermes_files
|
||||
echo "/tmp/hermes/<< parameters.flavor >>_dSYM" >> /tmp/hermes_files
|
||||
- run:
|
||||
name: Stop if files are present
|
||||
command: |
|
||||
files=($(cat /tmp/hermes_files))
|
||||
# Initialize a flag indicating all files exist
|
||||
|
||||
all_files_exist=true
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
if [[ ! -f "$file" ]]; then
|
||||
all_files_exist=false
|
||||
echo "$file does not exist."
|
||||
else
|
||||
echo "$file exist."
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$all_files_exist" == true ]]; then
|
||||
echo "Tarball, osx-bin and dSYM are present. Halting this job"
|
||||
circleci-agent step halt
|
||||
fi
|
||||
|
||||
check_if_tarball_is_present:
|
||||
description: "Checks if the tarball of a specific Flavor is present and adds a marker file"
|
||||
parameters:
|
||||
flavor:
|
||||
default: "Debug"
|
||||
description: The flavor of artifacts to check. Must be one of "Debug" or "Release"
|
||||
type: enum
|
||||
enum: ["Debug", "Release"]
|
||||
steps:
|
||||
- run:
|
||||
name: Check if << parameters.flavor >> tarball is there
|
||||
command: |
|
||||
FLAVOR=debug
|
||||
if [[ << parameters.flavor >> == "Release" ]]; then
|
||||
FLAVOR=release
|
||||
fi
|
||||
|
||||
if [[ -f "/tmp/hermes/hermes-runtime-darwin/hermes-ios-$FLAVOR.tar.gz" ]]; then
|
||||
echo "[HERMES TARBALL] Found the << parameters.flavor >> tarball"
|
||||
touch /tmp/hermes/<< parameters.flavor >>_tarball_present
|
||||
fi
|
||||
|
||||
check_if_osx_bin_is_present:
|
||||
description: "Checks if the osx bin of a specific Flavor is present and adds a marker file"
|
||||
parameters:
|
||||
flavor:
|
||||
default: "Debug"
|
||||
description: The flavor of artifacts to check. Must be one of "Debug" or "Release"
|
||||
type: enum
|
||||
enum: ["Debug", "Release"]
|
||||
steps:
|
||||
- run:
|
||||
name: Check if macosx binary is there
|
||||
command: |
|
||||
if [[ -d /tmp/hermes/osx-bin/<< parameters.flavor >> ]]; then
|
||||
echo "[HERMES MACOSX BIN] Found the osx bin << parameters.flavor >>"
|
||||
touch /tmp/hermes/<< parameters.flavor >>_osx_bin
|
||||
fi
|
||||
|
||||
check_if_dsym_are_present:
|
||||
description: "Checks if the dSYM a specific Flavor are present and adds a marker file"
|
||||
parameters:
|
||||
flavor:
|
||||
default: "Debug"
|
||||
description: The flavor of artifacts to check. Must be one of "Debug" or "Release"
|
||||
type: enum
|
||||
enum: ["Debug", "Release"]
|
||||
steps:
|
||||
- run:
|
||||
name: Check if dSYM are there
|
||||
command: |
|
||||
if [[ -d /tmp/hermes/dSYM/<< parameters.flavor >> ]]; then
|
||||
echo "[HERMES dSYM] Found the dSYM << parameters.flavor >>"
|
||||
touch /tmp/hermes/<< parameters.flavor >>_dSYM
|
||||
fi
|
||||
|
||||
setup_hermes_workspace:
|
||||
description: "Setup Hermes Workspace"
|
||||
steps:
|
||||
- run:
|
||||
name: Set up workspace
|
||||
command: |
|
||||
mkdir -p $HERMES_OSXBIN_ARTIFACTS_DIR ./packages/react-native/sdks/hermes
|
||||
cp -r $HERMES_WS_DIR/hermes/* ./packages/react-native/sdks/hermes/.
|
||||
cp -r ./packages/react-native/sdks/hermes-engine/utils ./packages/react-native/sdks/hermes/.
|
||||
|
||||
with_xcodebuild_cache:
|
||||
description: "Add caching to iOS jobs to speed up builds"
|
||||
parameters:
|
||||
steps:
|
||||
type: steps
|
||||
podfile_lock_path:
|
||||
type: string
|
||||
default: packages/rn-tester/Podfile.lock
|
||||
pods_build_folder:
|
||||
type: string
|
||||
default: packages/rn-tester/Pods
|
||||
podfile_lock_cache_key:
|
||||
type: string
|
||||
default: *rntester_podfile_lock_cache_key
|
||||
cocoapods_cache_key:
|
||||
type: string
|
||||
default: *cocoapods_cache_key
|
||||
steps:
|
||||
- run:
|
||||
name: Prepare Xcodebuild cache
|
||||
command: |
|
||||
WEEK=$(date +"%U")
|
||||
YEAR=$(date +"%Y")
|
||||
echo "$WEEK-$YEAR" > /tmp/week_year
|
||||
- restore_cache:
|
||||
key: << parameters.podfile_lock_cache_key >>
|
||||
- restore_cache:
|
||||
key: << parameters.cocoapods_cache_key >>
|
||||
- steps: << parameters.steps >>
|
||||
- save_cache:
|
||||
key: << parameters.podfile_lock_cache_key >>
|
||||
paths:
|
||||
- << parameters.podfile_lock_path >>
|
||||
- save_cache:
|
||||
key: << parameters.cocoapods_cache_key >>
|
||||
paths:
|
||||
- << parameters.pods_build_folder >>
|
||||
|
||||
store_artifacts_if_needed:
|
||||
description: "This step stores the artifacts only if we are on main or on a stable branch"
|
||||
parameters:
|
||||
path:
|
||||
type: string
|
||||
destination:
|
||||
type: string
|
||||
default: << parameters.path >>
|
||||
when:
|
||||
type: enum
|
||||
enum: ['always', 'on_fail', 'on_success']
|
||||
default: 'always'
|
||||
steps:
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- equal: [ main, << pipeline.git.branch >> ]
|
||||
- matches:
|
||||
pattern: /0\.[0-9]+[\.[0-9]+]?-stable/
|
||||
value: << pipeline.git.branch >>
|
||||
steps:
|
||||
- store_artifacts:
|
||||
when: << parameters.when >>
|
||||
path: << parameters.path >>
|
||||
destination: << parameters.destination >>
|
||||
|
||||
prepare_ios_tests:
|
||||
description: This command runs a set of commands to prepare iOS for running unit tests
|
||||
steps:
|
||||
- brew_install:
|
||||
package: xcbeautify
|
||||
- run:
|
||||
name: Run Ruby Tests
|
||||
command: |
|
||||
cd packages/react-native/scripts
|
||||
sh run_ruby_tests.sh
|
||||
- run:
|
||||
name: Boot iPhone Simulator
|
||||
command: source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true
|
||||
|
||||
- run:
|
||||
name: Configure Environment Variables
|
||||
command: |
|
||||
echo 'export PATH=/usr/local/opt/node@18/bin:$PATH' >> $BASH_ENV
|
||||
source $BASH_ENV
|
||||
|
||||
- run:
|
||||
name: "Brew: Tap wix/brew"
|
||||
command: brew tap wix/brew
|
||||
- brew_install:
|
||||
package: applesimutils watchman
|
||||
- run:
|
||||
name: Configure Watchman
|
||||
command: echo "{}" > .watchmanconfig
|
||||
|
||||
run_ios_tests:
|
||||
description: This command run iOS tests and collects results
|
||||
steps:
|
||||
- run:
|
||||
name: "Run Tests: iOS Unit and Integration Tests"
|
||||
command: node ./scripts/circleci/run_with_retry.js 3 yarn test-ios
|
||||
- run:
|
||||
name: Zip Derived data folder
|
||||
when: always
|
||||
command: |
|
||||
echo "zipping tests results"
|
||||
cd /Users/distiller/Library/Developer/Xcode
|
||||
XCRESULT_PATH=$(find . -name '*.xcresult')
|
||||
tar -zcvf xcresults.tar.gz $XCRESULT_PATH
|
||||
- store_artifacts_if_needed:
|
||||
path: /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz
|
||||
- report_bundle_size:
|
||||
platform: ios
|
||||
- store_test_results:
|
||||
path: ./reports/junit
|
||||
@@ -0,0 +1,45 @@
|
||||
# -------------------------
|
||||
# EXECUTORS
|
||||
# -------------------------
|
||||
executors:
|
||||
nodelts:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: *nodelts_image
|
||||
resource_class: "large"
|
||||
nodeprevlts:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: *nodeprevlts_image
|
||||
resource_class: "large"
|
||||
# Executor with Node & Java used to inspect and lint
|
||||
node-browsers-small:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: *nodelts_browser_image
|
||||
resource_class: "small"
|
||||
node-browsers-medium:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: *nodelts_browser_image
|
||||
resource_class: "medium"
|
||||
reactnativeandroid-xlarge:
|
||||
<<: *android-defaults
|
||||
resource_class: "xlarge"
|
||||
reactnativeandroid-large:
|
||||
<<: *android-defaults
|
||||
resource_class: "large"
|
||||
reactnativeios:
|
||||
<<: *defaults
|
||||
macos:
|
||||
xcode: *xcode_version
|
||||
resource_class: macos.m1.medium.gen1
|
||||
environment:
|
||||
- RCT_BUILD_HERMES_FROM_SOURCE: true
|
||||
reactnativeios-lts:
|
||||
<<: *defaults
|
||||
macos:
|
||||
xcode: '15.1'
|
||||
resource_class: macos.m1.medium.gen1
|
||||
environment:
|
||||
- RCT_BUILD_HERMES_FROM_SOURCE: true
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,111 @@
|
||||
tests:
|
||||
when:
|
||||
and:
|
||||
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
|
||||
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
|
||||
jobs:
|
||||
- prepare_release:
|
||||
name: "prepare_release (dry run test)"
|
||||
version: "0.0.0"
|
||||
monorepo_packages_version: "0.0.0"
|
||||
tag: test
|
||||
dry_run: true
|
||||
- prepare_hermes_workspace
|
||||
- build_android:
|
||||
release_type: "dry-run"
|
||||
- build_hermesc_linux:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_hermesc_apple:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_apple_slices_hermes:
|
||||
requires:
|
||||
- build_hermesc_apple
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst", "xros", "xrsimulator"]
|
||||
- build_hermes_macos:
|
||||
requires:
|
||||
- build_apple_slices_hermes
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
- build_hermesc_windows:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_npm_package:
|
||||
# Build a release package on every untagged commit, but do not publish to npm.
|
||||
release_type: "dry-run"
|
||||
requires:
|
||||
- build_android
|
||||
- build_hermesc_linux
|
||||
- build_hermes_macos
|
||||
- build_hermesc_windows
|
||||
- test_android:
|
||||
requires:
|
||||
- build_android
|
||||
- test_android_template:
|
||||
requires:
|
||||
- build_npm_package
|
||||
matrix:
|
||||
parameters:
|
||||
architecture: ["NewArch", "OldArch"]
|
||||
jsengine: ["Hermes", "JSC"]
|
||||
flavor: ["Debug", "Release"]
|
||||
- test_ios_template:
|
||||
requires:
|
||||
- build_npm_package
|
||||
name: "Test Template with Ruby 3.2.2"
|
||||
ruby_version: "3.2.2"
|
||||
architecture: "NewArch"
|
||||
flavor: "Debug"
|
||||
executor: reactnativeios-lts
|
||||
- test_ios_template:
|
||||
architecture: "OldArch"
|
||||
requires:
|
||||
- build_npm_package
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
jsengine: ["Hermes", "JSC"]
|
||||
use_frameworks: ["StaticLibraries", "DynamicFrameworks"]
|
||||
exclude:
|
||||
# This config is tested with Ruby 3.2.2. Let's not double test it.
|
||||
- flavor: "Debug"
|
||||
jsengine: "Hermes"
|
||||
use_frameworks: "StaticLibraries"
|
||||
- test_ios_rntester:
|
||||
requires:
|
||||
- build_hermes_macos
|
||||
name: "Test RNTester with Ruby 3.2.2"
|
||||
ruby_version: "3.2.2"
|
||||
executor: reactnativeios-lts
|
||||
- test_ios_rntester:
|
||||
requires:
|
||||
- build_hermes_macos
|
||||
matrix:
|
||||
parameters:
|
||||
jsengine: ["Hermes", "JSC"]
|
||||
use_frameworks: ["StaticLibraries", "DynamicFrameworks"]
|
||||
exclude:
|
||||
# Tested by test_ios-Hermes
|
||||
- jsengine: "Hermes"
|
||||
use_frameworks: "StaticLibraries"
|
||||
# Tested by test_ios-JSC
|
||||
- jsengine: "JSC"
|
||||
use_frameworks: "StaticLibraries"
|
||||
# Tested with Ruby 3.2.2, do not test this twice.
|
||||
- jsengine: "Hermes"
|
||||
use_frameworks: "StaticLibraries"
|
||||
- test_ios_rntester:
|
||||
run_unit_tests: false
|
||||
use_frameworks: "StaticLibraries"
|
||||
ruby_version: "2.6.10"
|
||||
requires:
|
||||
- build_hermes_macos
|
||||
matrix:
|
||||
parameters:
|
||||
jsengine: ["Hermes", "JSC"]
|
||||
architecture: ["NewArch", "OldArch"]
|
||||
@@ -0,0 +1,57 @@
|
||||
tests_android:
|
||||
when:
|
||||
and:
|
||||
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
|
||||
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
|
||||
jobs:
|
||||
- prepare_release:
|
||||
name: "prepare_release (dry run test)"
|
||||
version: "0.0.0"
|
||||
monorepo_packages_version: "0.0.0"
|
||||
tag: test
|
||||
dry_run: true
|
||||
- prepare_hermes_workspace
|
||||
- build_android:
|
||||
release_type: "dry-run"
|
||||
- build_hermesc_linux:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_hermesc_apple:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_apple_slices_hermes:
|
||||
requires:
|
||||
- build_hermesc_apple
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst", "xros", "xrsimulator"]
|
||||
- build_hermes_macos:
|
||||
requires:
|
||||
- build_apple_slices_hermes
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
- build_hermesc_windows:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_npm_package:
|
||||
# Build a release package on every untagged commit, but do not publish to npm.
|
||||
release_type: "dry-run"
|
||||
requires:
|
||||
- build_android
|
||||
- build_hermesc_linux
|
||||
- build_hermes_macos
|
||||
- build_hermesc_windows
|
||||
- test_android:
|
||||
requires:
|
||||
- build_android
|
||||
# - test_e2e_android
|
||||
- test_android_template:
|
||||
requires:
|
||||
- build_npm_package
|
||||
matrix:
|
||||
parameters:
|
||||
architecture: ["NewArch", "OldArch"]
|
||||
jsengine: ["Hermes", "JSC"]
|
||||
flavor: ["Debug", "Release"]
|
||||
@@ -0,0 +1,9 @@
|
||||
tests_e2e:
|
||||
when:
|
||||
and:
|
||||
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
|
||||
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
|
||||
jobs:
|
||||
- test_e2e_ios:
|
||||
ruby_version: "2.7.8"
|
||||
- test_e2e_android
|
||||
@@ -0,0 +1,94 @@
|
||||
test_ios:
|
||||
when:
|
||||
and:
|
||||
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
|
||||
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
|
||||
jobs:
|
||||
- prepare_release:
|
||||
name: "prepare_release (dry run test)"
|
||||
version: "0.0.0"
|
||||
monorepo_packages_version: "0.0.0"
|
||||
tag: test
|
||||
dry_run: true
|
||||
- prepare_hermes_workspace
|
||||
- build_android:
|
||||
release_type: "dry-run"
|
||||
- build_hermesc_linux:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_hermesc_apple:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_apple_slices_hermes:
|
||||
requires:
|
||||
- build_hermesc_apple
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst", "xros", "xrsimulator"]
|
||||
- build_hermes_macos:
|
||||
requires:
|
||||
- build_apple_slices_hermes
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
- build_hermesc_windows:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_npm_package:
|
||||
# Build a release package on every untagged commit, but do not publish to npm.
|
||||
release_type: "dry-run"
|
||||
requires:
|
||||
- build_android
|
||||
- build_hermesc_linux
|
||||
- build_hermes_macos
|
||||
- build_hermesc_windows
|
||||
# - test_e2e_ios:
|
||||
# ruby_version: "2.7.7"
|
||||
- test_ios_template:
|
||||
requires:
|
||||
- build_npm_package
|
||||
name: "Test Template with Ruby 3.2.2"
|
||||
ruby_version: "3.2.2"
|
||||
architecture: "NewArch"
|
||||
flavor: "Debug"
|
||||
executor: reactnativeios-lts
|
||||
- test_ios_template:
|
||||
architecture: "OldArch"
|
||||
requires:
|
||||
- build_npm_package
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
jsengine: ["Hermes", "JSC"]
|
||||
use_frameworks: ["StaticLibraries", "DynamicFrameworks"]
|
||||
exclude:
|
||||
# Tested with Ruby 3.2.2, let's not double test this
|
||||
- flavor: "Debug"
|
||||
jsengine: "Hermes"
|
||||
use_frameworks: "StaticLibraries"
|
||||
- test_ios_rntester:
|
||||
requires:
|
||||
- build_hermes_macos
|
||||
name: "RNTester on Ruby 3.2.2"
|
||||
ruby_version: "3.2.2"
|
||||
executor: reactnativeios-lts
|
||||
- test_ios_rntester:
|
||||
name: "RNTester with Dynamic Frameworks"
|
||||
use_frameworks: "DynamicFrameworks"
|
||||
requires:
|
||||
- build_hermes_macos
|
||||
matrix:
|
||||
parameters:
|
||||
jsengine: ["Hermes", "JSC"]
|
||||
- test_ios_rntester:
|
||||
name: "RNTester Integration Tests"
|
||||
run_unit_tests: false
|
||||
use_frameworks: "StaticLibraries"
|
||||
ruby_version: "2.6.10"
|
||||
requires:
|
||||
- build_hermes_macos
|
||||
matrix:
|
||||
parameters:
|
||||
jsengine: ["Hermes", "JSC"]
|
||||
architecture: ["NewArch", "OldArch"]
|
||||
@@ -0,0 +1,11 @@
|
||||
tests_js:
|
||||
when:
|
||||
and:
|
||||
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
|
||||
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
|
||||
jobs:
|
||||
- test_js:
|
||||
run_disabled_tests: false
|
||||
- test_js:
|
||||
name: test_js_prev_lts
|
||||
executor: nodeprevlts
|
||||
@@ -0,0 +1,150 @@
|
||||
version: 2.1
|
||||
|
||||
# -------------------------
|
||||
# ORBS
|
||||
# -------------------------
|
||||
|
||||
orbs:
|
||||
win: circleci/windows@2.4.0
|
||||
android: circleci/android@2.3.0
|
||||
|
||||
# -------------------------
|
||||
# REFERENCES
|
||||
# -------------------------
|
||||
references:
|
||||
defaults: &defaults
|
||||
working_directory: ~/react-native
|
||||
environment:
|
||||
- GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1
|
||||
# The public github tokens are publicly visible by design
|
||||
- PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A: &github_analysisbot_token_a "312d354b5c36f082cfe9"
|
||||
- PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B: &github_analysisbot_token_b "07973d757026bdd9f196"
|
||||
# Homebrew currently breaks while updating:
|
||||
# https://discuss.circleci.com/t/brew-install-fails-while-updating/32992
|
||||
- HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
android-defaults: &android-defaults
|
||||
working_directory: ~/react-native
|
||||
docker:
|
||||
- image: reactnativecommunity/react-native-android:v13.0
|
||||
environment:
|
||||
- TERM: "dumb"
|
||||
- GRADLE_OPTS: '-Dorg.gradle.daemon=false'
|
||||
# By default we only build ARM64 to save time/resources. For release/nightlies/prealpha, we override this value to build all archs.
|
||||
- ORG_GRADLE_PROJECT_reactNativeArchitectures: "arm64-v8a"
|
||||
# Repeated here, as the environment key in this executor will overwrite the one in defaults
|
||||
- PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A: *github_analysisbot_token_a
|
||||
- PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B: *github_analysisbot_token_b
|
||||
|
||||
hermes_workspace_root: &hermes_workspace_root
|
||||
/tmp/hermes
|
||||
hermes_tarball_artifacts_dir: &hermes_tarball_artifacts_dir
|
||||
/tmp/hermes/hermes-runtime-darwin
|
||||
hermes_osxbin_artifacts_dir: &hermes_osxbin_artifacts_dir
|
||||
/tmp/hermes/osx-bin
|
||||
attach_hermes_workspace: &attach_hermes_workspace
|
||||
attach_workspace:
|
||||
at: *hermes_workspace_root
|
||||
xcodebuild_derived_data_path: &xcodebuild_derived_data_path
|
||||
~/Library/Developer/Xcode/DerivedData/
|
||||
|
||||
main_or_stable_only: &main_or_stable_only
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- main
|
||||
- /0\.[0-9]+[\.[0-9]+]?-stable/
|
||||
|
||||
|
||||
# -------------------------
|
||||
# Dependency Anchors
|
||||
# -------------------------
|
||||
dependency_versions:
|
||||
xcode_version: &xcode_version "15.2"
|
||||
nodelts_image: &nodelts_image "cimg/node:20.2.0"
|
||||
nodeprevlts_image: &nodeprevlts_image "cimg/node:18.12.1"
|
||||
nodelts_browser_image: &nodelts_browser_image "cimg/node:20.2.0-browsers"
|
||||
|
||||
# -------------------------
|
||||
# Cache Key Anchors
|
||||
# -------------------------
|
||||
# Anchors for the cache keys
|
||||
|
||||
cache_keys:
|
||||
checkout_cache_key: &checkout_cache_key v1-checkout
|
||||
gems_cache_key: &gems_cache_key v1-gems-{{ arch }}-{{ checksum "Gemfile.lock" }}
|
||||
gradle_cache_key: &gradle_cache_key v3-gradle-{{ .Environment.CIRCLE_JOB }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "packages/react-native/ReactAndroid/gradle.properties" }}
|
||||
yarn_cache_key: &yarn_cache_key v7-yarn-cache-{{ .Environment.CIRCLE_JOB }}
|
||||
rbenv_cache_key: &rbenv_cache_key v1-rbenv-{{ arch }}-{{ checksum "/tmp/required_ruby" }}
|
||||
hermes_workspace_cache_key: &hermes_workspace_cache_key v8-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
|
||||
hermes_workspace_debug_cache_key: &hermes_workspace_debug_cache_key v5-hermes-{{ .Environment.CIRCLE_JOB }}-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
|
||||
hermes_workspace_release_cache_key: &hermes_workspace_release_cache_key v5-hermes-{{ .Environment.CIRCLE_JOB }}-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
|
||||
hermes_linux_cache_key: &hermes_linux_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-linux-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
|
||||
hermes_windows_cache_key: &hermes_windows_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-windows-{{ checksum "/Users/circleci/project/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
|
||||
# Hermes iOS
|
||||
hermesc_apple_cache_key: &hermesc_apple_cache_key v4-hermesc-apple-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
|
||||
hermes_apple_slices_cache_key: &hermes_apple_slices_cache_key v13-hermes-apple-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
|
||||
hermes_tarball_debug_cache_key: &hermes_tarball_debug_cache_key v10-hermes-tarball-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
|
||||
hermes_tarball_release_cache_key: &hermes_tarball_release_cache_key v9-hermes-tarball-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
|
||||
hermes_macosx_bin_release_cache_key: &hermes_macosx_bin_release_cache_key v5-hermes-release-macosx-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
|
||||
hermes_macosx_bin_debug_cache_key: &hermes_macosx_bin_debug_cache_key v3-hermes-debug-macosx-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
|
||||
hermes_dsym_debug_cache_key: &hermes_dsym_debug_cache_key v4-hermes-debug-dsym-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
|
||||
hermes_dsym_release_cache_key: &hermes_dsym_release_cache_key v4-hermes-release-dsym-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
|
||||
# Cocoapods - RNTester
|
||||
pods_cache_key: &pods_cache_key v12-pods-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}-{{ checksum "packages/rn-tester/Podfile" }}
|
||||
cocoapods_cache_key: &cocoapods_cache_key v12-cocoapods-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock" }}-{{ checksum "packages/rn-tester/Podfile" }}-{{ checksum "/tmp/hermes/hermesversion" }}
|
||||
rntester_podfile_lock_cache_key: &rntester_podfile_lock_cache_key v10-podfilelock-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile" }}-{{ checksum "/tmp/week_year" }}-{{ checksum "/tmp/hermes/hermesversion" }}
|
||||
|
||||
# Cocoapods - Template
|
||||
template_cocoapods_cache_key: &template_cocoapods_cache_key v6-cocoapods-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile.lock" }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile" }}-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "packages/rn-tester/Podfile.lock" }}
|
||||
template_podfile_lock_cache_key: &template_podfile_lock_cache_key v6-podfilelock-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/iOSTemplateProject/ios/Podfile" }}-{{ checksum "/tmp/week_year" }}-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "packages/rn-tester/Podfile.lock" }}
|
||||
|
||||
cache_paths:
|
||||
hermes_workspace_macos_cache_paths: &hermes_workspace_macos_cache_paths
|
||||
- ~/react-native/packages/react-native/sdks/hermes/build_macosx
|
||||
- ~/react-native/packages/react-native/sdks/hermes/destroot
|
||||
hermes_tarball_cache_paths: &hermes_tarball_cache_paths
|
||||
- *hermes_tarball_artifacts_dir
|
||||
|
||||
# -------------------------
|
||||
# Filters
|
||||
# -------------------------
|
||||
# CircleCI filters are OR-ed, with all branches triggering by default and tags excluded by default
|
||||
# CircleCI env-vars are only set with the branch OR tag that triggered the job, not both.
|
||||
|
||||
# In this case, CIRCLE_BRANCH is unset, but CIRCLE_TAG is set.
|
||||
only_release_tags: &only_release_tags
|
||||
# Both of the following conditions must be included!
|
||||
# Ignore any commit on any branch by default.
|
||||
branches:
|
||||
ignore: /.*/
|
||||
# Only act on version tags.
|
||||
tags:
|
||||
only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/
|
||||
|
||||
# -------------------------
|
||||
# PIPELINE PARAMETERS
|
||||
# -------------------------
|
||||
parameters:
|
||||
run_release_workflow:
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
run_nightly_workflow:
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
release_version:
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
release_monorepo_packages_version:
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
release_tag:
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
release_dry_run:
|
||||
default: false
|
||||
type: boolean
|
||||
@@ -0,0 +1,134 @@
|
||||
# -------------------------
|
||||
# WORKFLOWS
|
||||
#
|
||||
# When creating a new workflow, make sure to include condition:
|
||||
#
|
||||
# when:
|
||||
# and:
|
||||
# - equal: [ false, << pipeline.parameters.run_release_workflow >> ]
|
||||
# - equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
|
||||
#
|
||||
# It's setup this way so we can trigger a release via a POST
|
||||
# See limitations: https://support.circleci.com/hc/en-us/articles/360050351292-How-to-trigger-a-workflow-via-CircleCI-API-v2
|
||||
# -------------------------
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
|
||||
# Release workflow, triggered by `yarn trigger-react-native-release`
|
||||
create_release:
|
||||
when: << pipeline.parameters.run_release_workflow >>
|
||||
jobs:
|
||||
- prepare_release:
|
||||
name: prepare_release
|
||||
version: << pipeline.parameters.release_version >>
|
||||
monorepo_packages_version: << pipeline.parameters.release_monorepo_packages_version >>
|
||||
tag: << pipeline.parameters.release_tag >>
|
||||
dry_run: << pipeline.parameters.release_dry_run >>
|
||||
|
||||
# This job will run only when a tag is published due to all the jobs being filtered.
|
||||
publish_release:
|
||||
jobs:
|
||||
- prepare_hermes_workspace:
|
||||
filters: *only_release_tags
|
||||
- build_android:
|
||||
filters: *only_release_tags
|
||||
name: build_android_for_release
|
||||
release_type: "release"
|
||||
- build_hermesc_linux:
|
||||
filters: *only_release_tags
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_hermesc_apple:
|
||||
filters: *only_release_tags
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_apple_slices_hermes:
|
||||
filters: *only_release_tags
|
||||
requires:
|
||||
- build_hermesc_apple
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst"]
|
||||
- build_hermesc_windows:
|
||||
filters: *only_release_tags
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_hermes_macos:
|
||||
filters: *only_release_tags
|
||||
requires:
|
||||
- build_apple_slices_hermes
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
# This job will trigger when a version tag is pushed (by package_release)
|
||||
- build_npm_package:
|
||||
name: build_and_publish_npm_package
|
||||
release_type: "release"
|
||||
filters: *only_release_tags
|
||||
requires:
|
||||
- build_android_for_release
|
||||
- build_hermesc_linux
|
||||
- build_hermes_macos
|
||||
- build_hermesc_windows
|
||||
- poll_maven:
|
||||
requires:
|
||||
- build_and_publish_npm_package
|
||||
|
||||
analysis:
|
||||
when:
|
||||
and:
|
||||
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
|
||||
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
|
||||
jobs:
|
||||
# Run lints on every commit
|
||||
- analyze_code
|
||||
|
||||
# Run code checks on PRs
|
||||
- analyze_pr
|
||||
|
||||
nightly:
|
||||
when: << pipeline.parameters.run_nightly_workflow >>
|
||||
jobs:
|
||||
- prepare_hermes_workspace
|
||||
- build_android:
|
||||
release_type: "nightly"
|
||||
- build_hermesc_linux:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_hermesc_apple:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_apple_slices_hermes:
|
||||
requires:
|
||||
- build_hermesc_apple
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst"]
|
||||
- build_hermesc_windows:
|
||||
requires:
|
||||
- prepare_hermes_workspace
|
||||
- build_hermes_macos:
|
||||
requires:
|
||||
- build_apple_slices_hermes
|
||||
matrix:
|
||||
parameters:
|
||||
flavor: ["Debug", "Release"]
|
||||
- build_npm_package:
|
||||
release_type: "nightly"
|
||||
requires:
|
||||
- build_android
|
||||
- build_hermesc_linux
|
||||
- build_hermes_macos
|
||||
- build_hermesc_windows
|
||||
|
||||
publish_bumped_packages:
|
||||
when:
|
||||
and:
|
||||
- equal: [ false, << pipeline.parameters.run_release_workflow >> ]
|
||||
- equal: [ false, << pipeline.parameters.run_nightly_workflow >> ]
|
||||
jobs:
|
||||
- find_and_publish_bumped_packages:
|
||||
<<: *main_or_stable_only
|
||||
@@ -84,7 +84,6 @@ SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
QualifierAlignment: Left
|
||||
---
|
||||
Language: ObjC
|
||||
ColumnLimit: 120
|
||||
|
||||
@@ -9,3 +9,12 @@ end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.gradle]
|
||||
indent_size = 4
|
||||
|
||||
[*.kts]
|
||||
indent_size = 4
|
||||
|
||||
[BUCK]
|
||||
indent_size = 4
|
||||
|
||||
+1
-4
@@ -2,17 +2,14 @@
|
||||
**/staticBundle.js
|
||||
docs/generatedComponentApiDocs.js
|
||||
packages/react-native/flow/
|
||||
packages/react-native/sdks/
|
||||
packages/react-native/ReactAndroid/build
|
||||
packages/react-native/ReactAndroid/hermes-engine/build/
|
||||
packages/react-native/Libraries/Renderer/*
|
||||
packages/react-native/Libraries/vendor/**/*
|
||||
node_modules/
|
||||
packages/*/node_modules
|
||||
packages/*/dist
|
||||
packages/*/types_generated
|
||||
packages/debugger-frontend/dist/**/*
|
||||
packages/react-native-codegen/lib
|
||||
tools/eslint/rules/sort-imports.js
|
||||
**/Pods/*
|
||||
**/*.macos.js
|
||||
**/*.windows.js
|
||||
|
||||
+23
-51
@@ -4,57 +4,41 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @noflow
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const path = require('node:path');
|
||||
|
||||
require('eslint-plugin-lint').load(path.join(__dirname, 'tools/eslint/rules'));
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
|
||||
extends: ['@react-native'],
|
||||
|
||||
plugins: ['@react-native/monorepo', '@react-native/specs'],
|
||||
plugins: ['@react-native/eslint-plugin-specs', 'lint'],
|
||||
|
||||
overrides: [
|
||||
// overriding the JS config from @react-native/eslint-config to ensure
|
||||
// that we use hermes-eslint for all js files
|
||||
{
|
||||
files: ['*.js', '*.js.flow', '*.jsx'],
|
||||
files: ['*.js', '*.js.flow'],
|
||||
parser: 'hermes-eslint',
|
||||
rules: {
|
||||
'@react-native/monorepo/sort-imports': 'warn',
|
||||
'eslint-comments/no-unlimited-disable': 'off',
|
||||
'ft-flow/require-valid-file-annotation': ['error', 'always'],
|
||||
'no-extra-boolean-cast': 'off',
|
||||
'no-void': 'off',
|
||||
// These rules are not required with hermes-eslint
|
||||
'ft-flow/define-flow-type': 'off',
|
||||
'ft-flow/use-flow-type': 'off',
|
||||
// Flow handles these checks for us, so they aren't required
|
||||
'no-undef': 'off',
|
||||
'no-unreachable': 'off',
|
||||
// Throwing from function or rejecting promises with non-error values could result in unclear error stack traces and lead to harder debugging
|
||||
'prefer-promise-reject-errors': 'error',
|
||||
'no-throw-literal': 'error',
|
||||
'ft-flow/define-flow-type': 0,
|
||||
'ft-flow/use-flow-type': 0,
|
||||
// flow handles this check for us, so it's not required
|
||||
'no-undef': 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
|
||||
files: ['*.js', '*.js.flow'],
|
||||
excludedFiles: ['packages/react-native/template/**/*'],
|
||||
rules: {
|
||||
'@react-native/no-deep-imports': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'./packages/react-native/Libraries/**/*.{js,flow}',
|
||||
'./packages/react-native/src/**/*.{js,flow}',
|
||||
'./packages/assets/registry.js',
|
||||
],
|
||||
parser: 'hermes-eslint',
|
||||
rules: {
|
||||
'@react-native/monorepo/no-commonjs-exports': 'warn',
|
||||
'lint/sort-imports': 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -64,17 +48,15 @@ module.exports = {
|
||||
{
|
||||
files: ['package.json'],
|
||||
rules: {
|
||||
'@react-native/monorepo/react-native-manifest': 'error',
|
||||
'lint/react-native-manifest': 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['flow-typed/**/*.js', 'packages/react-native/flow/**/*'],
|
||||
files: ['flow-typed/**/*.js'],
|
||||
rules: {
|
||||
'@react-native/monorepo/valid-flow-typed-signature': 'error',
|
||||
'ft-flow/require-valid-file-annotation': 'off',
|
||||
'no-shadow': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
quotes: 'off',
|
||||
'lint/valid-flow-typed-signature': 2,
|
||||
'no-unused-vars': 0,
|
||||
quotes: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -83,14 +65,11 @@ module.exports = {
|
||||
'packages/react-native/src/**/*.js',
|
||||
],
|
||||
rules: {
|
||||
'@react-native/monorepo/no-haste-imports': 'error',
|
||||
'@react-native/monorepo/no-react-default-imports': 'error',
|
||||
'@react-native/monorepo/no-react-named-type-imports': 'error',
|
||||
'@react-native/monorepo/no-react-native-imports': 'error',
|
||||
'@react-native/monorepo/no-react-node-imports': 'error',
|
||||
'@react-native/monorepo/require-extends-error': 'error',
|
||||
'@react-native/platform-colors': 'error',
|
||||
'@react-native/specs/react-native-modules': 'error',
|
||||
'@react-native/platform-colors': 2,
|
||||
'@react-native/specs/react-native-modules': 2,
|
||||
'lint/no-haste-imports': 2,
|
||||
'lint/no-react-native-imports': 2,
|
||||
'lint/require-extends-error': 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -134,18 +113,11 @@ module.exports = {
|
||||
files: ['**/*.d.ts'],
|
||||
plugins: ['redundant-undefined'],
|
||||
rules: {
|
||||
'no-dupe-class-members': 'off',
|
||||
'redundant-undefined/redundant-undefined': [
|
||||
'error',
|
||||
{followExactOptionalPropertyTypes: true},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/__tests__/**'],
|
||||
rules: {
|
||||
'@react-native/monorepo/no-react-native-imports': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+11
-24
@@ -1,15 +1,9 @@
|
||||
[ignore]
|
||||
; Ignore build cache folder
|
||||
<PROJECT_ROOT>/packages/react-native/sdks/.*
|
||||
|
||||
; Ignore fb_internal modules
|
||||
<PROJECT_ROOT>/packages/react-native/src/fb_internal/.*
|
||||
|
||||
; Ignore the codegen e2e tests
|
||||
<PROJECT_ROOT>/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js
|
||||
; Ignore templates for 'react-native init'
|
||||
<PROJECT_ROOT>/packages/react-native/template/.*
|
||||
|
||||
; Ignore the Dangerfile
|
||||
<PROJECT_ROOT>/private/react-native-bots/dangerfile.js
|
||||
<PROJECT_ROOT>/packages/react-native-bots/dangerfile.js
|
||||
|
||||
; Ignore "BUCK" generated dirs
|
||||
<PROJECT_ROOT>/\.buckd/
|
||||
@@ -26,12 +20,6 @@
|
||||
; Generated build output
|
||||
<PROJECT_ROOT>/packages/.*/dist
|
||||
|
||||
; helloworld
|
||||
<PROJECT_ROOT>/private/helloworld/ios/Pods/
|
||||
|
||||
; Ignore rn-tester Pods
|
||||
<PROJECT_ROOT>/packages/rn-tester/Pods/
|
||||
|
||||
[untyped]
|
||||
.*/node_modules/@react-native-community/cli/.*/.*
|
||||
|
||||
@@ -46,10 +34,9 @@ packages/react-native/interface.js
|
||||
packages/react-native/flow/
|
||||
|
||||
[options]
|
||||
experimental.global_find_ref=true
|
||||
enums=true
|
||||
experimental.pattern_matching=true
|
||||
casting_syntax=both
|
||||
component_syntax=true
|
||||
|
||||
emoji=true
|
||||
|
||||
@@ -69,13 +56,13 @@ munge_underscores=true
|
||||
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/packages/react-native/index.js'
|
||||
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/packages/react-native/\1'
|
||||
module.name_mapper='^@react-native/dev-middleware$' -> '<PROJECT_ROOT>/packages/dev-middleware'
|
||||
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\|ktx\)$' -> '<PROJECT_ROOT>/packages/react-native/Libraries/Image/RelativeImageStub'
|
||||
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/packages/react-native/Libraries/Image/RelativeImageStub'
|
||||
|
||||
module.system.haste.module_ref_prefix=m#
|
||||
|
||||
react.runtime=automatic
|
||||
|
||||
ban_spread_key_props=true
|
||||
suppress_type=$FlowIssue
|
||||
suppress_type=$FlowFixMe
|
||||
suppress_type=$FlowFixMeProps
|
||||
suppress_type=$FlowFixMeState
|
||||
suppress_type=$FlowFixMeEmpty
|
||||
|
||||
[lints]
|
||||
sketchy-null-number=warn
|
||||
@@ -98,4 +85,4 @@ untyped-import
|
||||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.289.0
|
||||
^0.228.0
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
*.js.flow linguist-language=JavaScript
|
||||
@@ -1,4 +1,4 @@
|
||||
name: 🐛 React Native - Bug Report
|
||||
name: 🐛 Bug Report
|
||||
description: Report a reproducible bug or regression in React Native.
|
||||
labels: ["Needs: Triage :mag:"]
|
||||
body:
|
||||
@@ -19,10 +19,10 @@ body:
|
||||
* Please [search for similar issues](https://github.com/facebook/react-native/issues) in our issue tracker.
|
||||
|
||||
Make sure that your issue:
|
||||
* Have a **valid reproducer** (See [How to report a bug](https://reactnative.dev/contributing/how-to-report-a-bug)).
|
||||
* Have a **valid reproducer** (either a [Expo Snack](https://snack.expo.dev/) or a [empty project from template](https://github.com/react-native-community/reproducer-react-native).
|
||||
* Is tested against the [**latest stable**](https://github.com/facebook/react-native/releases/) of React Native.
|
||||
|
||||
🚨 IMPORTANT: Due to the extreme number of bugs we receive, issues **without a reproducer** or for an [**unsupported versions**](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) of React Native **will be closed**.
|
||||
Due to the extreme number of bugs we receive, we will be looking **ONLY** into issues with a reproducer, and on [supported versions](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) of React Native.
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
@@ -69,10 +69,10 @@ body:
|
||||
- type: textarea
|
||||
id: react-native-info
|
||||
attributes:
|
||||
label: Output of `npx @react-native-community/cli info`
|
||||
description: Run `npx @react-native-community/cli info` in your terminal, copy and paste the results here.
|
||||
label: Output of `npx react-native info`
|
||||
description: Run `npx react-native info` in your terminal, copy and paste the results here.
|
||||
placeholder: |
|
||||
Paste the output of `npx @react-native-community/cli info` here. The output looks like:
|
||||
Paste the output of `npx react-native info` here. The output looks like:
|
||||
...
|
||||
System:
|
||||
OS: macOS 14.1.1
|
||||
@@ -83,7 +83,7 @@ body:
|
||||
path: /bin/zsh
|
||||
Binaries:
|
||||
Node: ...
|
||||
version: 22.14.0
|
||||
version: 18.14.0
|
||||
...
|
||||
render: text
|
||||
validations:
|
||||
@@ -109,8 +109,8 @@ body:
|
||||
- type: input
|
||||
id: reproducer
|
||||
attributes:
|
||||
label: MANDATORY Reproducer
|
||||
description: A link to either a failing RNTesterPlayground.js file, an Expo Snack or a public repository from [this template](https://github.com/react-native-community/reproducer-react-native) that reproduces this bug. Reproducers are **mandatory**, issues without a reproducer will be closed.
|
||||
label: Reproducer
|
||||
description: A link to a Expo Snack or a public repository that reproduces this bug, using [this template](https://github.com/react-native-community/reproducer-react-native). Reproducers are **mandatory**.
|
||||
placeholder: "https://github.com/<myuser>/<myreproducer>"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: ⬆️ Upgrade - Build Regression
|
||||
url: https://github.com/reactwg/react-native-releases/issues/new/choose
|
||||
about: |
|
||||
If you are upgrading to a new React Native version (stable or pre-release) and encounter a build regression.
|
||||
- name: 🚀 Expo Issue
|
||||
url: https://github.com/expo/expo/issues/new
|
||||
about: |
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
name: 🔍 Debugger - Bug Report
|
||||
description: Report a bug with React Native DevTools and the New Debugger
|
||||
labels: ["Needs: Triage :mag:", "Debugging"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "## Reporting a bug for React Native DevTools"
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for taking the time to report an issue for React Native DevTools, our new Debugger for React Native.
|
||||
|
||||
Before you continue:
|
||||
* If you're using **Expo** and you're noticing a bug, [report it here](https://github.com/expo/expo/issues).
|
||||
* If you've found a problem with our **documentation**, [report it here](https://github.com/facebook/react-native-website/issues/).
|
||||
* If you're having an issue with **Metro** (the bundler), [report it here](https://github.com/facebook/metro/issues/).
|
||||
* If you're using an external library, report the issue to the **library first**.
|
||||
* Please [search for similar issues](https://github.com/facebook/react-native/issues) in our issue tracker.
|
||||
|
||||
Make sure that your issue is tested against the [**latest stable**](https://github.com/facebook/react-native/releases/) of React Native.
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: The list of steps that reproduces the issue.
|
||||
placeholder: |
|
||||
1. Install the application with `yarn android`
|
||||
2. Press `j` to open the debugger
|
||||
3. Do something...
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: React Native Version
|
||||
description: The version of react-native that this issue reproduces on. Bear in mind that only issues on [supported versions](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) will be looked into.
|
||||
placeholder: "0.76.0"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: react-native-info
|
||||
attributes:
|
||||
label: Output of `npx @react-native-community/cli info`
|
||||
description: Run `npx @react-native-community/cli info` in your terminal, copy and paste the results here.
|
||||
placeholder: |
|
||||
Paste the output of `npx @react-native-community/cli info` here. The output looks like:
|
||||
...
|
||||
System:
|
||||
OS: macOS 14.1.1
|
||||
CPU: (10) arm64 Apple M1 Max
|
||||
Memory: 417.81 MB / 64.00 GB
|
||||
Shell:
|
||||
version: "5.9"
|
||||
path: /bin/zsh
|
||||
Binaries:
|
||||
Node: ...
|
||||
version: 22.14.0
|
||||
...
|
||||
render: text
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: extra
|
||||
attributes:
|
||||
label: Screenshots and Videos
|
||||
description: |
|
||||
Please provide screenshot or a video of your bug if relevant.
|
||||
Issues with videos and screenshots are more likely to **get prioritized**.
|
||||
@@ -16,10 +16,10 @@ body:
|
||||
Do not attempt to open a bug in this category if you're not using the New Architecture as your bug will be closed.
|
||||
|
||||
Make sure that your issue:
|
||||
* Have a **valid reproducer** (See [How to report a bug](https://reactnative.dev/contributing/how-to-report-a-bug)).
|
||||
* Have a **valid reproducer** (either a [Expo Snack](https://snack.expo.dev/) or a [empty project from template](https://github.com/react-native-community/reproducer-react-native).
|
||||
* Is tested against the [**latest stable**](https://github.com/facebook/react-native/releases/) of React Native.
|
||||
|
||||
🚨 IMPORTANT: Due to the extreme number of bugs we receive, issues **without a reproducer** or for an [**unsupported versions**](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) of React Native **will be closed**.
|
||||
Due to the extreme number of bugs we receive, we will be looking **ONLY** into issues with a reproducer, and on [supported versions](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) of React Native.
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
@@ -81,10 +81,10 @@ body:
|
||||
- type: textarea
|
||||
id: react-native-info
|
||||
attributes:
|
||||
label: Output of `npx @react-native-community/cli info`
|
||||
description: Run `npx @react-native-community/cli info` in your terminal, copy and paste the results here.
|
||||
label: Output of `npx react-native info`
|
||||
description: Run `npx react-native info` in your terminal, copy and paste the results here.
|
||||
placeholder: |
|
||||
Paste the output of `npx @react-native-community/cli info` here. The output looks like:
|
||||
Paste the output of `npx react-native info` here. The output looks like:
|
||||
...
|
||||
System:
|
||||
OS: macOS 14.1.1
|
||||
@@ -95,7 +95,7 @@ body:
|
||||
path: /bin/zsh
|
||||
Binaries:
|
||||
Node: ...
|
||||
version: 22.14.0
|
||||
version: 18.14.0
|
||||
...
|
||||
render: text
|
||||
validations:
|
||||
@@ -121,8 +121,8 @@ body:
|
||||
- type: input
|
||||
id: reproducer
|
||||
attributes:
|
||||
label: MANDATORY Reproducer
|
||||
description: A link to either a failing RNTesterPlayground.js file, an Expo Snack or a public repository from [this template](https://github.com/react-native-community/reproducer-react-native) that reproduces this bug. Reproducers are **mandatory**, issues without a reproducer will be closed.
|
||||
label: Reproducer
|
||||
description: A link to a Expo Snack or a public repository that reproduces this bug, using [this template](https://github.com/react-native-community/reproducer-react-native). Reproducers are **mandatory**.
|
||||
placeholder: "https://github.com/<myuser>/<myreproducer>"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
name: ⬆️ Upgrade - Build Regression
|
||||
description: If you are upgrading to a new React Native version (stable or pre-release) and encounter a build regression.
|
||||
labels: ["Needs: Triage :mag:", "Type: Upgrade Issue"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "## Upgrade Issues"
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please use this form to file an issue if you have upgraded or are upgrading to [latest stable release](https://github.com/facebook/react-native/releases/latest) and have experienced a regression (something that used to work in previous version).
|
||||
|
||||
If you're **NOT** upgrading the React Native version, please use this [other bug type](https://github.com/facebook/react-native/issues/new?template=bug_report.yml).
|
||||
|
||||
Before you continue:
|
||||
* If you're using **Expo** and having problems updating it, [report it here](https://github.com/expo/expo/issues).
|
||||
* If you're found a problem with our **documentation**, [report it here](https://github.com/facebook/react-native-website/issues/).
|
||||
* If you're having an issue with **Metro** (the bundler), [report it here](https://github.com/facebook/metro/issues/).
|
||||
* If you're using an external library, report the issue to the **library first**.
|
||||
* Please [search for similar issues](https://github.com/facebook/react-native/issues) in our issue tracker.
|
||||
|
||||
Make sure that your issue:
|
||||
* Have a **valid reproducer** with an [empty project from template](https://github.com/react-native-community/reproducer-react-native).
|
||||
* Is upgrading to the [**latest stable**](https://github.com/facebook/react-native/releases/) of React Native.
|
||||
|
||||
Due to the extreme number of bugs we receive, we will be looking **ONLY** into issues with a reproducer, and on [supported versions](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) of React Native.
|
||||
- type: input
|
||||
id: old-version
|
||||
attributes:
|
||||
label: Old Version
|
||||
description: The version of react-native that you're upgrading from.
|
||||
placeholder: "0.72.0"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: new-version
|
||||
attributes:
|
||||
label: New Version
|
||||
description: The version of react-native that you're upgrading to. Bear in mind that only issues that are upgrading to the [latest stable](https://github.com/facebook/react-native/releases/) will be looked into.
|
||||
placeholder: "0.73.0"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: The list of steps and commands to reproduce the issue.
|
||||
placeholder: |
|
||||
1. Install the application with `yarn android`
|
||||
2. Click on the button on the Home
|
||||
3. Notice the crash
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: platforms
|
||||
attributes:
|
||||
label: Affected Platforms
|
||||
description: Please select which platform you're developing to, and which OS you're using for building.
|
||||
multiple: true
|
||||
options:
|
||||
- Runtime - Android
|
||||
- Runtime - iOS
|
||||
- Runtime - Web
|
||||
- Runtime - Desktop
|
||||
- Build - MacOS
|
||||
- Build - Windows
|
||||
- Build - Linux
|
||||
- Other (please specify)
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: react-native-info
|
||||
attributes:
|
||||
label: Output of `npx react-native info`
|
||||
description: Run `npx react-native info` in your terminal, copy and paste the results here.
|
||||
placeholder: |
|
||||
Paste the output of `npx react-native info` here. The output looks like:
|
||||
...
|
||||
System:
|
||||
OS: macOS 14.1.1
|
||||
CPU: (10) arm64 Apple M1 Max
|
||||
Memory: 417.81 MB / 64.00 GB
|
||||
Shell:
|
||||
version: "5.9"
|
||||
path: /bin/zsh
|
||||
Binaries:
|
||||
Node: ...
|
||||
version: 18.14.0
|
||||
...
|
||||
render: text
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: stacktrace
|
||||
attributes:
|
||||
label: Stacktrace or Logs
|
||||
description: Please provide a stacktrace or a log of your crash or failure
|
||||
render: text
|
||||
placeholder: |
|
||||
Paste your stacktraces and logs here. They might look like:
|
||||
|
||||
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libfabricjni.so caused by: com.facebook.react.fabric.StateWrapperImpl result: 0
|
||||
at com.facebook.soloader.SoLoader.g(Unknown Source:341)
|
||||
at com.facebook.soloader.SoLoader.t(Unknown Source:124)
|
||||
at com.facebook.soloader.SoLoader.s(Unknown Source:2)
|
||||
at com.facebook.soloader.SoLoader.q(Unknown Source:42)
|
||||
at com.facebook.soloader.SoLoader.p(Unknown Source:1)
|
||||
...
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: reproducer
|
||||
attributes:
|
||||
label: Reproducer
|
||||
description: A link to a Expo Snack or a public repository that reproduces this bug, using [this template](https://github.com/react-native-community/reproducer-react-native). Reproducers are **mandatory**.
|
||||
placeholder: "https://github.com/<myuser>/<myreproducer>"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: extra
|
||||
attributes:
|
||||
label: Screenshots and Videos
|
||||
description: |
|
||||
Please provide screenshot or a video of your bug if relevant.
|
||||
Issues with videos and screenshots are more likely to **get prioritized**.
|
||||
@@ -1,95 +0,0 @@
|
||||
name: build-android
|
||||
description: This action builds android
|
||||
inputs:
|
||||
release-type:
|
||||
required: true
|
||||
description: The type of release we are building. It could be nightly, release or dry-run
|
||||
gradle-cache-encryption-key:
|
||||
description: "The encryption key needed to store the Gradle Configuration cache"
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup git safe folders
|
||||
shell: bash
|
||||
run: git config --global --add safe.directory '*'
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Install node dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Set React Native Version
|
||||
# We don't want to set the version for stable branches, because this has been
|
||||
# already set from the 'create release' commits on the release branch.
|
||||
if: ${{ !endsWith(github.ref_name, '-stable') }}
|
||||
shell: bash
|
||||
run: node ./scripts/releases/set-rn-artifacts-version.js --build-type ${{ inputs.release-type }}
|
||||
- name: Setup gradle
|
||||
uses: ./.github/actions/setup-gradle
|
||||
with:
|
||||
cache-read-only: "false"
|
||||
cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }}
|
||||
- name: Restore Android ccache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: /github/home/.cache/ccache
|
||||
key: v2-ccache-android-${{ github.job }}-${{ github.ref }}-${{ hashFiles('packages/react-native/ReactAndroid/**/*.cpp', 'packages/react-native/ReactAndroid/**/*.h', 'packages/react-native/ReactCommon/**/*.cpp', 'packages/react-native/ReactAndroid/**/CMakeLists.txt', 'packages/react-native/ReactCommon/**/CMakeLists.txt') }}
|
||||
restore-keys: |
|
||||
v2-ccache-android-${{ github.job }}-${{ github.ref }}-
|
||||
v2-ccache-android-${{ github.job }}-
|
||||
v2-ccache-android-
|
||||
- name: Show ccache stats
|
||||
shell: bash
|
||||
run: ccache -s -v
|
||||
- name: Build and publish all the Android Artifacts to /tmp/maven-local
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ inputs.release-type }}" == "dry-run" ]]; then
|
||||
# dry-run: we only build ARM64 to save time/resources. For release/nightlies the default is to build all archs.
|
||||
export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a,x86" # x86 is required for E2E testing
|
||||
TASKS="publishAllToMavenTempLocal build"
|
||||
elif [[ "${{ inputs.release-type }}" == "nightly" ]]; then
|
||||
# nightly: we set isSnapshot to true so artifacts are sent to the right repository on Maven Central.
|
||||
export ORG_GRADLE_PROJECT_isSnapshot="true"
|
||||
TASKS="publishAllToMavenTempLocal publishAndroidToSonatype build"
|
||||
else
|
||||
# release: we want to build all archs (default)
|
||||
TASKS="publishAllToMavenTempLocal publishAndroidToSonatype build"
|
||||
fi
|
||||
./gradlew $TASKS -PenableWarningsAsErrors=true
|
||||
- name: Save Android ccache
|
||||
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: /github/home/.cache/ccache
|
||||
key: v2-ccache-android-${{ github.job }}-${{ github.ref }}-${{ hashFiles('packages/react-native/ReactAndroid/**/*.cpp', 'packages/react-native/ReactAndroid/**/*.h', 'packages/react-native/ReactCommon/**/*.cpp', 'packages/react-native/ReactAndroid/**/CMakeLists.txt', 'packages/react-native/ReactCommon/**/CMakeLists.txt') }}
|
||||
- name: Show ccache stats
|
||||
shell: bash
|
||||
run: ccache -s -v
|
||||
- name: Upload Maven Artifacts
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: maven-local
|
||||
path: /tmp/maven-local
|
||||
- name: Upload test results
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: build-android-results
|
||||
compression-level: 1
|
||||
path: |
|
||||
packages/react-native-gradle-plugin/react-native-gradle-plugin/build/reports
|
||||
packages/react-native-gradle-plugin/settings-plugin/build/reports
|
||||
packages/react-native/ReactAndroid/build/reports
|
||||
- name: Upload RNTester APK - hermes-debug
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: rntester-debug
|
||||
path: packages/rn-tester/android/app/build/outputs/apk/debug/
|
||||
compression-level: 0
|
||||
- name: Upload RNTester APK - hermes-release
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: rntester-release
|
||||
path: packages/rn-tester/android/app/build/outputs/apk/release/
|
||||
compression-level: 0
|
||||
@@ -1,87 +0,0 @@
|
||||
name: build-npm-package
|
||||
description: This action builds the NPM package and uploads it to Maven
|
||||
inputs:
|
||||
release-type:
|
||||
required: true
|
||||
description: The type of release we are building. It could be nightly, release or dry-run
|
||||
gha-npm-token:
|
||||
required: false
|
||||
description: The GHA npm token, required only to publish to npm
|
||||
default: ''
|
||||
gradle-cache-encryption-key:
|
||||
description: The encryption key needed to store the Gradle Configuration cache
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup git safe folders
|
||||
shell: bash
|
||||
run: git config --global --add safe.directory '*'
|
||||
- name: Download ReactNativeDependencies
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: ReactNativeDependencies*
|
||||
path: ./packages/react-native/ReactAndroid/external-artifacts/artifacts
|
||||
merge-multiple: true
|
||||
- name: Download ReactCore artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: ReactCore*
|
||||
path: ./packages/react-native/ReactAndroid/external-artifacts/artifacts
|
||||
merge-multiple: true
|
||||
- name: Print Artifacts Directory
|
||||
shell: bash
|
||||
run: ls -lR ./packages/react-native/ReactAndroid/external-artifacts/artifacts/
|
||||
- name: Setup gradle
|
||||
uses: ./.github/actions/setup-gradle
|
||||
with:
|
||||
cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }}
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Build packages
|
||||
shell: bash
|
||||
run: yarn build
|
||||
- name: Build types
|
||||
shell: bash
|
||||
run: yarn build-types --skip-snapshot
|
||||
# Continue with publish steps
|
||||
- name: Set npm credentials
|
||||
if: ${{ inputs.release-type == 'release' ||
|
||||
inputs.release-type == 'nightly' }}
|
||||
shell: bash
|
||||
run: echo "//registry.npmjs.org/:_authToken=${{ inputs.gha-npm-token }}" > ~/.npmrc
|
||||
- name: Publish NPM
|
||||
shell: bash
|
||||
run: |
|
||||
echo "GRADLE_OPTS = $GRADLE_OPTS"
|
||||
# We can't have a separate step because each command is executed in a separate shell
|
||||
# so variables exported in a command are not visible in another.
|
||||
if [[ "${{ inputs.release-type }}" == "dry-run" ]]; then
|
||||
export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a"
|
||||
else
|
||||
export ORG_GRADLE_PROJECT_reactNativeArchitectures="armeabi-v7a,arm64-v8a,x86,x86_64"
|
||||
fi
|
||||
node ./scripts/releases-ci/publish-npm.js -t ${{ inputs.release-type }}
|
||||
- name: Upload npm logs
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: npm-logs
|
||||
path: ~/.npm/_logs
|
||||
- name: Build release package as a job artifact
|
||||
if: ${{ inputs.release-type == 'dry-run' }}
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p build
|
||||
|
||||
FILENAME=$(cd packages/react-native; npm pack | tail -1)
|
||||
mv "packages/react-native/$FILENAME" build/
|
||||
|
||||
echo "$FILENAME" > build/react-native-package-version
|
||||
- name: Upload release package
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
if: ${{ inputs.release-type == 'dry-run' }}
|
||||
with:
|
||||
name: react-native-package
|
||||
path: build
|
||||
@@ -1,46 +0,0 @@
|
||||
name: create_release
|
||||
description: Creates a new React Native release
|
||||
inputs:
|
||||
version:
|
||||
description: "The version of React Native we want to release. For example 0.75.0-rc.0"
|
||||
required: true
|
||||
is-latest-on-npm:
|
||||
description: "Whether we want to tag this release as latest on NPM"
|
||||
required: true
|
||||
default: "false"
|
||||
dry-run:
|
||||
description: "Whether the job should be executed in dry-run mode or not"
|
||||
default: "true"
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Yarn install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Configure Git
|
||||
shell: bash
|
||||
run: |
|
||||
git config --local user.email "bot@reactnative.dev"
|
||||
git config --local user.name "React Native Bot"
|
||||
- name: Creating release commit
|
||||
shell: bash
|
||||
run: |
|
||||
node scripts/releases/create-release-commit.js \
|
||||
--reactNativeVersion "${{ inputs.version }}" \
|
||||
--tagAsLatestRelease "${{ inputs.is-latest-on-npm }}" \
|
||||
--dryRun "${{ inputs.dry-run }}"
|
||||
GIT_PAGER=cat git show HEAD
|
||||
- name: Update "latest" tag if needed
|
||||
shell: bash
|
||||
if: ${{ inputs.is-latest-on-npm == 'true' }}
|
||||
run: |
|
||||
git tag -d "latest"
|
||||
git push origin :latest
|
||||
git tag -a "latest" -m "latest"
|
||||
- name: Pushing release commit
|
||||
shell: bash
|
||||
if: ${{ inputs.dry-run == 'false' }}
|
||||
run: |
|
||||
CURR_BRANCH="$(git branch --show-current)"
|
||||
git push origin "$CURR_BRANCH" --follow-tags
|
||||
@@ -1,23 +0,0 @@
|
||||
name: diff-js-api-breaking-changes
|
||||
description: Check for breaking changes in the public React Native JS API
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Fetch snapshot from PR head
|
||||
shell: bash
|
||||
env:
|
||||
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
|
||||
run: |
|
||||
mkdir $SCRATCH_DIR
|
||||
git fetch --depth=1 origin ${{ github.event.pull_request.head.sha }}
|
||||
git show ${{ github.event.pull_request.head.sha }}:packages/react-native/ReactNativeApi.d.ts > $SCRATCH_DIR/ReactNativeApi-after.d.ts \
|
||||
|| echo "" > $SCRATCH_DIR/ReactNativeApi.d.ts
|
||||
- name: Run breaking change detection
|
||||
shell: bash
|
||||
env:
|
||||
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
|
||||
run: |
|
||||
node ./scripts/js-api/diff-api-snapshot \
|
||||
${{ github.workspace }}/packages/react-native/ReactNativeApi.d.ts \
|
||||
$SCRATCH_DIR/ReactNativeApi-after.d.ts \
|
||||
> $SCRATCH_DIR/output.json
|
||||
@@ -1,55 +0,0 @@
|
||||
name: lint
|
||||
description: Runs all the linters in the codebase
|
||||
inputs:
|
||||
node-version:
|
||||
description: "The node.js version to use"
|
||||
required: false
|
||||
default: "22"
|
||||
github-token:
|
||||
description: "The GitHub token used by pull-bot"
|
||||
required: true
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
node-version: ${{ inputs.node-version }}
|
||||
- name: Run yarn install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Run linters against modified files (analysis-bot)
|
||||
shell: bash
|
||||
run: yarn lint-ci
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.github-token }}
|
||||
GITHUB_PR_NUMBER: ${{ github.event.number }}
|
||||
- name: Lint code
|
||||
shell: bash
|
||||
run: ./.github/workflow-scripts/exec_swallow_error.sh yarn lint --format junit -o ./reports/junit/eslint/results.xml
|
||||
- name: Lint file structure
|
||||
shell: bash
|
||||
run: ./.github/workflow-scripts/lint_files.sh
|
||||
- name: Verify not committing repo after running build
|
||||
shell: bash
|
||||
run: yarn run build --validate
|
||||
- name: Run flowcheck
|
||||
shell: bash
|
||||
run: yarn flow-check
|
||||
- name: Run typescript check
|
||||
shell: bash
|
||||
run: yarn test-typescript
|
||||
- name: Check license
|
||||
shell: bash
|
||||
run: ./.github/workflow-scripts/check_license.sh
|
||||
- name: Check formatting
|
||||
shell: bash
|
||||
run: yarn run format-check
|
||||
- name: Lint markdown
|
||||
shell: bash
|
||||
run: yarn run lint-markdown
|
||||
- name: Build types
|
||||
shell: bash
|
||||
run: yarn build-types --skip-snapshot
|
||||
- name: Run typescript check of generated types
|
||||
shell: bash
|
||||
run: yarn test-generated-typescript
|
||||
@@ -1,84 +0,0 @@
|
||||
name: Maestro E2E Android
|
||||
description: Runs E2E Tests on Android using Maestro
|
||||
inputs:
|
||||
app-path:
|
||||
required: true
|
||||
description: The path to the .apk file
|
||||
app-id:
|
||||
required: true
|
||||
description: The id of the app to test
|
||||
maestro-flow:
|
||||
required: true
|
||||
description: the folder that contains the maestro tests
|
||||
install-java:
|
||||
required: false
|
||||
default: 'true'
|
||||
description: whether this action has to install java 17 or not
|
||||
flavor:
|
||||
required: true
|
||||
description: the flavor we want to run - either debug or release
|
||||
default: release
|
||||
working-directory:
|
||||
required: false
|
||||
default: "."
|
||||
description: The directory from which metro should be started
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Installing Maestro
|
||||
shell: bash
|
||||
run: export MAESTRO_VERSION=1.40.0; curl -Ls "https://get.maestro.mobile.dev" | bash
|
||||
- name: Set up JDK 17
|
||||
if: ${{ inputs.install-java == 'true' }}
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'zulu'
|
||||
- name: Enable KVM group perms
|
||||
shell: bash
|
||||
run: |
|
||||
# ubuntu machines have hardware acceleration available and when we try to create an emulator, the script pauses asking for user input
|
||||
# These lines set the rules to reply automatically to that question and unblock the creation of the emulator.
|
||||
# source: https://github.com/ReactiveCircus/android-emulator-runner?tab=readme-ov-file#running-hardware-accelerated-emulators-on-linux-runners
|
||||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
- name: Build Codegen
|
||||
shell: bash
|
||||
if: ${{ inputs.flavor == 'debug' }}
|
||||
run: ./packages/react-native-codegen/scripts/oss/build.sh
|
||||
- name: Run e2e tests
|
||||
id: run-tests
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
with:
|
||||
api-level: 24
|
||||
arch: x86
|
||||
ram-size: '8192M'
|
||||
heap-size: '4096M'
|
||||
disk-size: '10G'
|
||||
cores: '4'
|
||||
disable-animations: false
|
||||
avd-name: e2e_emulator
|
||||
script: node .github/workflow-scripts/maestro-android.js ${{ inputs.app-path }} ${{ inputs.app-id }} ${{ inputs.maestro-flow }} ${{ inputs.flavor }} ${{ inputs.working-directory }}
|
||||
- name: Normalize APP_ID
|
||||
id: normalize-app-id
|
||||
shell: bash
|
||||
if: always()
|
||||
run: |
|
||||
NORM_APP_ID=$(echo "${{ inputs.app-id }}" | tr '.' '-')
|
||||
echo "app-id=$NORM_APP_ID" >> $GITHUB_OUTPUT
|
||||
- name: Store tests result
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
if: always()
|
||||
with:
|
||||
name: e2e_android_${{ steps.normalize-app-id.outputs.app-id }}_report_${{ inputs.flavor }}_NewArch
|
||||
path: |
|
||||
report.xml
|
||||
screen.mp4
|
||||
- name: Store Logs
|
||||
if: steps.run-tests.outcome == 'failure'
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: maestro-logs-android-${{ steps.normalize-app-id.outputs.app-id }}-${{ inputs.flavor }}-NewArch
|
||||
path: /tmp/MaestroLogs
|
||||
@@ -1,84 +0,0 @@
|
||||
name: Maestro E2E iOS
|
||||
description: Runs E2E Tests on iOS using Maestro
|
||||
inputs:
|
||||
app-path:
|
||||
required: true
|
||||
description: The path to the .app file
|
||||
app-id:
|
||||
required: true
|
||||
description: The id of the app to test
|
||||
maestro-flow:
|
||||
required: true
|
||||
description: the folder that contains the maestro tests
|
||||
flavor:
|
||||
required: true
|
||||
description: Whether we are building for Debug or Release
|
||||
default: Release
|
||||
working-directory:
|
||||
required: false
|
||||
default: "."
|
||||
description: The directory from which metro should be started
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Installing Maestro
|
||||
shell: bash
|
||||
run: export MAESTRO_VERSION=1.40.0; curl -Ls "https://get.maestro.mobile.dev" | bash
|
||||
- name: Installing Maestro dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
brew tap facebook/fb
|
||||
brew install facebook/fb/idb-companion
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'zulu'
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Run yarn install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Start Metro in Debug
|
||||
shell: bash
|
||||
if: ${{ inputs.flavor == 'Debug' }}
|
||||
run: |
|
||||
# build codegen or we will see a redbox
|
||||
./packages/react-native-codegen/scripts/oss/build.sh
|
||||
|
||||
cd ${{ inputs.working-directory }}
|
||||
yarn start &
|
||||
sleep 5 # to give metro time to load
|
||||
- name: Run tests
|
||||
id: run-tests
|
||||
shell: bash
|
||||
run: |
|
||||
# Avoid exit from the job if one of the command returns an error.
|
||||
# Maestro can fail in case of flakyness, we have some retry logic.
|
||||
set +e
|
||||
|
||||
node .github/workflow-scripts/maestro-ios.js \
|
||||
"${{ inputs.app-path }}" \
|
||||
"${{ inputs.app-id }}" \
|
||||
"${{ inputs.maestro-flow }}" \
|
||||
"Hermes" \
|
||||
"${{ inputs.flavor }}" \
|
||||
"${{ inputs.working-directory }}"
|
||||
- name: Store video record
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: e2e_ios_${{ inputs.app-id }}_report_${{ inputs.flavor }}_NewArch
|
||||
path: |
|
||||
video_record_1.mov
|
||||
video_record_2.mov
|
||||
video_record_3.mov
|
||||
video_record_4.mov
|
||||
video_record_5.mov
|
||||
report.xml
|
||||
- name: Store Logs
|
||||
if: failure() && steps.run-tests.outcome == 'failure'
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: maestro-logs-${{ inputs.app-id }}-${{ inputs.flavor }}-NewArch
|
||||
path: /tmp/MaestroLogs
|
||||
@@ -1,22 +0,0 @@
|
||||
name: prepare-ios-tests
|
||||
description: Prepare iOS Tests
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Run Ruby Tests
|
||||
shell: bash
|
||||
run: |
|
||||
cd packages/react-native/scripts
|
||||
sh run_ruby_tests.sh
|
||||
- name: Boot iPhone Simulator
|
||||
shell: bash
|
||||
run: source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true
|
||||
- name: "Brew: Tap wix/brew"
|
||||
shell: bash
|
||||
run: brew tap wix/brew
|
||||
- name: brew install applesimutils watchman
|
||||
shell: bash
|
||||
run: brew install applesimutils watchman
|
||||
- name: Configure Watchman
|
||||
shell: bash
|
||||
run: echo "{}" > .watchmanconfig
|
||||
@@ -1,83 +0,0 @@
|
||||
name: Run Fantom Tests
|
||||
inputs:
|
||||
release-type:
|
||||
required: true
|
||||
description: The type of release we are building. It could be nightly, release or dry-run
|
||||
gradle-cache-encryption-key:
|
||||
description: "The encryption key needed to store the Gradle Configuration cache"
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y git cmake openssl libssl-dev clang
|
||||
- name: Setup git safe folders
|
||||
shell: bash
|
||||
run: git config --global --add safe.directory '*'
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Install node dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Setup gradle
|
||||
uses: ./.github/actions/setup-gradle
|
||||
with:
|
||||
cache-read-only: "false"
|
||||
cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }}
|
||||
- name: Restore Fantom ccache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: /github/home/.cache/ccache
|
||||
key: v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-${{ hashFiles(
|
||||
'packages/react-native/ReactAndroid/**/*.cpp',
|
||||
'packages/react-native/ReactAndroid/**/*.h',
|
||||
'packages/react-native/ReactAndroid/**/CMakeLists.txt',
|
||||
'packages/react-native/ReactCommon/**/*.cpp',
|
||||
'packages/react-native/ReactCommon/**/*.h',
|
||||
'packages/react-native/ReactCommon/**/CMakeLists.txt',
|
||||
'private/react-native-fantom/tester/**/*.cpp',
|
||||
'private/react-native-fantom/tester/**/*.h',
|
||||
'private/react-native-fantom/tester/**/CMakeLists.txt'
|
||||
) }}
|
||||
restore-keys: |
|
||||
v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-
|
||||
v2-ccache-fantom-${{ github.job }}-
|
||||
v2-ccache-fantom-
|
||||
- name: Show ccache stats
|
||||
shell: bash
|
||||
run: ccache -s -v
|
||||
- name: Run Fantom Tests
|
||||
shell: bash
|
||||
run: yarn fantom
|
||||
env:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
- name: Save Fantom ccache
|
||||
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: /github/home/.cache/ccache
|
||||
key: v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-${{ hashFiles(
|
||||
'packages/react-native/ReactAndroid/**/*.cpp',
|
||||
'packages/react-native/ReactAndroid/**/*.h',
|
||||
'packages/react-native/ReactAndroid/**/CMakeLists.txt',
|
||||
'packages/react-native/ReactCommon/**/*.cpp',
|
||||
'packages/react-native/ReactCommon/**/*.h',
|
||||
'packages/react-native/ReactCommon/**/CMakeLists.txt',
|
||||
'private/react-native-fantom/tester/**/*.cpp',
|
||||
'private/react-native-fantom/tester/**/*.h',
|
||||
'private/react-native-fantom/tester/**/CMakeLists.txt'
|
||||
) }}
|
||||
- name: Show ccache stats
|
||||
shell: bash
|
||||
run: ccache -s -v
|
||||
- name: Upload test results
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: run-fantom-tests-results
|
||||
compression-level: 1
|
||||
path: |
|
||||
private/react-native-fantom/build/reports
|
||||
@@ -1,23 +0,0 @@
|
||||
name: Setup gradle
|
||||
description: "Set up your GitHub Actions workflow with a specific version of gradle"
|
||||
inputs:
|
||||
cache-read-only:
|
||||
description: "Whether the Gradle Cache should be in read-only mode so this job won't be allowed to write to it"
|
||||
default: "true"
|
||||
cache-encryption-key:
|
||||
description: "The encryption key needed to store the Gradle Configuration cache"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
gradle-version: wrapper
|
||||
# We want the Gradle cache to be written only on main/-stable branches run, and only for jobs with `cache-read-only` == false (i.e. `build_android`).
|
||||
cache-read-only: ${{ (github.ref != 'refs/heads/main' && !contains(github.ref, '-stable')) || inputs.cache-read-only == 'true' }}
|
||||
# Similarly, for those jobs we want to start with a clean cache so it doesn't grow without limits (this is the negation of the previous condition).
|
||||
cache-write-only: ${{ (github.ref == 'refs/heads/main' || contains(github.ref, '-stable')) && inputs.cache-read-only != 'true' }}
|
||||
add-job-summary-as-pr-comment: on-failure
|
||||
# Encryption key for the Gradle Configuration Cache.
|
||||
# See https://docs.gradle.org/8.6/userguide/configuration_cache.html#config_cache:secrets:configuring_encryption_key
|
||||
cache-encryption-key: ${{ inputs.cache-encryption-key }}
|
||||
@@ -1,15 +0,0 @@
|
||||
name: Setup node.js
|
||||
description: 'Set up your GitHub Actions workflow with a specific version of node.js'
|
||||
inputs:
|
||||
node-version:
|
||||
description: 'The node.js version to use'
|
||||
required: false
|
||||
default: '22.14.0'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node-version }}
|
||||
cache: yarn
|
||||
@@ -1,36 +0,0 @@
|
||||
name: Setup xcode
|
||||
description: 'Set up your GitHub Actions workflow with a specific version of xcode'
|
||||
inputs:
|
||||
xcode-version:
|
||||
description: 'The xcode version to use'
|
||||
required: false
|
||||
default: '16.2.0'
|
||||
platform:
|
||||
description: 'The platform to use. Valid values are: ios, ios-simulator, macos, mac-catalyst, tvos, tvos-simulator, xros, xros-simulator'
|
||||
required: false
|
||||
default: 'macos'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup xcode
|
||||
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
|
||||
with:
|
||||
xcode-version: ${{ inputs.xcode-version }}
|
||||
- name: Setup Platform ${{ inputs.platform }}
|
||||
if: ${{ inputs.platform != 'macos' && inputs.platform != 'mac-catalyst' }}
|
||||
shell: bash
|
||||
run: |
|
||||
# https://github.com/actions/runner-images/issues/12541
|
||||
sudo xcodebuild -runFirstLaunch
|
||||
sudo xcrun simctl list
|
||||
|
||||
# Install platform based on the platform
|
||||
if [[ "${{ inputs.platform }}" == "xros" || "${{ inputs.platform }}" == "xros-simulator" ]]; then
|
||||
sudo xcodebuild -downloadPlatform visionOS
|
||||
elif [[ "${{ inputs.platform }}" == "tvos" || "${{ inputs.platform }}" == "tvos-simulator" ]]; then
|
||||
sudo xcodebuild -downloadPlatform tvOS
|
||||
else
|
||||
sudo xcodebuild -downloadPlatform iOS
|
||||
fi
|
||||
|
||||
sudo xcodebuild -runFirstLaunch
|
||||
@@ -1,81 +0,0 @@
|
||||
name: test-ios-helloworld
|
||||
description: Test iOS Hello World
|
||||
inputs:
|
||||
use-frameworks:
|
||||
description: The dependency building and linking strategy to use. Must be one of "StaticLibraries", "DynamicFrameworks"
|
||||
default: StaticLibraries
|
||||
ruby-version:
|
||||
description: The version of ruby that must be used
|
||||
default: 2.6.10
|
||||
flavor:
|
||||
description: The flavor of the build. Must be one of "Debug", "Release".
|
||||
default: Debug
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup xcode
|
||||
uses: ./.github/actions/setup-xcode
|
||||
with:
|
||||
platform: ios
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Run yarn install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Setup ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ inputs.ruby-version }}
|
||||
- name: Set nightly Hermes versions
|
||||
shell: bash
|
||||
run: |
|
||||
node ./scripts/releases/use-hermes-nightly.js
|
||||
- name: Run yarn install again, with the correct hermes version
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Download ReactNativeDependencies
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ReactNativeDependencies${{ inputs.flavor }}.xcframework.tar.gz
|
||||
path: /tmp/third-party
|
||||
- name: Print third-party folder
|
||||
shell: bash
|
||||
run: ls -lR /tmp/third-party
|
||||
- name: Download React Native Prebuilds
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ReactCore${{ inputs.flavor }}.xcframework.tar.gz
|
||||
path: /tmp/ReactCore
|
||||
- name: Print ReactCore folder
|
||||
shell: bash
|
||||
run: ls -lR /tmp/ReactCore
|
||||
- name: Install iOS dependencies - Configuration ${{ inputs.flavor }};
|
||||
shell: bash
|
||||
run: |
|
||||
cd private/helloworld
|
||||
args=()
|
||||
|
||||
if [[ ${{ inputs.use-frameworks }} == "DynamicFrameworks" ]]; then
|
||||
args+=(--frameworks dynamic)
|
||||
fi
|
||||
|
||||
export RCT_USE_LOCAL_RN_DEP="/tmp/third-party/ReactNativeDependencies${{ inputs.flavor }}.xcframework.tar.gz"
|
||||
export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ inputs.flavor }}.xcframework.tar.gz"
|
||||
|
||||
yarn bootstrap ios "${args[@]}" | cat
|
||||
|
||||
- name: Run Helloworld tests
|
||||
shell: bash
|
||||
run: |
|
||||
cd private/helloworld
|
||||
yarn test
|
||||
|
||||
- name: Build HelloWorld project
|
||||
shell: bash
|
||||
run: |
|
||||
cd private/helloworld
|
||||
|
||||
args=()
|
||||
if [[ ${{ inputs.flavor }} == "Release" ]]; then
|
||||
args+=(--prod)
|
||||
fi
|
||||
yarn build ios "${args[@]}" | cat
|
||||
yarn bundle ios "${args[@]}" | cat
|
||||
@@ -1,121 +0,0 @@
|
||||
name: test-ios-rntester
|
||||
description: Test iOS RNTester
|
||||
inputs:
|
||||
use-frameworks:
|
||||
description: The dependency building and linking strategy to use. Must be one of "StaticLibraries", "DynamicFrameworks"
|
||||
default: StaticLibraries
|
||||
ruby-version:
|
||||
description: The version of ruby that must be used
|
||||
default: 2.6.10
|
||||
run-unit-tests:
|
||||
description: whether unit tests should run or not.
|
||||
default: "false"
|
||||
flavor:
|
||||
description: The flavor of the build. Must be one of "Debug", "Release".
|
||||
default: Debug
|
||||
run-e2e-tests:
|
||||
description: Whether we want to run E2E tests or not
|
||||
required: false
|
||||
default: false
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup xcode
|
||||
uses: ./.github/actions/setup-xcode
|
||||
with:
|
||||
platform: ios
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Run yarn
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Setup ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ inputs.ruby-version }}
|
||||
- name: Set nightly Hermes versions
|
||||
shell: bash
|
||||
run: |
|
||||
node ./scripts/releases/use-hermes-nightly.js
|
||||
- name: Run yarn install again, with the correct hermes version
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Prepare IOS Tests
|
||||
if: ${{ inputs.run-unit-tests == 'true' }}
|
||||
uses: ./.github/actions/prepare-ios-tests
|
||||
- name: Download ReactNativeDependencies
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ReactNativeDependencies${{ inputs.flavor }}.xcframework.tar.gz
|
||||
path: /tmp/third-party/
|
||||
- name: Print third-party folder
|
||||
shell: bash
|
||||
run: ls -lR /tmp/third-party
|
||||
- name: Download React Native Prebuilds
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ReactCore${{ inputs.flavor }}.xcframework.tar.gz
|
||||
path: /tmp/ReactCore
|
||||
- name: Print ReactCore folder
|
||||
shell: bash
|
||||
run: ls -lR /tmp/ReactCore
|
||||
- name: Install CocoaPods dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
export RCT_USE_LOCAL_RN_DEP="/tmp/third-party/ReactNativeDependencies${{ inputs.flavor }}.xcframework.tar.gz"
|
||||
export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ inputs.flavor }}.xcframework.tar.gz"
|
||||
|
||||
if [[ ${{ inputs.use-frameworks }} == "DynamicFrameworks" ]]; then
|
||||
export USE_FRAMEWORKS=dynamic
|
||||
fi
|
||||
|
||||
cd packages/rn-tester
|
||||
|
||||
bundle install
|
||||
bundle exec pod update hermes-engine --no-repo-update
|
||||
- name: Build RNTester
|
||||
shell: bash
|
||||
run: |
|
||||
xcodebuild \
|
||||
-scheme "RNTester" \
|
||||
-workspace packages/rn-tester/RNTesterPods.xcworkspace \
|
||||
-configuration "${{ inputs.flavor }}" \
|
||||
-sdk "iphonesimulator" \
|
||||
-destination "generic/platform=iOS Simulator" \
|
||||
-derivedDataPath "/tmp/RNTesterBuild"
|
||||
|
||||
echo "Print path to *.app file"
|
||||
APP_PATH=$(find "/tmp/RNTesterBuild" -type d -name "*.app")
|
||||
|
||||
echo "App found at $APP_PATH"
|
||||
echo "app-path=$APP_PATH" >> $GITHUB_ENV
|
||||
- name: "Run Tests: iOS Unit and Integration Tests"
|
||||
if: ${{ inputs.run-unit-tests == 'true' }}
|
||||
shell: bash
|
||||
run: yarn test-ios
|
||||
|
||||
- name: Zip Derived data folder
|
||||
if: ${{ inputs.run-unit-tests == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "zipping tests results"
|
||||
cd /Users/distiller/Library/Developer/Xcode
|
||||
XCRESULT_PATH=$(find . -name '*.xcresult')
|
||||
tar -zcvf xcresults.tar.gz $XCRESULT_PATH
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
if: ${{ inputs.run-unit-tests == 'true' }}
|
||||
with:
|
||||
name: xcresults
|
||||
path: /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz
|
||||
- name: Upload RNTester App
|
||||
if: ${{ inputs.use-frameworks == 'StaticLibraries' && inputs.ruby-version == '2.6.10' }} # This is needed to avoid conflicts with the artifacts
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: RNTesterApp-NewArch-${{ inputs.flavor }}
|
||||
path: ${{ env.app-path }}
|
||||
- name: Store test results
|
||||
if: ${{ inputs.run-unit-tests == 'true' }}
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: test-results
|
||||
path: ./reports/junit
|
||||
@@ -1,26 +0,0 @@
|
||||
name: test-js
|
||||
description: Runs all the JS tests in the codebase
|
||||
inputs:
|
||||
node-version:
|
||||
description: "The node.js version to use"
|
||||
required: false
|
||||
default: "22"
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
node-version: ${{ inputs.node-version }}
|
||||
- name: Yarn install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Run Tests - JavaScript Tests
|
||||
shell: bash
|
||||
run: node ./scripts/run-ci-javascript-tests.js --maxWorkers 2
|
||||
- name: Upload test results
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: test-js-results
|
||||
compression-level: 1
|
||||
path: ./reports/junit
|
||||
@@ -1,20 +0,0 @@
|
||||
name: yarn-install
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
MAX_ATTEMPTS=2
|
||||
ATTEMPT=0
|
||||
WAIT_TIME=20
|
||||
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
|
||||
yarn install --non-interactive --frozen-lockfile && break
|
||||
echo "yarn install failed. Retrying in $WAIT_TIME seconds..."
|
||||
sleep $WAIT_TIME
|
||||
ATTEMPT=$((ATTEMPT + 1))
|
||||
done
|
||||
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
|
||||
echo "All attempts to invoke yarn install failed - Aborting the workflow"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,374 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {
|
||||
_verifyTagExists,
|
||||
_extractChangelog,
|
||||
_computeBody,
|
||||
_createDraftReleaseOnGitHub,
|
||||
} = require('../createDraftRelease');
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const silence = () => {};
|
||||
const mockFetch = jest.fn();
|
||||
|
||||
jest.mock('../utils.js', () => ({
|
||||
log: silence,
|
||||
}));
|
||||
|
||||
global.fetch = mockFetch;
|
||||
|
||||
describe('Create Draft Release', () => {
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
describe('#_verifyTagExists', () => {
|
||||
it('throws if the tag does not exists', async () => {
|
||||
const token = 'token';
|
||||
mockFetch.mockReturnValueOnce(Promise.resolve({status: 404}));
|
||||
|
||||
await expect(_verifyTagExists('0.77.1')).rejects.toThrowError(
|
||||
`Tag v0.77.1 does not exist`,
|
||||
);
|
||||
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
'https://github.com/facebook/react-native/releases/tag/v0.77.1',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#_extractChangelog', () => {
|
||||
it(`extracts changelog from CHANGELOG.md`, async () => {
|
||||
const mockedReturnValue = `# Changelog
|
||||
|
||||
## v0.77.2
|
||||
|
||||
- [PR #1234](https://github.com/facebook/react-native/pull/1234) - Some change
|
||||
- [PR #5678](https://github.com/facebook/react-native/pull/5678) - Some other change
|
||||
|
||||
|
||||
## v0.77.1
|
||||
### Breaking Changes
|
||||
- [PR #9012](https://github.com/facebook/react-native/pull/9012) - Some other change
|
||||
|
||||
#### Android
|
||||
- [PR #3456](https://github.com/facebook/react-native/pull/3456) - Some other change
|
||||
- [PR #3457](https://github.com/facebook/react-native/pull/3457) - Some other change
|
||||
|
||||
#### iOS
|
||||
- [PR #3436](https://github.com/facebook/react-native/pull/3436) - Some other change
|
||||
- [PR #3437](https://github.com/facebook/react-native/pull/3437) - Some other change
|
||||
|
||||
### Fixed
|
||||
- [PR #9012](https://github.com/facebook/react-native/pull/9012) - Some other change
|
||||
|
||||
#### Android
|
||||
- [PR #3456](https://github.com/facebook/react-native/pull/3456) - Some other change
|
||||
|
||||
#### iOS
|
||||
- [PR #3437](https://github.com/facebook/react-native/pull/3437) - Some other change
|
||||
|
||||
|
||||
## v0.77.0
|
||||
|
||||
- [PR #3456](https://github.com/facebook/react-native/pull/3456) - Some other change
|
||||
|
||||
## v0.76.0
|
||||
|
||||
- [PR #7890](https://github.com/facebook/react-native/pull/7890) - Some other change`;
|
||||
|
||||
jest.spyOn(fs, 'readFileSync').mockImplementationOnce(func => {
|
||||
return mockedReturnValue;
|
||||
});
|
||||
const changelog = _extractChangelog('0.77.1');
|
||||
expect(changelog).toEqual(`## v0.77.1
|
||||
### Breaking Changes
|
||||
- [PR #9012](https://github.com/facebook/react-native/pull/9012) - Some other change
|
||||
|
||||
#### Android
|
||||
- [PR #3456](https://github.com/facebook/react-native/pull/3456) - Some other change
|
||||
- [PR #3457](https://github.com/facebook/react-native/pull/3457) - Some other change
|
||||
|
||||
#### iOS
|
||||
- [PR #3436](https://github.com/facebook/react-native/pull/3436) - Some other change
|
||||
- [PR #3437](https://github.com/facebook/react-native/pull/3437) - Some other change
|
||||
|
||||
### Fixed
|
||||
- [PR #9012](https://github.com/facebook/react-native/pull/9012) - Some other change
|
||||
|
||||
#### Android
|
||||
- [PR #3456](https://github.com/facebook/react-native/pull/3456) - Some other change
|
||||
|
||||
#### iOS
|
||||
- [PR #3437](https://github.com/facebook/react-native/pull/3437) - Some other change`);
|
||||
});
|
||||
|
||||
it('does not extract changelog for rc.0', async () => {
|
||||
const changelog = _extractChangelog('0.77.0-rc.0');
|
||||
expect(changelog).toEqual('');
|
||||
});
|
||||
|
||||
it('does not extract changelog for 0.X.0', async () => {
|
||||
const changelog = _extractChangelog('0.77.0');
|
||||
expect(changelog).toEqual('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#_computeBody', () => {
|
||||
it('computes body for release when no hermes versions are passed', async () => {
|
||||
const version = '0.77.1';
|
||||
const changelog = `## v${version}
|
||||
### Breaking Changes
|
||||
- [PR #9012](https://github.com/facebook/react-native/pull/9012) - Some other change
|
||||
|
||||
#### Android
|
||||
- [PR #3456](https://github.com/facebook/react-native/pull/3456) - Some other change
|
||||
- [PR #3457](https://github.com/facebook/react-native/pull/3457) - Some other change
|
||||
|
||||
#### iOS
|
||||
- [PR #3436](https://github.com/facebook/react-native/pull/3436) - Some other change
|
||||
- [PR #3437](https://github.com/facebook/react-native/pull/3437) - Some other change`;
|
||||
const body = _computeBody(changelog, version);
|
||||
|
||||
expect(body).toEqual(`${changelog}
|
||||
|
||||
---
|
||||
|
||||
Hermes dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
Hermes V1 dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${version}/hermes-ios-${version}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
ReactNativeDependencies dSYMs:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-release.tar.gz)
|
||||
|
||||
ReactNative Core dSYMs:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-core-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-core-release.tar.gz)
|
||||
|
||||
---
|
||||
|
||||
You can file issues or pick requests against this release [here](https://github.com/reactwg/react-native-releases/issues/new/choose).
|
||||
|
||||
---
|
||||
|
||||
To help you upgrade to this version, you can use the [Upgrade Helper](https://react-native-community.github.io/upgrade-helper/) ⚛️.
|
||||
|
||||
---
|
||||
|
||||
View the whole changelog in the [CHANGELOG.md file](https://github.com/facebook/react-native/blob/main/CHANGELOG.md).`);
|
||||
});
|
||||
|
||||
it('computes body for release when hermes versions are passed', async () => {
|
||||
const version = '0.77.1';
|
||||
const hermesVersion = '0.15.0';
|
||||
const hermesV1Version = '250829098.0.2';
|
||||
const changelog = `## v${version}
|
||||
### Breaking Changes
|
||||
- [PR #9012](https://github.com/facebook/react-native/pull/9012) - Some other change
|
||||
|
||||
#### Android
|
||||
- [PR #3456](https://github.com/facebook/react-native/pull/3456) - Some other change
|
||||
- [PR #3457](https://github.com/facebook/react-native/pull/3457) - Some other change
|
||||
|
||||
#### iOS
|
||||
- [PR #3436](https://github.com/facebook/react-native/pull/3436) - Some other change
|
||||
- [PR #3437](https://github.com/facebook/react-native/pull/3437) - Some other change`;
|
||||
const body = _computeBody(
|
||||
changelog,
|
||||
version,
|
||||
hermesVersion,
|
||||
hermesV1Version,
|
||||
);
|
||||
|
||||
expect(body).toEqual(`${changelog}
|
||||
|
||||
---
|
||||
|
||||
Hermes dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
Hermes V1 dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
ReactNativeDependencies dSYMs:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-release.tar.gz)
|
||||
|
||||
ReactNative Core dSYMs:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-core-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-core-release.tar.gz)
|
||||
|
||||
---
|
||||
|
||||
You can file issues or pick requests against this release [here](https://github.com/reactwg/react-native-releases/issues/new/choose).
|
||||
|
||||
---
|
||||
|
||||
To help you upgrade to this version, you can use the [Upgrade Helper](https://react-native-community.github.io/upgrade-helper/) ⚛️.
|
||||
|
||||
---
|
||||
|
||||
View the whole changelog in the [CHANGELOG.md file](https://github.com/facebook/react-native/blob/main/CHANGELOG.md).`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#_createDraftReleaseOnGitHub', () => {
|
||||
it('creates a draft release on GitHub', async () => {
|
||||
const version = '0.77.1';
|
||||
const url = 'https://api.github.com/repos/facebook/react-native/releases';
|
||||
const token = 'token';
|
||||
const headers = {
|
||||
Accept: 'Accept: application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const body = `Draft release body`;
|
||||
const latest = true;
|
||||
const fetchBody = JSON.stringify({
|
||||
tag_name: `v${version}`,
|
||||
name: `${version}`,
|
||||
body: body,
|
||||
draft: true,
|
||||
prerelease: false,
|
||||
make_latest: `${latest}`,
|
||||
});
|
||||
|
||||
mockFetch.mockReturnValueOnce(
|
||||
Promise.resolve({
|
||||
status: 201,
|
||||
json: () =>
|
||||
Promise.resolve({
|
||||
id: 1,
|
||||
html_url:
|
||||
'https://github.com/facebook/react-native/releases/tag/v0.77.1',
|
||||
}),
|
||||
}),
|
||||
);
|
||||
const response = await _createDraftReleaseOnGitHub(
|
||||
version,
|
||||
body,
|
||||
latest,
|
||||
token,
|
||||
);
|
||||
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
`https://api.github.com/repos/facebook/react-native/releases`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: fetchBody,
|
||||
},
|
||||
);
|
||||
expect(response).toEqual({
|
||||
id: 1,
|
||||
html_url:
|
||||
'https://github.com/facebook/react-native/releases/tag/v0.77.1',
|
||||
});
|
||||
});
|
||||
|
||||
it('creates a draft release for prerelease on GitHub', async () => {
|
||||
const version = '0.77.0-rc.2';
|
||||
const url = 'https://api.github.com/repos/facebook/react-native/releases';
|
||||
const token = 'token';
|
||||
const headers = {
|
||||
Accept: 'Accept: application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const body = `Draft release body`;
|
||||
const latest = true;
|
||||
const fetchBody = JSON.stringify({
|
||||
tag_name: `v${version}`,
|
||||
name: `${version}`,
|
||||
body: body,
|
||||
draft: true,
|
||||
prerelease: true,
|
||||
make_latest: `${latest}`,
|
||||
});
|
||||
|
||||
mockFetch.mockReturnValueOnce(
|
||||
Promise.resolve({
|
||||
status: 201,
|
||||
json: () =>
|
||||
Promise.resolve({
|
||||
id: 1,
|
||||
html_url:
|
||||
'https://github.com/facebook/react-native/releases/tag/v0.77.1',
|
||||
}),
|
||||
}),
|
||||
);
|
||||
const response = await _createDraftReleaseOnGitHub(
|
||||
version,
|
||||
body,
|
||||
latest,
|
||||
token,
|
||||
);
|
||||
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
`https://api.github.com/repos/facebook/react-native/releases`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: fetchBody,
|
||||
},
|
||||
);
|
||||
expect(response).toEqual({
|
||||
id: 1,
|
||||
html_url:
|
||||
'https://github.com/facebook/react-native/releases/tag/v0.77.1',
|
||||
});
|
||||
});
|
||||
|
||||
it('throws if the post failes', async () => {
|
||||
const version = '0.77.0-rc.2';
|
||||
const url = 'https://api.github.com/repos/facebook/react-native/releases';
|
||||
const token = 'token';
|
||||
const headers = {
|
||||
Accept: 'Accept: application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
const body = `Draft release body`;
|
||||
const latest = true;
|
||||
const fetchBody = JSON.stringify({
|
||||
tag_name: `v${version}`,
|
||||
name: `${version}`,
|
||||
body: body,
|
||||
draft: true,
|
||||
prerelease: true,
|
||||
make_latest: `${latest}`,
|
||||
});
|
||||
|
||||
mockFetch.mockReturnValueOnce(
|
||||
Promise.resolve({
|
||||
status: 401,
|
||||
}),
|
||||
);
|
||||
await expect(
|
||||
_createDraftReleaseOnGitHub(version, body, latest, token),
|
||||
).rejects.toThrowError();
|
||||
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
`https://api.github.com/repos/facebook/react-native/releases`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: fetchBody,
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,83 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {extractIssueOncalls} = require('../extractIssueOncalls');
|
||||
|
||||
const userMap = {
|
||||
'@g': '1785',
|
||||
'@c': '1781',
|
||||
'@s': '1272',
|
||||
'@d': '1332',
|
||||
'@m': '9555',
|
||||
'@p': '6097',
|
||||
'@f': '7565',
|
||||
};
|
||||
|
||||
const schedule = {
|
||||
'2025-04-01': ['@m', '@f'],
|
||||
'2025-04-08': ['@g', '@d'],
|
||||
};
|
||||
|
||||
describe('extractIssueOncalls', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.useFakeTimers('modern');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
it('extracts m and f on 6 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 6));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@m'], userMap['@f']]);
|
||||
});
|
||||
|
||||
it('extracts m and f on 7 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 7));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@m'], userMap['@f']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 8 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 8));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 9 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 9));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 10 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 10));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 11 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 11));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 12 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 12));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 13 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 13));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
});
|
||||
@@ -1,251 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {
|
||||
generateChangelog,
|
||||
_computePreviousVersionFrom,
|
||||
_generateChangelog,
|
||||
_pushCommit,
|
||||
_createPR,
|
||||
} = require('../generateChangelog');
|
||||
|
||||
const silence = () => {};
|
||||
const mockGetNpmPackageInfo = jest.fn();
|
||||
const mockExecSync = jest.fn();
|
||||
const mockRun = jest.fn();
|
||||
const mockFetch = jest.fn();
|
||||
const mockExit = jest.fn();
|
||||
|
||||
jest.mock('../utils.js', () => ({
|
||||
log: silence,
|
||||
run: mockRun,
|
||||
getNpmPackageInfo: mockGetNpmPackageInfo,
|
||||
}));
|
||||
|
||||
process.exit = mockExit;
|
||||
global.fetch = mockFetch;
|
||||
|
||||
describe('Generate Changelog', () => {
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
describe('_computePreviousVersionFrom', () => {
|
||||
it('returns rc.0 when rc is 1', async () => {
|
||||
const currentVersion = '0.78.0-rc.1';
|
||||
const expectedVersion = '0.78.0-rc.0';
|
||||
|
||||
const receivedVersion = await _computePreviousVersionFrom(currentVersion);
|
||||
|
||||
expect(receivedVersion).toEqual(expectedVersion);
|
||||
});
|
||||
|
||||
it('returns previous rc version when rc is > 1', async () => {
|
||||
const currentVersion = '0.78.0-rc.5';
|
||||
const expectedVersion = '0.78.0-rc.4';
|
||||
|
||||
const receivedVersion = await _computePreviousVersionFrom(currentVersion);
|
||||
|
||||
expect(receivedVersion).toEqual(expectedVersion);
|
||||
});
|
||||
|
||||
it('returns previous patch version when rc is 0', async () => {
|
||||
const currentVersion = '0.78.0-rc.0';
|
||||
const expectedVersion = '0.77.1';
|
||||
|
||||
mockGetNpmPackageInfo.mockReturnValueOnce(
|
||||
Promise.resolve({version: '0.77.1'}),
|
||||
);
|
||||
|
||||
const receivedVersion = await _computePreviousVersionFrom(currentVersion);
|
||||
|
||||
expect(receivedVersion).toEqual(expectedVersion);
|
||||
});
|
||||
|
||||
it('returns patch 0 when patch is 1', async () => {
|
||||
const currentVersion = '0.78.1';
|
||||
const expectedVersion = '0.78.0';
|
||||
|
||||
const receivedVersion = await _computePreviousVersionFrom(currentVersion);
|
||||
|
||||
expect(receivedVersion).toEqual(expectedVersion);
|
||||
});
|
||||
|
||||
it('returns previous patch when patch is > 1', async () => {
|
||||
const currentVersion = '0.78.5';
|
||||
const expectedVersion = '0.78.4';
|
||||
|
||||
const receivedVersion = await _computePreviousVersionFrom(currentVersion);
|
||||
|
||||
expect(receivedVersion).toEqual(expectedVersion);
|
||||
});
|
||||
|
||||
it('returns null when patch is 0', async () => {
|
||||
const currentVersion = '0.78.0';
|
||||
|
||||
const receivedVersion = await _computePreviousVersionFrom(currentVersion);
|
||||
|
||||
expect(receivedVersion).toBeNull();
|
||||
});
|
||||
|
||||
it("throws an error when the version can't be parsed", async () => {
|
||||
const currentVersion = '0.78.0-rc0';
|
||||
|
||||
await expect(
|
||||
_computePreviousVersionFrom(currentVersion),
|
||||
).rejects.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('_generateChangelog', () => {
|
||||
it('calls git in the right order', async () => {
|
||||
const currentVersion = '0.79.0-rc5';
|
||||
const previousVersion = '0.79.0-rc4';
|
||||
const token = 'token';
|
||||
|
||||
expectedCommandArgs = [
|
||||
'@rnx-kit/rn-changelog-generator',
|
||||
'--base',
|
||||
`v${previousVersion}`,
|
||||
'--compare',
|
||||
`v${currentVersion}`,
|
||||
'--repo',
|
||||
'.',
|
||||
'--changelog',
|
||||
'./CHANGELOG.md',
|
||||
'--token',
|
||||
`${token}`,
|
||||
];
|
||||
|
||||
_generateChangelog(previousVersion, currentVersion, token);
|
||||
|
||||
expect(mockRun).toHaveBeenCalledTimes(4);
|
||||
expect(mockRun).toHaveBeenNthCalledWith(1, 'git checkout main');
|
||||
expect(mockRun).toHaveBeenNthCalledWith(2, 'git fetch');
|
||||
expect(mockRun).toHaveBeenNthCalledWith(3, 'git pull origin main');
|
||||
expect(mockRun).toHaveBeenNthCalledWith(
|
||||
4,
|
||||
`npx ${expectedCommandArgs.join(' ')}`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('_pushCommit', () => {
|
||||
it('calls git in the right order', async () => {
|
||||
const currentVersion = '0.79.0-rc5';
|
||||
|
||||
_pushCommit(currentVersion);
|
||||
|
||||
expect(mockRun).toHaveBeenCalledTimes(4);
|
||||
expect(mockRun).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
`git checkout -b changelog/v${currentVersion}`,
|
||||
);
|
||||
expect(mockRun).toHaveBeenNthCalledWith(2, 'git add CHANGELOG.md');
|
||||
expect(mockRun).toHaveBeenNthCalledWith(
|
||||
3,
|
||||
`git commit -m "[RN][Changelog] Add changelog for v${currentVersion}"`,
|
||||
);
|
||||
expect(mockRun).toHaveBeenNthCalledWith(
|
||||
4,
|
||||
`git push origin changelog/v${currentVersion}`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('_createPR', () => {
|
||||
it('throws error when status is not 201', async () => {
|
||||
const currentVersion = '0.79.0-rc5';
|
||||
const token = 'token';
|
||||
|
||||
mockFetch.mockReturnValueOnce(Promise.resolve({status: 401}));
|
||||
|
||||
const headers = {
|
||||
Accept: 'Accept: application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
|
||||
const content = `
|
||||
## Summary
|
||||
Add Changelog for ${currentVersion}
|
||||
|
||||
## Changelog:
|
||||
[Internal] - Add Changelog for ${currentVersion}
|
||||
|
||||
## Test Plan:
|
||||
N/A`;
|
||||
|
||||
const body = {
|
||||
title: `[RN][Changelog] Add changelog for v${currentVersion}`,
|
||||
head: `changelog/v${currentVersion}`,
|
||||
base: 'main',
|
||||
body: content,
|
||||
};
|
||||
|
||||
await expect(_createPR(currentVersion, token)).rejects.toThrow();
|
||||
|
||||
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
'https://api.github.com/repos/facebook/react-native/pulls',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: JSON.stringify(body),
|
||||
},
|
||||
);
|
||||
});
|
||||
it('Returns the pr url', async () => {
|
||||
const currentVersion = '0.79.0-rc5';
|
||||
const token = 'token';
|
||||
const expectedPrURL =
|
||||
'https://github.com/facebook/react-native/pulls/1234';
|
||||
|
||||
const returnedObject = {
|
||||
status: 201,
|
||||
json: () => Promise.resolve({html_url: expectedPrURL}),
|
||||
};
|
||||
mockFetch.mockReturnValueOnce(Promise.resolve(returnedObject));
|
||||
|
||||
const headers = {
|
||||
Accept: 'Accept: application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
|
||||
const content = `
|
||||
## Summary
|
||||
Add Changelog for ${currentVersion}
|
||||
|
||||
## Changelog:
|
||||
[Internal] - Add Changelog for ${currentVersion}
|
||||
|
||||
## Test Plan:
|
||||
N/A`;
|
||||
|
||||
const body = {
|
||||
title: `[RN][Changelog] Add changelog for v${currentVersion}`,
|
||||
head: `changelog/v${currentVersion}`,
|
||||
base: 'main',
|
||||
body: content,
|
||||
};
|
||||
|
||||
const receivedPrURL = await _createPR(currentVersion, token);
|
||||
|
||||
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
'https://api.github.com/repos/facebook/react-native/pulls',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: JSON.stringify(body),
|
||||
},
|
||||
);
|
||||
expect(receivedPrURL).toEqual(expectedPrURL);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,129 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {
|
||||
publishTemplate,
|
||||
verifyPublishedTemplate,
|
||||
} = require('../publishTemplate');
|
||||
|
||||
const mockRun = jest.fn();
|
||||
const mockSleep = jest.fn();
|
||||
const mockGetNpmPackageInfo = jest.fn();
|
||||
const mockVerifyPublishedPackage = jest.fn();
|
||||
const silence = () => {};
|
||||
|
||||
jest.mock('../utils.js', () => ({
|
||||
log: silence,
|
||||
run: mockRun,
|
||||
sleep: mockSleep,
|
||||
getNpmPackageInfo: mockGetNpmPackageInfo,
|
||||
}));
|
||||
|
||||
jest.mock('../verifyPublishedPackage.js', () => ({
|
||||
verifyPublishedPackage: mockVerifyPublishedPackage,
|
||||
}));
|
||||
|
||||
const getMockGithub = () => ({
|
||||
rest: {
|
||||
actions: {
|
||||
createWorkflowDispatch: jest.fn(),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
describe('#publishTemplate', () => {
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
it('checks commits for magic #publish-package-to-npm&latest string and sets latest', async () => {
|
||||
mockRun.mockReturnValueOnce(`
|
||||
The commit message
|
||||
|
||||
#publish-packages-to-npm&latest`);
|
||||
|
||||
const github = getMockGithub();
|
||||
await publishTemplate(github, '0.76.0', true);
|
||||
expect(github.rest.actions.createWorkflowDispatch).toHaveBeenCalledWith({
|
||||
owner: 'react-native-community',
|
||||
repo: 'template',
|
||||
workflow_id: 'release.yaml',
|
||||
ref: '0.76-stable',
|
||||
inputs: {
|
||||
dry_run: true,
|
||||
is_latest_on_npm: true,
|
||||
version: '0.76.0',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('pubished as is_latest_on_npm = false if missing magic string', async () => {
|
||||
mockRun.mockReturnValueOnce(`
|
||||
The commit message without magic
|
||||
`);
|
||||
|
||||
const github = getMockGithub();
|
||||
await publishTemplate(github, '0.76.0', false);
|
||||
expect(github.rest.actions.createWorkflowDispatch).toHaveBeenCalledWith({
|
||||
owner: 'react-native-community',
|
||||
repo: 'template',
|
||||
workflow_id: 'release.yaml',
|
||||
ref: '0.76-stable',
|
||||
inputs: {
|
||||
dry_run: false,
|
||||
is_latest_on_npm: false,
|
||||
version: '0.76.0',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#verifyPublishedTemplate', () => {
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
it("waits on npm updating for version and not 'latest'", async () => {
|
||||
const NOT_LATEST = false;
|
||||
const version = '0.77.0';
|
||||
|
||||
await verifyPublishedTemplate(version, NOT_LATEST);
|
||||
|
||||
expect(mockVerifyPublishedPackage).toHaveBeenCalledWith(
|
||||
'@react-native-community/template',
|
||||
version,
|
||||
null,
|
||||
18,
|
||||
);
|
||||
});
|
||||
|
||||
it('waits on npm updating version and latest tag', async () => {
|
||||
const IS_LATEST = true;
|
||||
const version = '0.77.0';
|
||||
|
||||
await verifyPublishedTemplate(version, IS_LATEST);
|
||||
|
||||
expect(mockVerifyPublishedPackage).toHaveBeenCalledWith(
|
||||
'@react-native-community/template',
|
||||
version,
|
||||
'latest',
|
||||
18,
|
||||
);
|
||||
});
|
||||
|
||||
describe('retries', () => {
|
||||
it('will timeout if npm does not update package version after a set number of retries', async () => {
|
||||
const RETRIES = 2;
|
||||
|
||||
(await verifyPublishedTemplate('0.77.0', true, RETRIES),
|
||||
expect(mockVerifyPublishedPackage).toHaveBeenCalledWith(
|
||||
'@react-native-community/template',
|
||||
'0.77.0',
|
||||
'latest',
|
||||
2,
|
||||
));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,87 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {verifyArtifactsAreOnMaven} = require('../verifyArtifactsAreOnMaven');
|
||||
|
||||
const mockSleep = jest.fn();
|
||||
const silence = () => {};
|
||||
const mockFetch = jest.fn();
|
||||
const mockExit = jest.fn();
|
||||
|
||||
jest.mock('../utils.js', () => ({
|
||||
log: silence,
|
||||
sleep: mockSleep,
|
||||
}));
|
||||
|
||||
process.exit = mockExit;
|
||||
global.fetch = mockFetch;
|
||||
|
||||
describe('#verifyArtifactsAreOnMaven', () => {
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
it('waits for the packages to be published on maven when version has no v', async () => {
|
||||
mockSleep.mockReturnValueOnce(Promise.resolve()).mockImplementation(() => {
|
||||
throw new Error('Should not be called again!');
|
||||
});
|
||||
mockFetch
|
||||
.mockReturnValueOnce(Promise.resolve({status: 404}))
|
||||
.mockReturnValueOnce(Promise.resolve({status: 200}));
|
||||
|
||||
const version = '0.78.1';
|
||||
await verifyArtifactsAreOnMaven(version);
|
||||
|
||||
expect(mockSleep).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom',
|
||||
);
|
||||
});
|
||||
|
||||
it('waits for the packages to be published on maven, when version starts with v', async () => {
|
||||
mockSleep.mockReturnValueOnce(Promise.resolve()).mockImplementation(() => {
|
||||
throw new Error('Should not be called again!');
|
||||
});
|
||||
mockFetch
|
||||
.mockReturnValueOnce(Promise.resolve({status: 404}))
|
||||
.mockReturnValueOnce(Promise.resolve({status: 200}));
|
||||
|
||||
const version = 'v0.78.1';
|
||||
await verifyArtifactsAreOnMaven(version);
|
||||
|
||||
expect(mockSleep).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom',
|
||||
);
|
||||
});
|
||||
|
||||
it('passes immediately if packages are already on Maven', async () => {
|
||||
mockFetch.mockReturnValueOnce(Promise.resolve({status: 200}));
|
||||
|
||||
const version = '0.78.1';
|
||||
await verifyArtifactsAreOnMaven(version);
|
||||
|
||||
expect(mockSleep).toHaveBeenCalledTimes(0);
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom',
|
||||
);
|
||||
});
|
||||
|
||||
it('tries 90 times and then exits', async () => {
|
||||
mockSleep.mockReturnValue(Promise.resolve());
|
||||
mockFetch.mockReturnValue(Promise.resolve({status: 404}));
|
||||
|
||||
const version = '0.78.1';
|
||||
await verifyArtifactsAreOnMaven(version);
|
||||
|
||||
expect(mockSleep).toHaveBeenCalledTimes(90);
|
||||
expect(mockExit).toHaveBeenCalledWith(1);
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom',
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,135 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {verifyPublishedPackage} = require('../verifyPublishedPackage');
|
||||
|
||||
const mockRun = jest.fn();
|
||||
const mockSleep = jest.fn();
|
||||
const mockGetNpmPackageInfo = jest.fn();
|
||||
const silence = () => {};
|
||||
|
||||
const REACT_NATIVE_PACKAGE = 'react-native';
|
||||
|
||||
jest.mock('../utils.js', () => ({
|
||||
log: silence,
|
||||
run: mockRun,
|
||||
sleep: mockSleep,
|
||||
getNpmPackageInfo: mockGetNpmPackageInfo,
|
||||
}));
|
||||
|
||||
describe('#verifyPublishedPackage', () => {
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
it("waits on npm updating for version and not 'latest'", async () => {
|
||||
mockGetNpmPackageInfo
|
||||
// template@<version>
|
||||
.mockReturnValueOnce(Promise.reject('mock http/404'))
|
||||
.mockReturnValueOnce(Promise.resolve());
|
||||
mockSleep.mockReturnValueOnce(Promise.resolve()).mockImplementation(() => {
|
||||
throw new Error('Should not be called again!');
|
||||
});
|
||||
|
||||
const version = '0.78.0';
|
||||
await verifyPublishedPackage(REACT_NATIVE_PACKAGE, version, null);
|
||||
|
||||
expect(mockGetNpmPackageInfo).toHaveBeenLastCalledWith(
|
||||
REACT_NATIVE_PACKAGE,
|
||||
version,
|
||||
);
|
||||
});
|
||||
|
||||
it('waits on npm updating version and latest tag', async () => {
|
||||
const version = '0.78.0';
|
||||
mockGetNpmPackageInfo
|
||||
// template@latest → unknown tag
|
||||
.mockReturnValueOnce(Promise.reject('mock http/404'))
|
||||
// template@latest != version → old tag
|
||||
.mockReturnValueOnce(Promise.resolve({version: '0.76.5'}))
|
||||
// template@latest == version → correct tag
|
||||
.mockReturnValueOnce(Promise.resolve({version}));
|
||||
mockSleep
|
||||
.mockReturnValueOnce(Promise.resolve())
|
||||
.mockReturnValueOnce(Promise.resolve())
|
||||
.mockImplementation(() => {
|
||||
throw new Error('Should not be called again!');
|
||||
});
|
||||
|
||||
await verifyPublishedPackage(REACT_NATIVE_PACKAGE, version, 'latest');
|
||||
|
||||
expect(mockGetNpmPackageInfo).toHaveBeenCalledWith(
|
||||
REACT_NATIVE_PACKAGE,
|
||||
'latest',
|
||||
);
|
||||
});
|
||||
|
||||
it('waits on npm updating version and next tag', async () => {
|
||||
const version = '0.78.0-rc.0';
|
||||
mockGetNpmPackageInfo
|
||||
// template@latest → unknown tag
|
||||
.mockReturnValueOnce(Promise.reject('mock http/404'))
|
||||
// template@latest != version → old tag
|
||||
.mockReturnValueOnce(Promise.resolve({version: '0.76.5'}))
|
||||
// template@latest == version → correct tag
|
||||
.mockReturnValueOnce(Promise.resolve({version}));
|
||||
mockSleep
|
||||
.mockReturnValueOnce(Promise.resolve())
|
||||
.mockReturnValueOnce(Promise.resolve())
|
||||
.mockImplementation(() => {
|
||||
throw new Error('Should not be called again!');
|
||||
});
|
||||
await verifyPublishedPackage(REACT_NATIVE_PACKAGE, version, 'next');
|
||||
|
||||
expect(mockGetNpmPackageInfo).toHaveBeenCalledWith(
|
||||
REACT_NATIVE_PACKAGE,
|
||||
'next',
|
||||
);
|
||||
});
|
||||
|
||||
describe('timeouts', () => {
|
||||
let mockProcess;
|
||||
beforeEach(() => {
|
||||
mockProcess = jest.spyOn(process, 'exit').mockImplementation(code => {
|
||||
throw new Error(`process.exit(${code}) called!`);
|
||||
});
|
||||
});
|
||||
afterEach(() => mockProcess.mockRestore());
|
||||
it('will timeout if npm does not update package version after a set number of retries', async () => {
|
||||
const RETRIES = 2;
|
||||
mockGetNpmPackageInfo.mockReturnValue(Promise.reject('mock http/404'));
|
||||
mockSleep.mockReturnValue(Promise.resolve());
|
||||
await expect(() =>
|
||||
verifyPublishedPackage(
|
||||
REACT_NATIVE_PACKAGE,
|
||||
'0.77.0',
|
||||
'latest',
|
||||
RETRIES,
|
||||
),
|
||||
).rejects.toThrowError('process.exit(1) called!');
|
||||
expect(mockGetNpmPackageInfo).toHaveBeenCalledTimes(RETRIES);
|
||||
});
|
||||
|
||||
it('will timeout if npm does not update latest tag after a set number of retries', async () => {
|
||||
const RETRIES = 7;
|
||||
const IS_LATEST = true;
|
||||
mockGetNpmPackageInfo.mockReturnValue(
|
||||
Promise.resolve({version: '0.76.5'}),
|
||||
);
|
||||
mockSleep.mockReturnValue(Promise.resolve());
|
||||
await expect(async () => {
|
||||
await verifyPublishedPackage(
|
||||
REACT_NATIVE_PACKAGE,
|
||||
'0.77.0',
|
||||
'latest',
|
||||
RETRIES,
|
||||
);
|
||||
}).rejects.toThrowError('process.exit(1) called!');
|
||||
expect(mockGetNpmPackageInfo).toHaveBeenCalledTimes(RETRIES);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,109 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {verifyReleaseOnNpm} = require('../verifyReleaseOnNpm');
|
||||
|
||||
const mockVerifyPublishedPackage = jest.fn();
|
||||
const silence = () => {};
|
||||
|
||||
jest.mock('../utils.js', () => ({
|
||||
log: silence,
|
||||
sleep: silence,
|
||||
}));
|
||||
|
||||
jest.mock('../verifyPublishedPackage.js', () => ({
|
||||
verifyPublishedPackage: mockVerifyPublishedPackage,
|
||||
}));
|
||||
|
||||
describe('#verifyReleaseOnNPM', () => {
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
it("waits on npm updating for version and not 'latest'", async () => {
|
||||
const NOT_LATEST = false;
|
||||
const version = '0.78.0';
|
||||
await verifyReleaseOnNpm(version, NOT_LATEST);
|
||||
|
||||
expect(mockVerifyPublishedPackage).toHaveBeenLastCalledWith(
|
||||
'react-native',
|
||||
version,
|
||||
null,
|
||||
18,
|
||||
);
|
||||
});
|
||||
|
||||
it('waits on npm updating version and latest tag', async () => {
|
||||
const IS_LATEST = true;
|
||||
const version = '0.78.0';
|
||||
|
||||
await verifyReleaseOnNpm(version, IS_LATEST);
|
||||
|
||||
expect(mockVerifyPublishedPackage).toHaveBeenCalledWith(
|
||||
'react-native',
|
||||
version,
|
||||
'latest',
|
||||
18,
|
||||
);
|
||||
});
|
||||
|
||||
it('waits on npm updating version, not latest and next tag', async () => {
|
||||
const IS_LATEST = false;
|
||||
const version = '0.78.0-rc.0';
|
||||
|
||||
await verifyReleaseOnNpm(version, IS_LATEST);
|
||||
|
||||
expect(mockVerifyPublishedPackage).toHaveBeenCalledWith(
|
||||
'react-native',
|
||||
version,
|
||||
'next',
|
||||
18,
|
||||
);
|
||||
});
|
||||
|
||||
it('waits on npm updating version, latest and next tag', async () => {
|
||||
const IS_LATEST = true;
|
||||
const version = '0.78.0-rc.0';
|
||||
|
||||
await verifyReleaseOnNpm(version, IS_LATEST);
|
||||
|
||||
expect(mockVerifyPublishedPackage).toHaveBeenCalledWith(
|
||||
'react-native',
|
||||
version,
|
||||
'next',
|
||||
18,
|
||||
);
|
||||
});
|
||||
|
||||
describe('timeouts', () => {
|
||||
it('will timeout if npm does not update package version after a set number of retries', async () => {
|
||||
const RETRIES = 2;
|
||||
|
||||
(await verifyReleaseOnNpm('0.77.0', true, RETRIES),
|
||||
expect(mockVerifyPublishedPackage).toHaveBeenCalledWith(
|
||||
'react-native',
|
||||
'0.77.0',
|
||||
'latest',
|
||||
2,
|
||||
));
|
||||
});
|
||||
|
||||
it('will timeout if npm does not update latest tag after a set number of retries', async () => {
|
||||
const RETRIES = 7;
|
||||
const IS_LATEST = true;
|
||||
|
||||
await verifyReleaseOnNpm('0.77.0', IS_LATEST, RETRIES);
|
||||
|
||||
expect(mockVerifyPublishedPackage).toHaveBeenCalledWith(
|
||||
'react-native',
|
||||
'0.77.0',
|
||||
'latest',
|
||||
7,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -48,78 +48,96 @@ module.exports = async (github, context, labelWithContext) => {
|
||||
switch (labelWithContext.label) {
|
||||
case 'Type: Invalid':
|
||||
await addComment(
|
||||
`> [!CAUTION]\n` +
|
||||
`> **Invalid issue**: This issue is not valid, either is not a bug in React Native, it doesn't match any of the issue template, or we can't help further with this.`,
|
||||
`| :warning: | Issue is Invalid |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | This issue doesn't match any of the expected types for this repository - closing. |`,
|
||||
);
|
||||
await closeIssue();
|
||||
return;
|
||||
case 'Type: Question':
|
||||
await addComment(
|
||||
`> [!NOTE]\n` +
|
||||
`> **Not a bug report**: This issue looks like a question. We are using GitHub issues exclusively to track bugs in React Native. GitHub may not be the ideal place to ask a question, but you can try asking over on [Stack Overflow](http://stackoverflow.com/questions/tagged/react-native), or on [Reactiflux](https://www.reactiflux.com/).`,
|
||||
);
|
||||
await closeIssue();
|
||||
return;
|
||||
case 'Resolution: For Stack Overflow':
|
||||
await addComment(
|
||||
`> [!NOTE]\n` +
|
||||
`> **Not a bug report**: This issue looks like a question. We are using GitHub issues exclusively to track bugs in React Native. GitHub may not be the ideal place to ask a question, but you can try asking over on [Stack Overflow](http://stackoverflow.com/questions/tagged/react-native), or on [Reactiflux](https://www.reactiflux.com/).`,
|
||||
`| :warning: | Issue is a Question |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | We are using GitHub issues exclusively to track bugs in React Native. GitHub may not be the ideal place to ask a question, but you can try asking over on [Stack Overflow](http://stackoverflow.com/questions/tagged/react-native), or on [Reactiflux](https://www.reactiflux.com/). |`,
|
||||
);
|
||||
await closeIssue();
|
||||
return;
|
||||
case 'Type: Docs':
|
||||
await addComment(
|
||||
`> [!NOTE]\n` +
|
||||
`> **Docs issue**: This issue looks like an issue related to our docs. Please report documentation issues in the [react-native-website](https://github.com/facebook/react-native-website/issues) repository.`,
|
||||
`| :warning: | Documentation Issue |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | Please report documentation issues in the [react-native-website](https://github.com/facebook/react-native-website/issues) repository. |`,
|
||||
);
|
||||
await closeIssue();
|
||||
return;
|
||||
case 'Resolution: For Stack Overflow':
|
||||
await addComment(
|
||||
`| :warning: | Issue is a Question |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | We are using GitHub issues exclusively to track bugs in the core React Native library. Please try asking over on [Stack Overflow](http://stackoverflow.com/questions/tagged/react-native) as it is better suited for this type of question. |`,
|
||||
);
|
||||
await closeIssue();
|
||||
return;
|
||||
case 'Type: Expo':
|
||||
await addComment(
|
||||
`> [!NOTE]\n` +
|
||||
`> **Expo related**: It looks like your issue is related to Expo and not React Native core. Please open your issue in [Expo's repository](https://github.com/expo/expo/issues/new). If you are able to create a repro that showcases that this issue is also happening in React Native vanilla, we will be happy to re-open.`,
|
||||
`| :warning: | Issue is Related to Expo |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | It looks like your issue is related to Expo and not React Native core. Please open your issue in [Expo's repository](https://github.com/expo/expo/issues/new). If you are able to create a repro that showcases that this issue is also happening in React Native vanilla, we will be happy to re-open. |`,
|
||||
);
|
||||
await closeIssue();
|
||||
return;
|
||||
case 'Needs: Issue Template':
|
||||
await addComment(
|
||||
`> [!WARNING]\n` +
|
||||
`> **Missing issue template**: It looks like your issue may be missing some necessary information. GitHub provides an example template whenever a [new issue is created](https://github.com/facebook/react-native/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A&projects=&template=bug_report.yml). Could you go back and make sure to fill out the template? You may edit this issue, or close it and open a new one.`,
|
||||
`| :warning: | Missing Required Fields |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | It looks like your issue may be missing some necessary information. GitHub provides an example template whenever a [new issue is created](https://github.com/facebook/react-native/issues/new?template=bug_report.md). Could you go back and make sure to fill out the template? You may edit this issue, or close it and open a new one. |`,
|
||||
);
|
||||
await requestAuthorFeedback();
|
||||
return;
|
||||
case 'Needs: Environment Info':
|
||||
await addComment(
|
||||
`> [!WARNING]\n` +
|
||||
`> **Missing info**: It looks like your issue may be missing information about your development environment. You can obtain the missing information by running <code>react-native info</code> in a console.`,
|
||||
`| :warning: | Missing Environment Information |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | Your issue may be missing information about your development environment. You can obtain the missing information by running <code>react-native info</code> in a console. |`,
|
||||
);
|
||||
await requestAuthorFeedback();
|
||||
return;
|
||||
case 'Newer Patch Available':
|
||||
await addComment(
|
||||
`| :warning: | Newer Version of React Native is Available! |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | You are on a supported minor version, but it looks like there's a newer patch available - ${labelWithContext.newestPatch}. Please [upgrade](https://reactnative.dev/docs/upgrading) to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |`,
|
||||
);
|
||||
return;
|
||||
case 'Needs: Version Info':
|
||||
await addComment(
|
||||
`> [!WARNING]\n` +
|
||||
`> **Could not parse version**: We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.76.2.`,
|
||||
`| :warning: | Add or Reformat Version Info |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.70.2 |`,
|
||||
);
|
||||
await requestAuthorFeedback();
|
||||
return;
|
||||
case 'Needs: Repro':
|
||||
await addComment(
|
||||
`> [!WARNING]\n` +
|
||||
`> **Missing reproducer**: We could not detect a reproducible example in your issue report. Reproducers are **mandatory** and we can accept only one of those as a valid reproducer: <br/><ul><li>For majority of bugs: send us a Pull Request with the [RNTesterPlayground.js](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/Playground/RNTesterPlayground.js) edited to reproduce your bug.</li><li>If your bug is UI related: a [Snack](https://snack.expo.dev)</li><li> If your bug is build/upgrade related: a project using our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate)</li></ul><br/>You can read more about about it on our website: [How to report a bug](https://reactnative.dev/contributing/how-to-report-a-bug).`,
|
||||
`| :warning: | Missing Reproducible Example |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | We could not detect a reproducible example in your issue report. Please provide either: <br /><ul><li>If your bug is UI related: a [Snack](https://snack.expo.dev)</li><li> If your bug is build/update related: use our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate)</li></ul> |`,
|
||||
);
|
||||
await requestAuthorFeedback();
|
||||
return;
|
||||
case 'Type: Unsupported Version':
|
||||
await addComment(
|
||||
`> [!WARNING]\n` +
|
||||
`> **Unsupported version**: It looks like your issue or the example you provided uses an [unsupported version of React Native](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md).<br/><br/>Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please [upgrade](https://reactnative.dev/docs/upgrading) to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on [StackOverflow](https://stackoverflow.com/questions/tagged/react-native) to get further community support.`,
|
||||
`| :warning: | Unsupported Version of React Native |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | It looks like your issue or the example you provided uses an [unsupported version of React Native](https://github.com/reactwg/react-native-releases/blob/main/README.md#releases-support-policy).<br/><br/>Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please [upgrade](https://reactnative.dev/docs/upgrading) to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on [StackOverflow](https://stackoverflow.com/questions/tagged/react-native) to get further community support. |`,
|
||||
);
|
||||
await requestAuthorFeedback();
|
||||
return;
|
||||
case 'Type: Too Old Version':
|
||||
await addComment(
|
||||
`> [!CAUTION]\n` +
|
||||
`> **Too old version**: It looks like your issue or the example you provided uses a [**Too Old Version of React Native**](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md).<br/><br/>Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please [upgrade](https://reactnative.dev/docs/upgrading) to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on [StackOverflow](https://stackoverflow.com/questions/tagged/react-native) to get further community support.`,
|
||||
`| :warning: | Too Old Version of React Native |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | It looks like your issue or the example you provided uses a [**Too Old Version of React Native**](https://github.com/reactwg/react-native-releases/blob/main/README.md#releases-support-policy).<br/><br/>Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please [upgrade](https://reactnative.dev/docs/upgrading) to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on [StackOverflow](https://stackoverflow.com/questions/tagged/react-native) to get further community support. |`,
|
||||
);
|
||||
await closeIssue();
|
||||
return;
|
||||
|
||||
@@ -149,5 +149,6 @@ const topics = {
|
||||
'react-native-cli': labelCli,
|
||||
'react-native upgrade': labelCli,
|
||||
'react-native link': labelCli,
|
||||
'local-cli': labelCli,
|
||||
regression: labelRegression,
|
||||
};
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
export GITHUB_OWNER=-facebook
|
||||
export GITHUB_REPO=-react-native
|
||||
|
||||
{
|
||||
echo eslint
|
||||
npm run lint --silent -- --format=json
|
||||
|
||||
echo flow
|
||||
npm run flow-check --silent --json
|
||||
} | node private/react-native-bots/code-analysis-bot.js
|
||||
|
||||
STATUS=$?
|
||||
if [ $STATUS == 0 ]; then
|
||||
echo "Code analyzed successfully."
|
||||
else
|
||||
echo "Code analysis failed, error status $STATUS."
|
||||
fi
|
||||
exit $STATUS
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
GITHUB_OWNER=-facebook
|
||||
GITHUB_REPO=-react-native
|
||||
export GITHUB_OWNER
|
||||
export GITHUB_REPO
|
||||
|
||||
if [ -x "$(command -v shellcheck)" ]; then
|
||||
IFS=$'\n'
|
||||
|
||||
find . \
|
||||
-type f \
|
||||
-not -path "*node_modules*" \
|
||||
-not -path "*third-party*" \
|
||||
-name '*.sh' \
|
||||
-exec sh -c 'shellcheck "$1"' -- {} \;
|
||||
|
||||
else
|
||||
echo 'shellcheck is not installed. See https://github.com/facebook/react-native/wiki/Development-Dependencies#shellcheck for instructions.'
|
||||
exit 1
|
||||
fi
|
||||
@@ -9,6 +9,11 @@
|
||||
|
||||
const NEEDS_REPRO_LABEL = 'Needs: Repro';
|
||||
const NEEDS_AUTHOR_FEEDBACK_LABEL = 'Needs: Author Feedback';
|
||||
const NEEDS_REPRO_HEADER = 'Missing Reproducible Example';
|
||||
const NEEDS_REPRO_MESSAGE =
|
||||
`| :warning: | Missing Reproducible Example |\n` +
|
||||
`| --- | --- |\n` +
|
||||
`| :information_source: | We could not detect a reproducible example in your issue report. Please provide either: <br /><ul><li>If your bug is UI related: a [Snack](https://snack.expo.dev)</li><li> If your bug is build/update related: use our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate). A reproducer needs to be in a GitHub repository under your username.</li></ul> |`;
|
||||
const SKIP_ISSUES_OLDER_THAN = '2023-07-01T00:00:00Z';
|
||||
|
||||
module.exports = async (github, context) => {
|
||||
@@ -20,6 +25,7 @@ module.exports = async (github, context) => {
|
||||
|
||||
const issue = await github.rest.issues.get(issueData);
|
||||
const comments = await github.rest.issues.listComments(issueData);
|
||||
|
||||
const author = issue.data.user.login;
|
||||
|
||||
const issueDate = issue.data.created_at;
|
||||
@@ -37,15 +43,14 @@ module.exports = async (github, context) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const botComment = comments.data.find(comment =>
|
||||
comment.body.includes(NEEDS_REPRO_HEADER),
|
||||
);
|
||||
|
||||
const entities = [issue.data, ...comments.data];
|
||||
|
||||
// Look for Snack or a GH repo associated with the user that added an issue or comment
|
||||
const hasValidReproducer = entities.some(entity => {
|
||||
const hasPullRequestRepoLink = containsPattern(
|
||||
entity.body,
|
||||
`https?:\/\/github\.com\/facebook\/react-native\/pull\/\d+\/?`,
|
||||
);
|
||||
|
||||
const hasExpoSnackLink = containsPattern(
|
||||
entity.body,
|
||||
`https?:\\/\\/snack\\.expo\\.dev\\/[^\\s)\\]]+`,
|
||||
@@ -55,7 +60,7 @@ module.exports = async (github, context) => {
|
||||
entity.body,
|
||||
`https?:\\/\\/github\\.com\\/(${entity.user.login})\\/[^/]+\\/?\\s?`,
|
||||
);
|
||||
return hasPullRequestRepoLink || hasExpoSnackLink || hasGithubRepoLink;
|
||||
return hasExpoSnackLink || hasGithubRepoLink;
|
||||
});
|
||||
|
||||
if (hasValidReproducer) {
|
||||
@@ -69,11 +74,25 @@ module.exports = async (github, context) => {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (!botComment) return;
|
||||
|
||||
await github.rest.issues.deleteComment({
|
||||
...issueData,
|
||||
comment_id: botComment.id,
|
||||
});
|
||||
} else {
|
||||
await github.rest.issues.addLabels({
|
||||
...issueData,
|
||||
labels: [NEEDS_REPRO_LABEL, NEEDS_AUTHOR_FEEDBACK_LABEL],
|
||||
});
|
||||
|
||||
if (botComment) return;
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
...issueData,
|
||||
body: NEEDS_REPRO_MESSAGE,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -82,7 +101,7 @@ function containsPattern(body, pattern) {
|
||||
return body.search(regexp) !== -1;
|
||||
}
|
||||
|
||||
// Prevents the bot from responding when maintainer has changed the 'Needs: Repro' label
|
||||
// Prevents the bot from responding when maintainer has changed Needs: Repro the label
|
||||
async function hasMaintainerChangedLabel(github, issueData, author) {
|
||||
const timeline = await github.rest.issues.listEventsForTimeline(issueData);
|
||||
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {log, run} = require('./utils');
|
||||
const fs = require('fs');
|
||||
|
||||
function _headers(token) {
|
||||
return {
|
||||
Accept: 'Accept: application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
}
|
||||
|
||||
function _extractChangelog(version) {
|
||||
if (version.endsWith('.0')) {
|
||||
// for RC.0 and for the release of a new stable minor, the changelog is too long
|
||||
// to be added in a release. The release body is usually something shorter.
|
||||
// See for example the release for 0.76.0 or 0.77.0:
|
||||
// 0.76: https://github.com/facebook/react-native/releases/tag/v0.76.0
|
||||
// 0.77: https://github.com/facebook/react-native/releases/tag/v0.77.0
|
||||
return '';
|
||||
}
|
||||
const changelog = String(fs.readFileSync('CHANGELOG.md', 'utf8')).split('\n');
|
||||
const changelogStarts = changelog.indexOf(`## v${version}`);
|
||||
let changelogEnds = changelogStarts;
|
||||
// Scan the changelog to find the next version
|
||||
for (var line = changelogStarts + 1; line < changelog.length; line++) {
|
||||
if (changelog[line].startsWith('## ')) {
|
||||
changelogEnds = line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return changelog.slice(changelogStarts, changelogEnds).join('\n').trim();
|
||||
}
|
||||
|
||||
function _computeBody(changelog, version, hermesVersion, hermesV1Version) {
|
||||
hermesVersion = hermesVersion ?? version;
|
||||
hermesV1Version = hermesV1Version ?? version;
|
||||
return `${changelog}
|
||||
|
||||
---
|
||||
|
||||
Hermes dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesVersion}/hermes-ios-${hermesVersion}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
Hermes V1 dSYMS:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/hermes/hermes-ios/${hermesV1Version}/hermes-ios-${hermesV1Version}-hermes-framework-dSYM-release.tar.gz)
|
||||
|
||||
ReactNativeDependencies dSYMs:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-dSYM-release.tar.gz)
|
||||
|
||||
ReactNative Core dSYMs:
|
||||
- [Debug](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-core-debug.tar.gz)
|
||||
- [Release](https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-core-release.tar.gz)
|
||||
|
||||
---
|
||||
|
||||
You can file issues or pick requests against this release [here](https://github.com/reactwg/react-native-releases/issues/new/choose).
|
||||
|
||||
---
|
||||
|
||||
To help you upgrade to this version, you can use the [Upgrade Helper](https://react-native-community.github.io/upgrade-helper/) ⚛️.
|
||||
|
||||
---
|
||||
|
||||
View the whole changelog in the [CHANGELOG.md file](https://github.com/facebook/react-native/blob/main/CHANGELOG.md).`;
|
||||
}
|
||||
|
||||
async function _verifyTagExists(version) {
|
||||
const url = `https://github.com/facebook/react-native/releases/tag/v${version}`;
|
||||
|
||||
const response = await fetch(url);
|
||||
if (response.status === 404) {
|
||||
throw new Error(`Tag v${version} does not exist`);
|
||||
}
|
||||
}
|
||||
|
||||
async function _createDraftReleaseOnGitHub(version, body, latest, token) {
|
||||
const url = 'https://api.github.com/repos/facebook/react-native/releases';
|
||||
const method = 'POST';
|
||||
const headers = _headers(token);
|
||||
const fetchBody = JSON.stringify({
|
||||
tag_name: `v${version}`,
|
||||
name: `${version}`,
|
||||
body: body,
|
||||
draft: true, // NEVER CHANGE this value to false. If false, it will publish the release, and send a GH notification to all the subscribers.
|
||||
prerelease: version.includes('-rc.') ? true : false,
|
||||
make_latest: `${latest}`,
|
||||
});
|
||||
|
||||
const response = await fetch(url, {
|
||||
method,
|
||||
headers,
|
||||
body: fetchBody,
|
||||
});
|
||||
|
||||
if (response.status !== 201) {
|
||||
throw new Error(
|
||||
`Failed to create the release: ${response.status} ${response.statusText}`,
|
||||
);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
const {html_url, id} = data;
|
||||
return {
|
||||
html_url,
|
||||
id,
|
||||
};
|
||||
}
|
||||
|
||||
function moveToChangelogBranch(version) {
|
||||
log(`Moving to changelog branch: changelog/v${version}`);
|
||||
run(`git checkout -b changelog/v${version}`);
|
||||
}
|
||||
|
||||
async function createDraftRelease(
|
||||
version,
|
||||
latest,
|
||||
token,
|
||||
hermesVersion,
|
||||
hermesV1Version,
|
||||
) {
|
||||
if (version.startsWith('v')) {
|
||||
version = version.substring(1);
|
||||
}
|
||||
|
||||
_verifyTagExists(version);
|
||||
moveToChangelogBranch(version);
|
||||
const changelog = _extractChangelog(version);
|
||||
const body = _computeBody(changelog, version, hermesVersion, hermesV1Version);
|
||||
const release = await _createDraftReleaseOnGitHub(
|
||||
version,
|
||||
body,
|
||||
latest,
|
||||
token,
|
||||
);
|
||||
log(`Created draft release: ${release.html_url}, ID ${release.id}`);
|
||||
return release;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createDraftRelease,
|
||||
// Exported for testing purposes
|
||||
_verifyTagExists,
|
||||
_extractChangelog,
|
||||
_computeBody,
|
||||
_createDraftReleaseOnGitHub,
|
||||
};
|
||||
@@ -1,86 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const MSEC_IN_DAY = 1000 * 60 * 60 * 24;
|
||||
|
||||
function formatUsers(users) {
|
||||
console.log(`${users[0]} ${users[1]}`.trim());
|
||||
}
|
||||
|
||||
function extractUsersFromScheduleAndDate(schedule, userMap, date) {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1; // 0 is January, 1 is February
|
||||
const day = date.getDate();
|
||||
const dateStr = `${year}-${month < 10 ? `0${month}` : month}-${day < 10 ? `0${day}` : day}`;
|
||||
const user1 = userMap[schedule[dateStr][0]];
|
||||
const user2 = userMap[schedule[dateStr][1]];
|
||||
return [user1, user2];
|
||||
}
|
||||
|
||||
/**
|
||||
* You can invoke this script by doing:
|
||||
* ```
|
||||
* node .github/workflow-scripts/extractIssueOncalls.js $DATA
|
||||
* ```
|
||||
*
|
||||
* the $DATA is stored in the github secrets as ONCALL_SCHEDULE variable.
|
||||
* The format of the data is:
|
||||
* ```
|
||||
* {
|
||||
* \"userMap\": {
|
||||
* \"discord_handle1\": \"discord_id1\",
|
||||
* \"discord_handle2\": \"discord_id2\",
|
||||
* ...
|
||||
* },
|
||||
* \"schedule\": {
|
||||
* \"2025-07-29\": [\"discord_handle1\", \"discord_handle2\"],
|
||||
* \"2025-08-05\": [\"discord_handle3\", \"discord_handle4\"],
|
||||
* ...
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* When uploading the secret, make sure that the JSON strings are escaped!
|
||||
* The script will fail otherwise, because GitHub will remove the `"` characters.
|
||||
*/
|
||||
function main() {
|
||||
const configuration = process.argv[2];
|
||||
const {userMap, schedule} = JSON.parse(configuration);
|
||||
extractIssueOncalls(schedule, userMap);
|
||||
}
|
||||
|
||||
function extractIssueOncalls(schedule, userMap) {
|
||||
const now = new Date();
|
||||
const dayOfTheWeek = now.getDay(); // 0 is Sunday, 1 is Monday, etc.
|
||||
let users;
|
||||
if (dayOfTheWeek === 2) {
|
||||
// exact match in the schedule
|
||||
users = extractUsersFromScheduleAndDate(schedule, userMap, now);
|
||||
} else if (dayOfTheWeek < 2) {
|
||||
// sunday
|
||||
// go to the tuesday of the last week
|
||||
const lastWeekTuesday = new Date(now - (5 + dayOfTheWeek) * MSEC_IN_DAY);
|
||||
users = extractUsersFromScheduleAndDate(schedule, userMap, lastWeekTuesday);
|
||||
} else if (dayOfTheWeek > 1) {
|
||||
// go to the previous tuesday
|
||||
const thisWeekTuesday = new Date(now - (dayOfTheWeek - 2) * MSEC_IN_DAY);
|
||||
users = extractUsersFromScheduleAndDate(schedule, userMap, thisWeekTuesday);
|
||||
}
|
||||
formatUsers(users);
|
||||
return users;
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
void main();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
extractIssueOncalls,
|
||||
};
|
||||
@@ -1,120 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {log, getNpmPackageInfo, run} = require('./utils');
|
||||
|
||||
async function _computePreviousVersionFrom(version) {
|
||||
log(`Computing previous version from: ${version}`);
|
||||
const regex = /^0\.(\d+)\.(\d+)(-rc\.(\d+))?$/;
|
||||
const match = version.match(regex);
|
||||
if (!match) {
|
||||
throw new Error(`Invalid version format: ${version}`);
|
||||
}
|
||||
|
||||
const minor = match[1];
|
||||
const patch = match[2];
|
||||
const rc = match[4];
|
||||
|
||||
if (rc) {
|
||||
if (Number(rc) > 0) {
|
||||
return `0.${minor}.${patch}-rc.${Number(rc) - 1}`;
|
||||
}
|
||||
//fetch latest version on NPM
|
||||
const latestPkg = await getNpmPackageInfo('react-native', 'latest');
|
||||
return latestPkg.version;
|
||||
} else {
|
||||
if (Number(patch) === 0) {
|
||||
// No need to generate the changelog for 0.X.0 as we already generated it from RCs
|
||||
log(
|
||||
`Skipping changelog generation for ${version} as we already have it from the RCs`,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
return `0.${minor}.${Number(patch) - 1}`;
|
||||
}
|
||||
}
|
||||
|
||||
function _generateChangelog(previousVersion, version, token) {
|
||||
log(`Generating changelog for ${version} from ${previousVersion}`);
|
||||
run('git checkout main');
|
||||
run('git fetch');
|
||||
run('git pull origin main');
|
||||
const generateChangelogComand = `npx @rnx-kit/rn-changelog-generator --base v${previousVersion} --compare v${version} --repo . --changelog ./CHANGELOG.md --token ${token}`;
|
||||
run(generateChangelogComand);
|
||||
}
|
||||
|
||||
function _pushCommit(version) {
|
||||
log(`Pushing commit to changelog/v${version}`);
|
||||
run(`git checkout -b changelog/v${version}`);
|
||||
run('git add CHANGELOG.md');
|
||||
run(`git commit -m "[RN][Changelog] Add changelog for v${version}"`);
|
||||
run(`git push origin changelog/v${version}`);
|
||||
}
|
||||
|
||||
async function _createPR(version, token) {
|
||||
log('Creating changelog pr');
|
||||
const url = 'https://api.github.com/repos/facebook/react-native/pulls';
|
||||
const body = `
|
||||
## Summary
|
||||
Add Changelog for ${version}
|
||||
|
||||
## Changelog:
|
||||
[Internal] - Add Changelog for ${version}
|
||||
|
||||
## Test Plan:
|
||||
N/A`;
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'Accept: application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title: `[RN][Changelog] Add changelog for v${version}`,
|
||||
head: `changelog/v${version}`,
|
||||
base: 'main',
|
||||
body: body,
|
||||
}),
|
||||
});
|
||||
|
||||
if (response.status !== 201) {
|
||||
throw new Error(
|
||||
`Failed to create PR: ${response.status} ${response.statusText}`,
|
||||
);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
return data.html_url;
|
||||
}
|
||||
|
||||
async function generateChangelog(version, token) {
|
||||
if (version.startsWith('v')) {
|
||||
version = version.substring(1);
|
||||
}
|
||||
|
||||
const previousVersion = await _computePreviousVersionFrom(version);
|
||||
if (previousVersion) {
|
||||
log(`Previous version is ${previousVersion}`);
|
||||
_generateChangelog(previousVersion, version, token);
|
||||
_pushCommit(version);
|
||||
const prURL = await _createPR(version, token);
|
||||
log(`Created PR: ${prURL}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generateChangelog,
|
||||
// Exported only for testing purposes:
|
||||
_computePreviousVersionFrom,
|
||||
_generateChangelog,
|
||||
_pushCommit,
|
||||
_createPR,
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
set -e
|
||||
|
||||
if git ls-files | grep -E '\.npmignore$'; then
|
||||
echo "Error: Found unexpected .npmignore file(s). Please use package.json#files instead."
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,152 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const childProcess = require('child_process');
|
||||
const fs = require('fs');
|
||||
|
||||
const usage = `
|
||||
=== Usage ===
|
||||
node maestro-android.js <path to app> <app_id> <maestro_flow> <flavor> <working_directory>
|
||||
|
||||
@param {string} appPath - Path to the app APK
|
||||
@param {string} appId - App ID that needs to be launched
|
||||
@param {string} maestroFlow - Path to the maestro flow to be executed
|
||||
@param {string} flavor - Flavor of the app to be launched. Can be 'release' or 'debug'
|
||||
@param {string} workingDirectory - Working directory from where to run Metro
|
||||
==============
|
||||
`;
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
if (args.length !== 5) {
|
||||
throw new Error(`Invalid number of arguments.\n${usage}`);
|
||||
}
|
||||
|
||||
const APP_PATH = args[0];
|
||||
const APP_ID = args[1];
|
||||
const MAESTRO_FLOW = args[2];
|
||||
const IS_DEBUG = args[3] === 'debug';
|
||||
const WORKING_DIRECTORY = args[4];
|
||||
|
||||
const MAX_ATTEMPTS = 3;
|
||||
|
||||
async function executeFlowWithRetries(flow, currentAttempt) {
|
||||
try {
|
||||
console.info(`Executing flow: ${flow}`);
|
||||
const timeout = 1000 * 60 * 10; // 10 minutes
|
||||
childProcess.execSync(
|
||||
`MAESTRO_DRIVER_STARTUP_TIMEOUT=120000 $HOME/.maestro/bin/maestro test ${flow} --format junit -e APP_ID=${APP_ID} --debug-output /tmp/MaestroLogs`,
|
||||
{stdio: 'inherit', timeout},
|
||||
);
|
||||
} catch (err) {
|
||||
if (currentAttempt < MAX_ATTEMPTS) {
|
||||
console.info(`Retrying...`);
|
||||
await executeFlowWithRetries(flow, currentAttempt + 1);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function executeFlowInFolder(flowFolder) {
|
||||
const files = fs.readdirSync(flowFolder);
|
||||
for (const file of files) {
|
||||
const filePath = `${flowFolder}/${file}`;
|
||||
if (fs.lstatSync(filePath).isDirectory()) {
|
||||
await executeFlowInFolder(filePath);
|
||||
} else {
|
||||
await executeFlowWithRetries(filePath, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.info('\n==============================');
|
||||
console.info('Running tests for Android with the following parameters:');
|
||||
console.info(`APP_PATH: ${APP_PATH}`);
|
||||
console.info(`APP_ID: ${APP_ID}`);
|
||||
console.info(`MAESTRO_FLOW: ${MAESTRO_FLOW}`);
|
||||
console.info(`IS_DEBUG: ${IS_DEBUG}`);
|
||||
console.info(`WORKING_DIRECTORY: ${WORKING_DIRECTORY}`);
|
||||
console.info('==============================\n');
|
||||
|
||||
console.info('Install app');
|
||||
childProcess.execSync(`adb install ${APP_PATH}`, {stdio: 'ignore'});
|
||||
|
||||
let metroProcess = null;
|
||||
if (IS_DEBUG) {
|
||||
console.info('Start Metro');
|
||||
childProcess.execSync(`cd ${WORKING_DIRECTORY}`, {stdio: 'ignore'});
|
||||
metroProcess = childProcess.spawn('yarn', ['start', '&'], {
|
||||
cwd: WORKING_DIRECTORY,
|
||||
stdio: 'ignore',
|
||||
detached: true,
|
||||
});
|
||||
metroProcess.unref();
|
||||
console.info(`- Metro PID: ${metroProcess.pid}`);
|
||||
|
||||
console.info('Wait For Metro to Start');
|
||||
await sleep(5000);
|
||||
}
|
||||
|
||||
console.info('Start the app');
|
||||
childProcess.execSync(`adb shell monkey -p ${APP_ID} 1`, {stdio: 'ignore'});
|
||||
|
||||
if (IS_DEBUG) {
|
||||
console.info('Wait For App to warm from Metro');
|
||||
await sleep(10000);
|
||||
}
|
||||
|
||||
console.info('Start recording to /sdcard/screen.mp4');
|
||||
childProcess
|
||||
.exec('adb shell screenrecord /sdcard/screen.mp4', {
|
||||
stdio: 'ignore',
|
||||
detached: true,
|
||||
})
|
||||
.unref();
|
||||
|
||||
console.info(`Start testing ${MAESTRO_FLOW}`);
|
||||
let error = null;
|
||||
try {
|
||||
//check if MAESTRO_FLOW is a folder
|
||||
if (
|
||||
fs.existsSync(MAESTRO_FLOW) &&
|
||||
fs.lstatSync(MAESTRO_FLOW).isDirectory()
|
||||
) {
|
||||
await executeFlowInFolder(MAESTRO_FLOW);
|
||||
} else {
|
||||
await executeFlowWithRetries(MAESTRO_FLOW, 0);
|
||||
}
|
||||
} catch (err) {
|
||||
error = err;
|
||||
} finally {
|
||||
console.info('Stop recording');
|
||||
childProcess.execSync('adb pull /sdcard/screen.mp4', {stdio: 'ignore'});
|
||||
|
||||
if (IS_DEBUG && metroProcess != null) {
|
||||
const pid = metroProcess.pid;
|
||||
console.info(`Kill Metro. PID: ${pid}`);
|
||||
process.kill(pid);
|
||||
console.info(`Metro Killed`);
|
||||
}
|
||||
}
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
process.exit();
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -1,176 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const childProcess = require('child_process');
|
||||
const fs = require('fs');
|
||||
|
||||
const usage = `
|
||||
=== Usage ===
|
||||
node maestro-android.js <path to app> <app_id> <maestro_flow> <flavor> <working_directory>
|
||||
|
||||
@param {string} appPath - Path to the app APK
|
||||
@param {string} appId - App ID that needs to be launched
|
||||
@param {string} maestroFlow - Path to the maestro flow to be executed
|
||||
@param {string} jsengine - The JSEngine to use for the test
|
||||
@param {string} flavor - Flavor of the app to be launched. Can be 'Release' or 'Debug'
|
||||
@param {string} workingDirectory - Working directory from where to run Metro
|
||||
==============
|
||||
`;
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
if (args.length !== 6) {
|
||||
throw new Error(`Invalid number of arguments.\n${usage}`);
|
||||
}
|
||||
|
||||
const APP_PATH = args[0];
|
||||
const APP_ID = args[1];
|
||||
const MAESTRO_FLOW = args[2];
|
||||
const JS_ENGINE = args[3];
|
||||
const IS_DEBUG = args[4] === 'Debug';
|
||||
const WORKING_DIRECTORY = args[5];
|
||||
|
||||
const MAX_ATTEMPTS = 5;
|
||||
|
||||
function launchSimulator(simulatorName) {
|
||||
console.log(`Launching simulator ${simulatorName}`);
|
||||
try {
|
||||
childProcess.execSync(`xcrun simctl boot "${simulatorName}"`);
|
||||
} catch (error) {
|
||||
if (
|
||||
!error.message.includes('Unable to boot device in current state: Booted')
|
||||
) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function installAppOnSimulator(appPath) {
|
||||
console.log(`Installing app at path ${appPath}`);
|
||||
childProcess.execSync(`xcrun simctl install booted "${appPath}"`);
|
||||
}
|
||||
|
||||
function extractSimulatorUDID() {
|
||||
console.log('Retrieving device UDID');
|
||||
const command = `xcrun simctl list devices booted -j | jq -r '[.devices[]] | add | first | .udid'`;
|
||||
const udid = String(childProcess.execSync(command)).trim();
|
||||
console.log(`UDID is ${udid}`);
|
||||
return udid;
|
||||
}
|
||||
|
||||
function bringSimulatorInForeground() {
|
||||
console.log('Bringing simulator in foreground');
|
||||
childProcess.execSync('open -a simulator');
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
async function launchAppOnSimulator(appId, udid, isDebug) {
|
||||
console.log('Launch the app');
|
||||
childProcess.execSync(`xcrun simctl launch "${udid}" "${appId}"`);
|
||||
|
||||
if (isDebug) {
|
||||
console.log('Wait for metro to warm');
|
||||
await sleep(20 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function startVideoRecording(jsengine, currentAttempt) {
|
||||
console.log(
|
||||
`Start video record using pid: video_record_${currentAttempt}.pid`,
|
||||
);
|
||||
|
||||
const recordingArgs =
|
||||
`simctl io booted recordVideo video_record_${currentAttempt}.mov`.split(
|
||||
' ',
|
||||
);
|
||||
const recordingProcess = childProcess.spawn('xcrun', recordingArgs, {
|
||||
detached: true,
|
||||
stdio: 'ignore',
|
||||
});
|
||||
|
||||
return recordingProcess;
|
||||
}
|
||||
|
||||
function stopVideoRecording(recordingProcess) {
|
||||
if (!recordingProcess) {
|
||||
console.log("Passed a null recording process. Can't kill it");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Stop video record using pid: ${recordingProcess.pid}`);
|
||||
|
||||
recordingProcess.kill('SIGINT');
|
||||
}
|
||||
|
||||
function executeTestsWithRetries(
|
||||
appId,
|
||||
udid,
|
||||
maestroFlow,
|
||||
jsengine,
|
||||
currentAttempt,
|
||||
) {
|
||||
const recProcess = startVideoRecording(jsengine, currentAttempt);
|
||||
try {
|
||||
const timeout = 1000 * 60 * 10; // 10 minutes
|
||||
const command = `$HOME/.maestro/bin/maestro --udid="${udid}" test "${maestroFlow}" --format junit -e APP_ID="${appId}"`;
|
||||
console.log(command);
|
||||
childProcess.execSync(`MAESTRO_DRIVER_STARTUP_TIMEOUT=1500000 ${command}`, {
|
||||
stdio: 'inherit',
|
||||
timeout,
|
||||
});
|
||||
|
||||
stopVideoRecording(recProcess);
|
||||
} catch (error) {
|
||||
// Can't put this in the finally block because it will be executed after the
|
||||
// recursive call of executeTestsWithRetries
|
||||
stopVideoRecording(recProcess);
|
||||
|
||||
if (currentAttempt < MAX_ATTEMPTS) {
|
||||
executeTestsWithRetries(
|
||||
appId,
|
||||
udid,
|
||||
maestroFlow,
|
||||
jsengine,
|
||||
currentAttempt + 1,
|
||||
);
|
||||
} else {
|
||||
console.error(`Failed to execute flow after ${MAX_ATTEMPTS} attempts.`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.info('\n==============================');
|
||||
console.info('Running tests for iOS with the following parameters:');
|
||||
console.info(`APP_PATH: ${APP_PATH}`);
|
||||
console.info(`APP_ID: ${APP_ID}`);
|
||||
console.info(`MAESTRO_FLOW: ${MAESTRO_FLOW}`);
|
||||
console.info(`JS_ENGINE: ${JS_ENGINE}`);
|
||||
console.info(`IS_DEBUG: ${IS_DEBUG}`);
|
||||
console.info(`WORKING_DIRECTORY: ${WORKING_DIRECTORY}`);
|
||||
console.info('==============================\n');
|
||||
|
||||
const simulatorName = 'iPhone 16 Pro';
|
||||
launchSimulator(simulatorName);
|
||||
installAppOnSimulator(APP_PATH);
|
||||
const udid = extractSimulatorUDID();
|
||||
bringSimulatorInForeground();
|
||||
await launchAppOnSimulator(APP_ID, udid, IS_DEBUG);
|
||||
executeTestsWithRetries(APP_ID, udid, MAESTRO_FLOW, JS_ENGINE, 1);
|
||||
console.log('Test finished');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -1,85 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {run, sleep, log} = require('./utils.js');
|
||||
const {verifyPublishedPackage} = require('./verifyPublishedPackage.js');
|
||||
|
||||
const TAG_AS_LATEST_REGEX = /#publish-packages-to-npm&latest/;
|
||||
|
||||
/**
|
||||
* Should this commit be `latest` on npm?
|
||||
*/
|
||||
function isLatest() {
|
||||
const commitMessage = run('git log -n1 --pretty=%B');
|
||||
return TAG_AS_LATEST_REGEX.test(commitMessage);
|
||||
}
|
||||
module.exports.isLatest = isLatest;
|
||||
|
||||
/**
|
||||
* Create a Github Action to publish the community template matching the released version
|
||||
* of React Native.
|
||||
*/
|
||||
module.exports.publishTemplate = async (github, version, dryRun = true) => {
|
||||
log(`📤 Get the ${TEMPLATE_NPM_PKG} repo to publish ${version}`);
|
||||
|
||||
const is_latest_on_npm = isLatest();
|
||||
|
||||
const majorMinor = /^v?(\d+\.\d+)/.exec(version);
|
||||
|
||||
if (!majorMinor) {
|
||||
log(`🔥 can't capture MAJOR.MINOR from '${version}', giving up.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// MAJOR.MINOR-stable
|
||||
const ref = `${majorMinor[1]}-stable`;
|
||||
|
||||
await github.rest.actions.createWorkflowDispatch({
|
||||
owner: 'react-native-community',
|
||||
repo: 'template',
|
||||
workflow_id: 'release.yaml',
|
||||
ref,
|
||||
inputs: {
|
||||
dry_run: dryRun,
|
||||
is_latest_on_npm,
|
||||
// 0.75.0-rc.0, note no 'v' prefix
|
||||
version: version.replace(/^v/, ''),
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const MAX_RETRIES = 3 * 6; // 18 attempts. Waiting between attempt: 10 s. Total time: 3 mins.
|
||||
const TEMPLATE_NPM_PKG = '@react-native-community/template';
|
||||
|
||||
/**
|
||||
* Will verify that @latest and the @<version> have been published.
|
||||
*
|
||||
* NOTE: This will infinitely query each step until successful, make sure the
|
||||
* calling job has a timeout.
|
||||
*/
|
||||
module.exports.verifyPublishedTemplate = async (
|
||||
version,
|
||||
latest = false,
|
||||
retries = MAX_RETRIES,
|
||||
) => {
|
||||
try {
|
||||
if (version.startsWith('v')) {
|
||||
version = version.slice(1);
|
||||
}
|
||||
await verifyPublishedPackage(
|
||||
TEMPLATE_NPM_PKG,
|
||||
version,
|
||||
latest ? 'latest' : null,
|
||||
retries,
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {execSync} = require('child_process');
|
||||
|
||||
const log = (...args) => console.log(...args);
|
||||
|
||||
async function getNpmPackageInfo(pkg, versionOrTag) {
|
||||
return fetch(`https://registry.npmjs.org/${pkg}/${versionOrTag}`).then(resp =>
|
||||
resp.json(),
|
||||
);
|
||||
}
|
||||
|
||||
async function sleep(seconds) {
|
||||
return new Promise(resolve => setTimeout(resolve, seconds * 1000));
|
||||
}
|
||||
|
||||
function run(cmd) {
|
||||
return execSync(cmd, 'utf8').toString().trim();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
log,
|
||||
getNpmPackageInfo,
|
||||
sleep,
|
||||
run,
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {log, sleep} = require('./utils');
|
||||
|
||||
const SLEEP_S = 60; // 1 minute
|
||||
const MAX_RETRIES = 90; // 90 attempts. Waiting between attempt: 1 min. Total time: 90 min.
|
||||
const ARTIFACT_URL =
|
||||
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/';
|
||||
const ARTIFACT_NAME = 'react-native-artifacts-';
|
||||
|
||||
async function verifyArtifactsAreOnMaven(version, retries = MAX_RETRIES) {
|
||||
if (version.startsWith('v')) {
|
||||
version = version.substring(1);
|
||||
}
|
||||
|
||||
const artifactUrl = `${ARTIFACT_URL}${version}/${ARTIFACT_NAME}${version}.pom`;
|
||||
for (let currentAttempt = 1; currentAttempt <= retries; currentAttempt++) {
|
||||
const response = await fetch(artifactUrl);
|
||||
|
||||
if (response.status !== 200) {
|
||||
log(
|
||||
`${currentAttempt}) Artifact's for version ${version} are not on maven yet.\nURL: ${artifactUrl}\nLet's wait a minute and try again.\n`,
|
||||
);
|
||||
await sleep(SLEEP_S);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
log(
|
||||
`We waited 90 minutes for the artifacts to be on Maven. Check https://status.maven.org/ if there are issues wth the service.`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
module.exports = {verifyArtifactsAreOnMaven};
|
||||
@@ -1,63 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {log, getNpmPackageInfo, sleep} = require('./utils');
|
||||
|
||||
const SLEEP_S = 10;
|
||||
const MAX_RETRIES = 3 * 6; // 18 attempts. Waiting between attempt: 10 s. Total time: 3 mins.
|
||||
|
||||
async function verifyPublishedPackage(
|
||||
packageName,
|
||||
version,
|
||||
tag = null,
|
||||
retries = MAX_RETRIES,
|
||||
) {
|
||||
log(`🔍 Is ${packageName}@${version} on npm?`);
|
||||
|
||||
let count = retries;
|
||||
while (count-- > 0) {
|
||||
try {
|
||||
const json = await getNpmPackageInfo(packageName, tag ? tag : version);
|
||||
log(`🎉 Found ${packageName}@${version} on npm`);
|
||||
if (!tag) {
|
||||
return;
|
||||
}
|
||||
|
||||
// check for next tag
|
||||
if (tag === 'next' && json.version === version) {
|
||||
log(`🎉 ${packageName}@next → ${version} on npm`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for latest tag
|
||||
if (tag === 'latest' && json.version === version) {
|
||||
log(`🎉 ${packageName}@latest → ${version} on npm`);
|
||||
return;
|
||||
}
|
||||
|
||||
log(
|
||||
`🐌 ${packageName}@${tag} → ${json.version} on npm and not ${version} as expected, retrying...`,
|
||||
);
|
||||
} catch (e) {
|
||||
log(`Nope, fetch failed: ${e.message}`);
|
||||
}
|
||||
await sleep(SLEEP_S);
|
||||
}
|
||||
|
||||
let msg = `🚨 Timed out when trying to verify ${packageName}@${version} on npm`;
|
||||
if (tag) {
|
||||
msg += ` and ${tag} tag points to this version.`;
|
||||
}
|
||||
log(msg);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
verifyPublishedPackage,
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {run, sleep, log} = require('./utils.js');
|
||||
const {verifyPublishedPackage} = require('./verifyPublishedPackage.js');
|
||||
const REACT_NATIVE_NPM_PKG = 'react-native';
|
||||
const MAX_RETRIES = 3 * 6; // 18 attempts. Waiting between attempt: 10 s. Total time: 3 mins.
|
||||
/**
|
||||
* Will verify that @latest, @next and the @<version> have been published.
|
||||
*
|
||||
* NOTE: This will infinitely query each step until successful, make sure the
|
||||
* calling job has a timeout.
|
||||
*/
|
||||
module.exports.verifyReleaseOnNpm = async (
|
||||
version,
|
||||
latest = false,
|
||||
retries = MAX_RETRIES,
|
||||
) => {
|
||||
const tag = version.includes('-rc.') ? 'next' : latest ? 'latest' : null;
|
||||
if (version.startsWith('v')) {
|
||||
version = version.slice(1);
|
||||
}
|
||||
await verifyPublishedPackage(REACT_NATIVE_NPM_PKG, version, tag, retries);
|
||||
};
|
||||
@@ -10,6 +10,11 @@
|
||||
module.exports = async (github, context) => {
|
||||
const issue = context.payload.issue;
|
||||
|
||||
// Ignore issues using upgrade template (they use a special label)
|
||||
if (issue.labels.find(label => label.name === 'Type: Upgrade Issue')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const issueVersionUnparsed =
|
||||
getReactNativeVersionFromIssueBodyIfExists(issue);
|
||||
const issueVersion = parseVersionFromString(issueVersionUnparsed);
|
||||
@@ -45,6 +50,18 @@ module.exports = async (github, context) => {
|
||||
if (!isVersionSupported(issueVersion, latestVersion)) {
|
||||
return {label: 'Type: Unsupported Version'};
|
||||
}
|
||||
|
||||
// We want to encourage users to repro the issue on the highest available patch for the given minor.
|
||||
const latestPatchForVersion = getLatestPatchForVersion(
|
||||
issueVersion,
|
||||
recentReleases,
|
||||
);
|
||||
if (latestPatchForVersion > issueVersion.patch) {
|
||||
return {
|
||||
label: 'Newer Patch Available',
|
||||
newestPatch: `${issueVersion.major}.${issueVersion.minor}.${latestPatchForVersion}`,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -75,6 +92,22 @@ function isVersionTooOld(actualVersion, latestVersion) {
|
||||
);
|
||||
}
|
||||
|
||||
// Assumes that releases are sorted in the order of recency (i.e. most recent releases are earlier in the list)
|
||||
// This enables us to stop looking as soon as we find the first release with a matching major/minor version, since
|
||||
// we know it's the most recent release, therefore the highest patch available.
|
||||
function getLatestPatchForVersion(version, releases) {
|
||||
for (releaseName of releases) {
|
||||
const release = parseVersionFromString(releaseName);
|
||||
if (
|
||||
release &&
|
||||
release.major == version.major &&
|
||||
release.minor == version.minor
|
||||
) {
|
||||
return release.patch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getReactNativeVersionFromIssueBodyIfExists(issue) {
|
||||
if (!issue || !issue.body) return;
|
||||
const rnVersionRegex = /React Native Version[\r\n]+(?<version>.+)[\r\n]*/;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
name: Apply version label to issue
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
add-version-label-issue:
|
||||
permissions:
|
||||
issues: write # for react-native-community/actions-apply-version-label to label issues
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
if: github.repository == 'facebook/react-native'
|
||||
|
||||
steps:
|
||||
- uses: react-native-community/actions-apply-version-label@v0.0.3
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
required-label: "Type: Upgrade Issue"
|
||||
@@ -24,4 +24,4 @@ jobs:
|
||||
- name: Automatic Rebase
|
||||
uses: cirrus-actions/rebase@1.8
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
name: Bump Podfile.lock
|
||||
|
||||
on:
|
||||
workflow_call: # this directive allow us to call this workflow from other workflows
|
||||
|
||||
jobs:
|
||||
bump-podfile-lock:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config --local user.email "bot@reactnative.dev"
|
||||
git config --local user.name "React Native Bot"
|
||||
- name: Setup xcode
|
||||
uses: ./.github/actions/setup-xcode
|
||||
with:
|
||||
platform: 'ios'
|
||||
- name: Extract branch name
|
||||
run: |
|
||||
TAG="${{ github.ref_name }}";
|
||||
BRANCH_NAME=$(echo "$TAG" | sed -E 's/v([0-9]+\.[0-9]+)\.[0-9]+(-rc\.[0-9]+)?/\1-stable/')
|
||||
echo "Branch Name is $BRANCH_NAME"
|
||||
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
|
||||
- name: Checkout release branch
|
||||
run: |
|
||||
git checkout "$BRANCH_NAME"
|
||||
git fetch
|
||||
git pull origin "$BRANCH_NAME"
|
||||
- name: Bump podfile.lock
|
||||
run: |
|
||||
cd packages/rn-tester
|
||||
bundle install
|
||||
bundle exec pod update hermes-engine --no-repo-update
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git add packages/rn-tester/Podfile.lock
|
||||
git commit -m "[LOCAL] Bump Podfile.lock"
|
||||
git push origin "$BRANCH_NAME"
|
||||
@@ -1,20 +0,0 @@
|
||||
name: Keep Github Actions Cache < 10GB
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# Run every 2hrs during weekdays
|
||||
- cron: "0 0/2 * * 1-5"
|
||||
|
||||
jobs:
|
||||
cache-cleaner:
|
||||
if: github.repository == 'facebook/react-native'
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Trim the cache
|
||||
run: node scripts/clean-gha-cache.js
|
||||
@@ -13,7 +13,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const checkForReproducer = require('./.github/workflow-scripts/checkForReproducer.js')
|
||||
await checkForReproducer(github, context)
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
name: Label closed PR as merged and leave a comment
|
||||
on:
|
||||
push
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
comment-and-label:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
steps:
|
||||
- uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
script: |
|
||||
if(!context.payload.commits || !context.payload.commits.length) return;
|
||||
const sha = context.payload.commits[0].id;
|
||||
|
||||
const {commit, author} = (await github.rest.repos.getCommit({
|
||||
ref: sha,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})).data;
|
||||
|
||||
// Looking at the commit message, checks which PR number, if any, was closed by this commit
|
||||
const getClosedPrIfExists = (commit) => {
|
||||
if(!commit || !commit.message) return;
|
||||
const prClosingRegex = /Closes https:\/\/github.com\/facebook\/react-native\/pull\/([0-9]+)|Pull Request resolved: https:\/\/github.com\/facebook\/react-native\/pull\/([0-9]+)/;
|
||||
const prClosingMatch = commit.message.match(prClosingRegex);
|
||||
if(!prClosingMatch || (!prClosingMatch[1] && ! prClosingMatch[2])) return;
|
||||
return prClosingMatch[1] ?? prClosingMatch[2];
|
||||
};
|
||||
|
||||
const closedPrNumber = getClosedPrIfExists(commit);
|
||||
if(!closedPrNumber) return;
|
||||
|
||||
const pr = (await github.rest.pulls.get({
|
||||
pull_number: closedPrNumber,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})).data;
|
||||
|
||||
const authorName = author?.login ? `@${author.login}` : commit.author.name;
|
||||
|
||||
github.rest.issues.createComment({
|
||||
issue_number: closedPrNumber,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `This pull request was successfully merged by ${authorName} in **${sha}**\n\n<sup>[When will my fix make it into a release?](https://github.com/reactwg/react-native-releases/blob/main/docs/faq.md#when-will-my-fix-make-it-into-a-release) | [How to file a pick request?](https://github.com/reactwg/react-native-releases/blob/main/docs/faq.md#how-to-open-a-pick-request)</sup>`
|
||||
});
|
||||
|
||||
// If the PR has already been processed (labeled as Merged), skip it
|
||||
const mergedLabel = "Merged";
|
||||
if(pr.labels && pr.labels.some(label => label.name === mergedLabel)) return;
|
||||
|
||||
github.rest.issues.addLabels({
|
||||
issue_number: closedPrNumber,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels: [mergedLabel]
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
name: Label closed PR as merged and leave a comment
|
||||
on:
|
||||
push
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
comment-and-label:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
steps:
|
||||
- uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
if(!context.payload.commits || !context.payload.commits.length) return;
|
||||
const sha = context.payload.commits[0].id;
|
||||
|
||||
const {commit, author} = (await github.rest.repos.getCommit({
|
||||
ref: sha,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})).data;
|
||||
|
||||
// Looking at the commit message, checks which PR number, if any, was closed by this commit
|
||||
const getClosedPrIfExists = (commit) => {
|
||||
if(!commit || !commit.message) return;
|
||||
const prClosingRegex = /Closes https:\/\/github.com\/facebook\/react-native\/pull\/([0-9]+)|Pull Request resolved: https:\/\/github.com\/facebook\/react-native\/pull\/([0-9]+)/;
|
||||
const prClosingMatch = commit.message.match(prClosingRegex);
|
||||
if(!prClosingMatch || (!prClosingMatch[1] && ! prClosingMatch[2])) return;
|
||||
return prClosingMatch[1] ?? prClosingMatch[2];
|
||||
};
|
||||
|
||||
const closedPrNumber = getClosedPrIfExists(commit);
|
||||
if(!closedPrNumber) return;
|
||||
|
||||
const pr = (await github.rest.pulls.get({
|
||||
pull_number: closedPrNumber,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})).data;
|
||||
|
||||
// If the PR has already been processed (labeled as Merged), skip it
|
||||
const mergedLabel = "Merged";
|
||||
if(pr.labels && pr.labels.some(label => label.name === mergedLabel)) return;
|
||||
|
||||
const authorName = author?.login ? `@${author.login}` : commit.author.name;
|
||||
|
||||
github.rest.issues.createComment({
|
||||
issue_number: closedPrNumber,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `This pull request was successfully merged by ${authorName} in **${sha}**.\n\n<sup>[When will my fix make it into a release?](https://github.com/facebook/react-native/wiki/Release-FAQ#when-will-my-fix-make-it-into-a-release) | [Upcoming Releases](https://github.com/reactwg/react-native-releases/discussions/categories/releases)</sup>`
|
||||
});
|
||||
|
||||
github.rest.issues.addLabels({
|
||||
issue_number: closedPrNumber,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels: [mergedLabel]
|
||||
});
|
||||
@@ -1,53 +0,0 @@
|
||||
name: Create Draft Release
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
hermesVersion:
|
||||
required: false
|
||||
type: string
|
||||
description: The version of Hermes to use for this release (eg. 0.15.0). If not specified, it will use React Native Version
|
||||
hermesV1Version:
|
||||
required: false
|
||||
type: string
|
||||
description: The version of Hermes V1 to use for this release (eg. 250829098.0.2). If not specified, it will use React Native Version
|
||||
|
||||
jobs:
|
||||
create-draft-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Configure Git
|
||||
shell: bash
|
||||
run: |
|
||||
git config --local user.email "bot@reactnative.dev"
|
||||
git config --local user.name "React Native Bot"
|
||||
- name: Create draft release
|
||||
uses: actions/github-script@v6
|
||||
id: create-draft-release
|
||||
with:
|
||||
script: |
|
||||
const {createDraftRelease} = require('./.github/workflow-scripts/createDraftRelease.js');
|
||||
const version = '${{ github.ref_name }}';
|
||||
const {isLatest} = require('./.github/workflow-scripts/publishTemplate.js');
|
||||
return (await createDraftRelease(version, isLatest(), '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}', ${{ inputs.hermesVersion }}, ${{ inputs.hermesV1Version }})).id;
|
||||
result-encoding: string
|
||||
- name: Upload release assets for DotSlash
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
RELEASE_ID: ${{ steps.create-draft-release.outputs.result }}
|
||||
with:
|
||||
script: |
|
||||
const {uploadReleaseAssetsForDotSlashFiles} = require('./scripts/releases/upload-release-assets-for-dotslash.js');
|
||||
const version = '${{ github.ref_name }}';
|
||||
await uploadReleaseAssetsForDotSlashFiles({
|
||||
version,
|
||||
token: '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}',
|
||||
releaseId: process.env.RELEASE_ID,
|
||||
});
|
||||
@@ -1,57 +0,0 @@
|
||||
name: Create release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "The version of React Native we want to release. For example 0.75.0-rc.0"
|
||||
required: true
|
||||
type: string
|
||||
is-latest-on-npm:
|
||||
description: "Whether we want to tag this release as latest on NPM"
|
||||
required: true
|
||||
type: boolean
|
||||
default: false
|
||||
dry-run:
|
||||
description: "Whether the job should be executed in dry-run mode or not"
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
jobs:
|
||||
create_release:
|
||||
if: github.repository == 'facebook/react-native'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
fetch-depth: 0
|
||||
fetch-tags: 'true'
|
||||
- name: Check if on stable branch
|
||||
id: check_stable_branch
|
||||
run: |
|
||||
BRANCH="$(git branch --show-current)"
|
||||
PATTERN='^0\.[0-9]+-stable$'
|
||||
if [[ $BRANCH =~ $PATTERN ]]; then
|
||||
echo "On a stable branch"
|
||||
echo "ON_STABLE_BRANCH=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Print output
|
||||
run: echo "ON_STABLE_BRANCH ${{steps.check_stable_branch.outputs.ON_STABLE_BRANCH}}"
|
||||
- name: Check if tag already exists
|
||||
id: check_if_tag_exists
|
||||
run: |
|
||||
TAG="v${{ inputs.version }}"
|
||||
TAG_EXISTS=$(git tag -l "$TAG")
|
||||
if [[ -n "$TAG_EXISTS" ]]; then
|
||||
echo "Version tag already exists!"
|
||||
echo "TAG_EXISTS=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Execute Prepare Release
|
||||
if: ${{ steps.check_stable_branch.outputs.ON_STABLE_BRANCH && !steps.check_if_tag_exists.outputs.TAG_EXISTS }}
|
||||
uses: ./.github/actions/create-release
|
||||
with:
|
||||
version: ${{ inputs.version }}
|
||||
is-latest-on-npm: ${{ inputs.is-latest-on-npm }}
|
||||
dry-run: ${{ inputs.dry-run }}
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Run Danger on PR
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions:
|
||||
actions: write
|
||||
checks: write
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
statuses: write
|
||||
|
||||
jobs:
|
||||
danger:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Run yarn install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Run diff-js-api-breaking-changes
|
||||
uses: ./.github/actions/diff-js-api-breaking-changes
|
||||
- name: Danger
|
||||
run: yarn danger ci --use-github-checks --failOnErrors
|
||||
working-directory: private/react-native-bots
|
||||
env:
|
||||
DANGER_GITHUB_API_TOKEN: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,28 @@
|
||||
name: Run Danger on PR
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions:
|
||||
actions: write
|
||||
checks: write
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
statuses: write
|
||||
|
||||
jobs:
|
||||
danger:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run Yarn Install on Root
|
||||
run: yarn install
|
||||
working-directory: .
|
||||
- name: Danger
|
||||
run: yarn danger ci --use-github-checks --failOnErrors
|
||||
working-directory: packages/react-native-bots
|
||||
env:
|
||||
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,28 +0,0 @@
|
||||
name: Generate Changelog
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
generate-changelog:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Configure Git
|
||||
shell: bash
|
||||
run: |
|
||||
git config --local user.email "bot@reactnative.dev"
|
||||
git config --local user.name "React Native Bot"
|
||||
- name: Generate Changelog
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const {generateChangelog} = require('./.github/workflow-scripts/generateChangelog');
|
||||
const version = '${{ github.ref_name }}';
|
||||
await generateChangelog(version, '${{secrets.REACT_NATIVE_BOT_GITHUB_TOKEN}}');
|
||||
@@ -0,0 +1,48 @@
|
||||
name: ios-tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
test_ios_rntester-Hermes:
|
||||
runs-on: macos-latest-large
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'yarn'
|
||||
- name: Yarn Install
|
||||
run: yarn install
|
||||
- name: Get latest commit from Hermes
|
||||
run: |
|
||||
mkdir -p tmp/hermes
|
||||
HERMES_TAG_SHA=$(git ls-remote https://github.com/facebook/hermes main | cut -f 1 | tr -d '[:space:]')
|
||||
echo $HERMES_TAG_SHA > tmp/hermes/hermesversion
|
||||
echo "Latest Commit is:"
|
||||
cat tmp/hermes/hermesversion
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true
|
||||
ruby-version: '3.2'
|
||||
- name: Cache cocoapods
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: packages/rn-tester/Pods
|
||||
key: v1-${{ runner.os }}-RNTesterPods-${{ hashFiles('packages/rn-tester/Podfile.lock') }}-${{ hashFiles('packages/rn-tester/Podfile') }}-${{ hashFiles('tmp/hermes/hermesversion') }}
|
||||
- name: Pod Install
|
||||
run: |
|
||||
cd packages/rn-tester
|
||||
bundle install
|
||||
bundle exec pod install
|
||||
- name: Install XCBeautify
|
||||
run: brew install xcbeautify
|
||||
- name: Build iOS
|
||||
run: ./scripts/objc-test.sh
|
||||
@@ -1,41 +0,0 @@
|
||||
name: Monitor React Native New Issues
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0,6,12,18 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
# Reminder for when we have to update the schedule (before Jan 2026):
|
||||
# the secrets.ONCALL_SCHEDULE secret must be on a single line and must have all the `"` escaped as `\"`.
|
||||
# Only a meta engineer can update it through the OSS internal portal.
|
||||
|
||||
jobs:
|
||||
monitor-issues:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Extract next oncall
|
||||
run: |
|
||||
ONCALLS=$(node ./.github/workflow-scripts/extractIssueOncalls.js "${{ secrets.ONCALL_SCHEDULE }}")
|
||||
ONCALL1=$(echo $ONCALLS | cut -d ' ' -f 1)
|
||||
ONCALL2=$(echo $ONCALLS | cut -d ' ' -f 2)
|
||||
echo "oncall1=$ONCALL1" >> $GITHUB_ENV
|
||||
echo "oncall2=$ONCALL2" >> $GITHUB_ENV
|
||||
- name: Monitor New Issues
|
||||
uses: react-native-community/repo-monitor@v1.0.1
|
||||
with:
|
||||
task: "monitor-issues"
|
||||
git_secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
notifier: "discord"
|
||||
fetch_data_interval: 6
|
||||
repo_owner: "facebook"
|
||||
repo_name: "react-native"
|
||||
discord_webhook_url: "${{ secrets.DISCORD_WEBHOOK_URL }}"
|
||||
discord_id_type: "user"
|
||||
discord_ids: "${{ env.oncall1 }},${{ env.oncall2 }}"
|
||||
@@ -2,7 +2,7 @@ name: Issue Needs Attention
|
||||
# This workflow is triggered on issue comments.
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
types: created
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -10,15 +10,15 @@ permissions:
|
||||
jobs:
|
||||
applyNeedsAttentionLabel:
|
||||
permissions:
|
||||
contents: read # for actions/checkout to fetch code
|
||||
issues: write # for react-native-community/needs-attention to label issues
|
||||
contents: read # for actions/checkout to fetch code
|
||||
issues: write # for hramos/needs-attention to label issues
|
||||
name: Apply Needs Attention Label
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Apply Needs Attention Label
|
||||
uses: react-native-community/needs-attention@v2.0.0
|
||||
uses: hramos/needs-attention@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
response-required-label: "Needs: Author Feedback"
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
name: Nightlies Partners Feedback
|
||||
env:
|
||||
# Add accounts for users who are part of the nightlies program
|
||||
allowed_users: >
|
||||
[
|
||||
"blakef",
|
||||
"alanjhughes"
|
||||
]
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
project:
|
||||
description: 'What project is running against the nighties build?'
|
||||
required: true
|
||||
type: string
|
||||
outcome:
|
||||
description: 'Did the CI run: ["pass", "fail"]?'
|
||||
required: true
|
||||
type: string
|
||||
stage:
|
||||
description: 'Stage in the run that failed: ["build", "test"]?'
|
||||
required: true
|
||||
type: string
|
||||
link:
|
||||
description: 'URL to the failing test'
|
||||
required: true
|
||||
type: string
|
||||
version:
|
||||
description: 'What is the Nightlies version this was run against?'
|
||||
required: true
|
||||
type: string
|
||||
jobs:
|
||||
share-nightlies-feedback:
|
||||
name: ${{ inputs.project}} 💨 Nightlies CI
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
steps:
|
||||
- if: ${{ !contains(fromJSON(env.allowed_users), github.actor) }}
|
||||
run: |
|
||||
echo "Request from actor's login wasn't on the allowed_users list."
|
||||
curl -X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel
|
||||
- run: |
|
||||
echo "Project: ${{ inputs.project }}"
|
||||
echo "Outcome: ${{ inputs.outcome }}"
|
||||
echo "Stage: ${{ inputs.stage }}"
|
||||
echo "Link: ${{ inputs.link }}"
|
||||
echo "Version: ${{ inputs.version }}"
|
||||
[[ "${{ inputs.outcome }}" == "pass" ]] && { exit 0; } || { exit 1; }
|
||||
@@ -1,88 +0,0 @@
|
||||
name: Nightly
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# nightly build @ 2:15 AM UTC
|
||||
schedule:
|
||||
- cron: "15 2 * * *"
|
||||
|
||||
jobs:
|
||||
set_release_type:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
outputs:
|
||||
RELEASE_TYPE: ${{ steps.set_release_type.outputs.RELEASE_TYPE }}
|
||||
env:
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
REF: ${{ github.ref }}
|
||||
steps:
|
||||
- id: set_release_type
|
||||
run: |
|
||||
echo "Setting release type to nightly"
|
||||
echo "RELEASE_TYPE=nightly" >> $GITHUB_OUTPUT
|
||||
|
||||
prebuild_apple_dependencies:
|
||||
if: github.repository == 'facebook/react-native'
|
||||
uses: ./.github/workflows/prebuild-ios-dependencies.yml
|
||||
secrets: inherit
|
||||
|
||||
prebuild_react_native_core:
|
||||
uses: ./.github/workflows/prebuild-ios-core.yml
|
||||
with:
|
||||
use-hermes-nightly: true
|
||||
secrets: inherit
|
||||
needs: [prebuild_apple_dependencies]
|
||||
|
||||
build_android:
|
||||
runs-on: 8-core-ubuntu
|
||||
if: github.repository == 'facebook/react-native'
|
||||
needs: [set_release_type]
|
||||
container:
|
||||
image: reactnativecommunity/react-native-android:latest
|
||||
env:
|
||||
TERM: "dumb"
|
||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
||||
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
|
||||
ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }}
|
||||
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build Android
|
||||
uses: ./.github/actions/build-android
|
||||
with:
|
||||
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
|
||||
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
|
||||
|
||||
build_npm_package:
|
||||
runs-on: 8-core-ubuntu
|
||||
needs:
|
||||
[
|
||||
set_release_type,
|
||||
build_android,
|
||||
prebuild_apple_dependencies,
|
||||
prebuild_react_native_core,
|
||||
]
|
||||
container:
|
||||
image: reactnativecommunity/react-native-android:latest
|
||||
env:
|
||||
TERM: "dumb"
|
||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||
# By default we only build ARM64 to save time/resources. For release/nightlies, we override this value to build all archs.
|
||||
ORG_GRADLE_PROJECT_reactNativeArchitectures: "arm64-v8a"
|
||||
env:
|
||||
GHA_NPM_TOKEN: ${{ secrets.GHA_NPM_TOKEN }}
|
||||
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
||||
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
|
||||
ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }}
|
||||
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Publish NPM Package
|
||||
uses: ./.github/actions/build-npm-package
|
||||
with:
|
||||
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
|
||||
gha-npm-token: ${{ env.GHA_NPM_TOKEN }}
|
||||
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
|
||||
@@ -2,7 +2,7 @@ name: On Issue Labeled
|
||||
# This workflow is triggered when a label is added to an issue.
|
||||
on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
types: labeled
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -21,7 +21,6 @@ jobs:
|
||||
- name: Verify RN version
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
script: |
|
||||
const verifyVersion = require('./.github/workflow-scripts/verifyVersion.js')
|
||||
const labelWithContext = await verifyVersion(github, context);
|
||||
@@ -41,7 +40,6 @@ jobs:
|
||||
- name: Add descriptive label
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
script: |
|
||||
const addDescriptiveLabel = require('./.github/workflow-scripts/addDescriptiveLabels.js')
|
||||
await addDescriptiveLabel(github, context);
|
||||
@@ -54,7 +52,6 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
script: |
|
||||
const actOnLabel = require('./.github/workflow-scripts/actOnLabel.js')
|
||||
await actOnLabel(github, context, {label: context.payload.label.name})
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
name: Prebuild iOS Dependencies
|
||||
|
||||
on:
|
||||
workflow_call: # this directive allow us to call this workflow from other workflows
|
||||
inputs:
|
||||
use-hermes-nightly:
|
||||
description: 'Whether to use the hermes nightly build or read the version from the versions.properties file'
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build-rn-slice:
|
||||
runs-on: macos-15
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: ['Debug', 'Release']
|
||||
slice: [
|
||||
'ios',
|
||||
'ios-simulator',
|
||||
'mac-catalyst',
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Restore cache if present
|
||||
id: restore-ios-slice
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: v3-ios-core-${{ matrix.slice }}-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }}
|
||||
path: packages/react-native/
|
||||
- name: Setup node.js
|
||||
if: steps.restore-ios-slice.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Setup xcode
|
||||
if: steps.restore-ios-slice.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/setup-xcode
|
||||
with:
|
||||
platform: ${{ matrix.slice }}
|
||||
- name: Yarn Install
|
||||
if: steps.restore-ios-slice.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Set Hermes version
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ inputs.use-hermes-nightly }}" == "true" ]; then
|
||||
HERMES_VERSION="nightly"
|
||||
else
|
||||
HERMES_VERSION=$(sed -n 's/^HERMES_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties)
|
||||
fi
|
||||
echo "Using Hermes version: $HERMES_VERSION"
|
||||
echo "HERMES_VERSION=$HERMES_VERSION" >> $GITHUB_ENV
|
||||
- name: Download ReactNativeDependencies
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
|
||||
path: /tmp/third-party/
|
||||
- name: Extract ReactNativeDependencies
|
||||
if: steps.restore-ios-slice.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
# Extract ReactNativeDependencies
|
||||
tar -xzf /tmp/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz -C /tmp/third-party/
|
||||
|
||||
# Create destination folder
|
||||
mkdir -p packages/react-native/third-party/
|
||||
|
||||
# Move the XCFramework in the destination directory
|
||||
mv /tmp/third-party/packages/react-native/third-party/ReactNativeDependencies.xcframework packages/react-native/third-party/ReactNativeDependencies.xcframework
|
||||
|
||||
VERSION=$(jq -r '.version' packages/react-native/package.json)
|
||||
echo "$VERSION-${{matrix.flavor}}" > "packages/react-native/third-party/version.txt"
|
||||
cat "packages/react-native/third-party/version.txt"
|
||||
# Check destination directory
|
||||
ls -lR packages/react-native/third-party/
|
||||
- name: Setup the workspace
|
||||
if: steps.restore-ios-slice.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
cd packages/react-native
|
||||
node scripts/ios-prebuild.js -s -f "${{ matrix.flavor }}"
|
||||
- name: Build React Native
|
||||
if: steps.restore-ios-slice.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
# This is going to be replaced by a CLI script
|
||||
cd packages/react-native
|
||||
node scripts/ios-prebuild -b -f "${{ matrix.flavor }}" -p "${{ matrix.slice }}"
|
||||
- name: Upload headers
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: prebuild-ios-core-headers-${{ matrix.flavor }}-${{ matrix.slice }}
|
||||
path:
|
||||
packages/react-native/.build/headers
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: prebuild-ios-core-slice-${{ matrix.flavor }}-${{ matrix.slice }}
|
||||
path: |
|
||||
packages/react-native/.build/output/spm/${{ matrix.flavor }}/Build/Products
|
||||
- name: Save Cache
|
||||
uses: actions/cache/save@v4
|
||||
if: ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode
|
||||
with:
|
||||
key: v3-ios-core-${{ matrix.slice }}-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }}
|
||||
path: |
|
||||
packages/react-native/.build/output/spm/${{ matrix.flavor }}/Build/Products
|
||||
packages/react-native/.build/headers
|
||||
|
||||
compose-xcframework:
|
||||
runs-on: macos-15
|
||||
needs: [build-rn-slice]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: ['Debug', 'Release']
|
||||
env:
|
||||
REACT_ORG_CODE_SIGNING_P12_CERT: ${{ secrets.REACT_ORG_CODE_SIGNING_P12_CERT }}
|
||||
REACT_ORG_CODE_SIGNING_P12_CERT_PWD: ${{ secrets.REACT_ORG_CODE_SIGNING_P12_CERT_PWD }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Restore cache if present
|
||||
id: restore-ios-xcframework
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: packages/react-native/.build/output/xcframeworks
|
||||
key: v2-ios-core-xcframework-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }}
|
||||
- name: Setup node.js
|
||||
if: steps.restore-ios-xcframework.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Setup xcode
|
||||
if: steps.restore-ios-xcframework.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/setup-xcode
|
||||
with:
|
||||
xcode-version: '16.2.0'
|
||||
- name: Yarn Install
|
||||
if: steps.restore-ios-xcframework.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Download slice artifacts
|
||||
if: steps.restore-ios-xcframework.outputs.cache-hit != 'true'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: prebuild-ios-core-slice-${{ matrix.flavor }}-*
|
||||
path: packages/react-native/.build/output/spm/${{ matrix.flavor }}/Build/Products
|
||||
merge-multiple: true
|
||||
- name: Download headers
|
||||
if: steps.restore-ios-xcframework.outputs.cache-hit != 'true'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: prebuild-ios-core-headers-${{ matrix.flavor }}-*
|
||||
path: packages/react-native/.build/headers
|
||||
merge-multiple: true
|
||||
- name: Setup Keychain
|
||||
if: ${{ steps.restore-ios-xcframework.outputs.cache-hit != 'true' && env.REACT_ORG_CODE_SIGNING_P12_CERT != '' }}
|
||||
uses: apple-actions/import-codesign-certs@v3 # https://github.com/marketplace/actions/import-code-signing-certificates
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.REACT_ORG_CODE_SIGNING_P12_CERT }}
|
||||
p12-password: ${{ secrets.REACT_ORG_CODE_SIGNING_P12_CERT_PWD }}
|
||||
- name: Create XCFramework
|
||||
if: ${{ steps.restore-ios-xcframework.outputs.cache-hit != 'true' && env.REACT_ORG_CODE_SIGNING_P12_CERT == '' }}
|
||||
run: |
|
||||
cd packages/react-native
|
||||
node scripts/ios-prebuild -c -f "${{ matrix.flavor }}"
|
||||
- name: Create and Sign XCFramework
|
||||
if: ${{ steps.restore-ios-xcframework.outputs.cache-hit != 'true' && env.REACT_ORG_CODE_SIGNING_P12_CERT != '' }}
|
||||
run: |
|
||||
cd packages/react-native
|
||||
node scripts/ios-prebuild -c -f "${{ matrix.flavor }}" -i "React Org"
|
||||
- name: Compress and Rename XCFramework
|
||||
if: steps.restore-ios-xcframework.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd packages/react-native/.build/output/xcframeworks/${{matrix.flavor}}
|
||||
tar -cz -f ../ReactCore${{matrix.flavor}}.xcframework.tar.gz React.xcframework
|
||||
- name: Compress and Rename dSYM
|
||||
if: steps.restore-ios-xcframework.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd packages/react-native/.build/output/xcframeworks/${{matrix.flavor}}/Symbols
|
||||
tar -cz -f ../../ReactCore${{ matrix.flavor }}.framework.dSYM.tar.gz .
|
||||
- name: Upload XCFramework Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ReactCore${{ matrix.flavor }}.xcframework.tar.gz
|
||||
path: packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.xcframework.tar.gz
|
||||
- name: Upload dSYM Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ReactCore${{ matrix.flavor }}.framework.dSYM.tar.gz
|
||||
path: packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.framework.dSYM.tar.gz
|
||||
- name: Save cache if present
|
||||
if: ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.xcframework.tar.gz
|
||||
packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.framework.dSYM.tar.gz
|
||||
key: v2-ios-core-xcframework-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }}
|
||||
@@ -1,197 +0,0 @@
|
||||
name: Prebuild iOS Dependencies
|
||||
|
||||
on:
|
||||
workflow_call: # this directive allow us to call this workflow from other workflows
|
||||
|
||||
|
||||
jobs:
|
||||
prepare_workspace:
|
||||
name: Prepare workspace
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Restore cache if present
|
||||
id: restore-ios-prebuilds
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: packages/react-native/third-party/
|
||||
key: v3-ios-dependencies-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
|
||||
enableCrossOsArchive: true
|
||||
- name: Yarn Install
|
||||
if: steps.restore-ios-prebuilds.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Prepare Dependencies
|
||||
if: steps.restore-ios-prebuilds.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
node scripts/releases/prepare-ios-prebuilds.js -s
|
||||
- name: Generate Package.swift
|
||||
if: steps.restore-ios-prebuilds.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
node scripts/releases/prepare-ios-prebuilds.js -w
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: ios-prebuilds-workspace
|
||||
path: packages/react-native/third-party/
|
||||
- name: Save Cache
|
||||
uses: actions/cache/save@v4
|
||||
if: ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode
|
||||
with:
|
||||
key: v3-ios-dependencies-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
|
||||
enableCrossOsArchive: true
|
||||
path: packages/react-native/third-party/
|
||||
|
||||
build-apple-slices:
|
||||
name: Build Apple Slice
|
||||
runs-on: macos-15
|
||||
needs: [prepare_workspace]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: ['Debug', 'Release']
|
||||
slice: ['ios',
|
||||
'ios-simulator',
|
||||
'macos',
|
||||
'mac-catalyst',
|
||||
'tvos',
|
||||
'tvos-simulator',
|
||||
'xros',
|
||||
'xros-simulator']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Restore slice folder
|
||||
id: restore-slice-folder
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: packages/react-native/third-party/.build/Build/Products
|
||||
key: v3-ios-dependencies-slice-folder-${{ matrix.slice }}-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
|
||||
- name: Setup xcode
|
||||
if: steps.restore-slice-folder.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/setup-xcode
|
||||
with:
|
||||
platform: ${{ matrix.slice }}
|
||||
- name: Yarn Install
|
||||
if: steps.restore-slice-folder.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Restore workspace
|
||||
if: steps.restore-slice-folder.outputs.cache-hit != 'true'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ios-prebuilds-workspace
|
||||
path: packages/react-native/third-party/
|
||||
- name: Print third-party folder structure
|
||||
if: steps.restore-slice-folder.outputs.cache-hit != 'true'
|
||||
run: ls -lR packages/react-native/third-party
|
||||
- name: Build slice ${{ matrix.slice }} for ${{ matrix.flavor }}
|
||||
if: steps.restore-slice-folder.outputs.cache-hit != 'true'
|
||||
run: node scripts/releases/prepare-ios-prebuilds.js -b -p ${{ matrix.slice }} -r ${{ matrix.flavor }}
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: prebuild-slice-${{ matrix.flavor }}-${{ matrix.slice }}
|
||||
path: |
|
||||
packages/react-native/third-party/.build/Build/Products
|
||||
- name: Save Cache
|
||||
uses: actions/cache/save@v4
|
||||
if: ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode
|
||||
with:
|
||||
key: v3-ios-dependencies-slice-folder-${{ matrix.slice }}-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
|
||||
enableCrossOsArchive: true
|
||||
path: |
|
||||
packages/react-native/third-party/.build/Build/Products
|
||||
|
||||
create-xcframework:
|
||||
name: Prepare XCFramework
|
||||
runs-on: macos-15
|
||||
needs: [build-apple-slices]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [Debug, Release]
|
||||
env:
|
||||
REACT_ORG_CODE_SIGNING_P12_CERT: ${{ secrets.REACT_ORG_CODE_SIGNING_P12_CERT }}
|
||||
REACT_ORG_CODE_SIGNING_P12_CERT_PWD: ${{ secrets.REACT_ORG_CODE_SIGNING_P12_CERT_PWD }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Setup xcode
|
||||
uses: ./.github/actions/setup-xcode
|
||||
with:
|
||||
xcode-version: '16.1'
|
||||
- name: Restore XCFramework
|
||||
id: restore-xcframework
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
packages/react-native/third-party/
|
||||
key: v3-ios-dependencies-xcframework-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
|
||||
# If cache hit, we already have our binary. We don't need to do anything.
|
||||
- name: Yarn Install
|
||||
if: steps.restore-xcframework.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Restore workspace
|
||||
if: steps.restore-xcframework.outputs.cache-hit != 'true'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ios-prebuilds-workspace
|
||||
path: packages/react-native/third-party/
|
||||
- name: Download slices
|
||||
if: steps.restore-xcframework.outputs.cache-hit != 'true'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: prebuild-slice-${{ matrix.flavor }}-*
|
||||
path: packages/react-native/third-party/.build/Build/Products
|
||||
merge-multiple: true
|
||||
- name: Setup Keychain
|
||||
if: ${{ steps.restore-xcframework.outputs.cache-hit != 'true' && env.REACT_ORG_CODE_SIGNING_P12_CERT != '' }}
|
||||
uses: apple-actions/import-codesign-certs@v3 # https://github.com/marketplace/actions/import-code-signing-certificates
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.REACT_ORG_CODE_SIGNING_P12_CERT }}
|
||||
p12-password: ${{ secrets.REACT_ORG_CODE_SIGNING_P12_CERT_PWD }}
|
||||
- name: Create XCFramework
|
||||
if: ${{ steps.restore-xcframework.outputs.cache-hit != 'true' && env.REACT_ORG_CODE_SIGNING_P12_CERT == '' }}
|
||||
run: node scripts/releases/prepare-ios-prebuilds.js -c
|
||||
- name: Create and Sign XCFramework
|
||||
if: ${{ steps.restore-xcframework.outputs.cache-hit != 'true' && env.REACT_ORG_CODE_SIGNING_P12_CERT != '' }}
|
||||
run: node scripts/releases/prepare-ios-prebuilds.js -c -i "React Org"
|
||||
- name: Compress and Rename XCFramework
|
||||
if: steps.restore-xcframework.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
tar -cz -f packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz \
|
||||
packages/react-native/third-party/ReactNativeDependencies.xcframework
|
||||
- name: Show Symbol folder content
|
||||
if: steps.restore-xcframework.outputs.cache-hit != 'true'
|
||||
run: ls -lR packages/react-native/third-party/Symbols
|
||||
- name: Compress and Rename dSYM
|
||||
if: steps.restore-xcframework.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd packages/react-native/third-party/Symbols/
|
||||
tar -cz -f ../ReactNativeDependencies${{ matrix.flavor }}.framework.dSYM.tar.gz .
|
||||
mv ../ReactNativeDependencies${{ matrix.flavor }}.framework.dSYM.tar.gz ./ReactNativeDependencies${{ matrix.flavor }}.framework.dSYM.tar.gz
|
||||
- name: Upload XCFramework Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
|
||||
path: packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
|
||||
- name: Upload dSYM Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ReactNativeDependencies${{ matrix.flavor }}.framework.dSYM.tar.gz
|
||||
path: |
|
||||
packages/react-native/third-party/Symbols/ReactNativeDependencies${{ matrix.flavor }}.framework.dSYM.tar.gz
|
||||
- name: Save XCFramework in Cache
|
||||
if: ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
|
||||
packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.framework.dSYM.tar.gz
|
||||
key: v3-ios-dependencies-xcframework-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
|
||||
@@ -1,29 +0,0 @@
|
||||
name: Publish Bumped Packages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
- "*-stable"
|
||||
|
||||
jobs:
|
||||
publish_bumped_packages:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
env:
|
||||
GHA_NPM_TOKEN: ${{ secrets.GHA_NPM_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Run Yarn Install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Build packages
|
||||
run: yarn build
|
||||
- name: Build types
|
||||
run: yarn build-types --skip-snapshot
|
||||
- name: Set NPM auth token
|
||||
run: echo "//registry.npmjs.org/:_authToken=$GHA_NPM_TOKEN" > ~/.npmrc
|
||||
- name: Find and publish all bumped packages
|
||||
run: node ./scripts/releases-ci/publish-updated-packages.js
|
||||
@@ -1,147 +0,0 @@
|
||||
name: Publish Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v0.*.*" # This should match v0.X.Y
|
||||
- "v0.*.*-rc.*" # This should match v0.X.Y-RC.0
|
||||
jobs:
|
||||
set_release_type:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
outputs:
|
||||
RELEASE_TYPE: ${{ steps.set_release_type.outputs.RELEASE_TYPE }}
|
||||
env:
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
REF: ${{ github.ref }}
|
||||
steps:
|
||||
- id: set_release_type
|
||||
run: |
|
||||
echo "Setting release type to release"
|
||||
echo "RELEASE_TYPE=release" >> $GITHUB_OUTPUT
|
||||
|
||||
set_hermes_versions:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
outputs:
|
||||
HERMES_VERSION: ${{ steps.set_hermes_versions.outputs.HERMES_VERSION }}
|
||||
HERMES_V1_VERSION: ${{ steps.set_hermes_versions.outputs.HERMES_V1_VERSION }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- id: set_hermes_versions
|
||||
run: |
|
||||
echo "Setting hermes versions to latest"
|
||||
hermes_version=$(grep -oE 'HERMES_VERSION_NAME=([0-9]+\.[0-9]+\.[0-9]+)' packages/react-native/sdks/hermes-engine/version.properties | cut -d'=' -f2)
|
||||
hermes_v1_version=$(grep -oE 'HERMES_V1_VERSION_NAME=([0-9]+\.[0-9]+\.[0-9]+)' packages/react-native/sdks/hermes-engine/version.properties | cut -d'=' -f2)
|
||||
|
||||
echo "HERMES_VERSION=$hermes_version" >> $GITHUB_OUTPUT
|
||||
echo "HERMES_V1_VERSION=$hermes_v1_version" >> $GITHUB_OUTPUT
|
||||
- name: Print hermes versions
|
||||
run: |
|
||||
echo "HERMES_VERSION=${{ steps.set_hermes_versions.outputs.HERMES_VERSION }}"
|
||||
echo "HERMES_V1_VERSION=${{ steps.set_hermes_versions.outputs.HERMES_V1_VERSION }}"
|
||||
|
||||
prebuild_apple_dependencies:
|
||||
if: github.repository == 'facebook/react-native'
|
||||
uses: ./.github/workflows/prebuild-ios-dependencies.yml
|
||||
secrets: inherit
|
||||
|
||||
prebuild_react_native_core:
|
||||
uses: ./.github/workflows/prebuild-ios-core.yml
|
||||
secrets: inherit
|
||||
needs: [prebuild_apple_dependencies]
|
||||
|
||||
build_npm_package:
|
||||
runs-on: 8-core-ubuntu
|
||||
needs:
|
||||
[
|
||||
set_release_type,
|
||||
prebuild_apple_dependencies,
|
||||
prebuild_react_native_core,
|
||||
]
|
||||
container:
|
||||
image: reactnativecommunity/react-native-android:latest
|
||||
env:
|
||||
TERM: "dumb"
|
||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||
# By default we only build ARM64 to save time/resources. For release/nightlies, we override this value to build all archs.
|
||||
ORG_GRADLE_PROJECT_reactNativeArchitectures: "arm64-v8a"
|
||||
env:
|
||||
GHA_NPM_TOKEN: ${{ secrets.GHA_NPM_TOKEN }}
|
||||
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
||||
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
|
||||
ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }}
|
||||
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }}
|
||||
REACT_NATIVE_BOT_GITHUB_TOKEN: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
- name: Build and Publish NPM Package
|
||||
uses: ./.github/actions/build-npm-package
|
||||
with:
|
||||
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
|
||||
gha-npm-token: ${{ env.GHA_NPM_TOKEN }}
|
||||
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
|
||||
- name: Publish @react-native-community/template
|
||||
id: publish-template-to-npm
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
script: |
|
||||
const {publishTemplate} = require('./.github/workflow-scripts/publishTemplate.js')
|
||||
const version = "${{ github.ref_name }}"
|
||||
const isDryRun = false
|
||||
await publishTemplate(github, version, isDryRun);
|
||||
- name: Wait for template to be published
|
||||
timeout-minutes: 3
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
script: |
|
||||
const {verifyPublishedTemplate, isLatest} = require('./.github/workflow-scripts/publishTemplate.js')
|
||||
const version = "${{ github.ref_name }}"
|
||||
await verifyPublishedTemplate(version, isLatest());
|
||||
- name: Update rn-diff-purge to generate upgrade-support diff
|
||||
run: |
|
||||
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 $REACT_NATIVE_BOT_GITHUB_TOKEN" \
|
||||
-d "{\"event_type\": \"publish\", \"client_payload\": { \"version\": \"${{ github.ref_name }}\" }}"
|
||||
- name: Verify Release is on NPM
|
||||
timeout-minutes: 3
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
script: |
|
||||
const {verifyReleaseOnNpm} = require('./.github/workflow-scripts/verifyReleaseOnNpm.js');
|
||||
const {isLatest} = require('./.github/workflow-scripts/publishTemplate.js');
|
||||
const version = "${{ github.ref_name }}";
|
||||
await verifyReleaseOnNpm(version, isLatest());
|
||||
- name: Verify that artifacts are on Maven
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const {verifyArtifactsAreOnMaven} = require('./.github/workflow-scripts/verifyArtifactsAreOnMaven.js');
|
||||
const version = "${{ github.ref_name }}";
|
||||
await verifyArtifactsAreOnMaven(version);
|
||||
|
||||
generate_changelog:
|
||||
needs: build_npm_package
|
||||
uses: ./.github/workflows/generate-changelog.yml
|
||||
secrets: inherit
|
||||
|
||||
bump_podfile_lock:
|
||||
needs: build_npm_package
|
||||
uses: ./.github/workflows/bump-podfile-lock.yml
|
||||
secrets: inherit
|
||||
|
||||
create_draft_release:
|
||||
needs: [generate_changelog, set_hermes_versions]
|
||||
uses: ./.github/workflows/create-draft-release.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
hermesVersion: ${{ needs.set_hermes_versions.outputs.HERMES_VERSION }}
|
||||
hermesV1Version: ${{ needs.set_hermes_versions.outputs.HERMES_V1_VERSION }}
|
||||
@@ -1,20 +0,0 @@
|
||||
name: Retry workflow
|
||||
# Based on https://stackoverflow.com/a/78314483
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
run_id:
|
||||
required: true
|
||||
jobs:
|
||||
rerun:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
steps:
|
||||
- name: rerun ${{ inputs.run_id }}
|
||||
env:
|
||||
GH_REPO: ${{ github.repository }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
|
||||
gh run rerun ${{ inputs.run_id }} --failed
|
||||
@@ -0,0 +1,26 @@
|
||||
name: Run E2E Tests
|
||||
# This workflow is used to trigger E2E tests on a PR when a comment is made
|
||||
# containing the text "#run-e2e-tests".
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
rebase:
|
||||
name: Trigger E2E Tests
|
||||
permissions:
|
||||
contents: write # for cirrus-actions/rebase to push code to rebase
|
||||
pull-requests: read # for cirrus-actions/rebase to get info about PR
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '#run-e2e-tests')
|
||||
steps:
|
||||
- name: Checkout the latest code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
||||
- name: Push empty commit
|
||||
run: |
|
||||
git commit -m "#run-e2e-tests" --allow-empty
|
||||
git push origin $(git branch --show-current)
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Stale bot
|
||||
name: Mark stale issues and pull requests
|
||||
on:
|
||||
schedule:
|
||||
- cron: "*/10 5 * * *"
|
||||
@@ -10,12 +10,12 @@ jobs:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 180
|
||||
stale-issue-message: 'This issue is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label.'
|
||||
stale-pr-message: 'This PR is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label.'
|
||||
stale-issue-message: 'This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
||||
stale-pr-message: 'This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
||||
close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.'
|
||||
close-pr-message: 'This PR was closed because it has been stalled for 7 days with no activity.'
|
||||
exempt-issue-labels: 'Help Wanted :octocat:, Good first issue, Never gets stale, Issue: Author Provided Repro'
|
||||
@@ -27,10 +27,10 @@ jobs:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
ascending: true
|
||||
repo-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 180
|
||||
stale-issue-message: 'This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
||||
stale-pr-message: 'This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
||||
@@ -45,9 +45,9 @@ jobs:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
any-of-labels: 'Needs: Author Feedback'
|
||||
days-before-stale: 24
|
||||
stale-issue-message: "This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days."
|
||||
@@ -63,10 +63,10 @@ jobs:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
ascending: true
|
||||
repo-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
any-of-labels: 'Needs: Author Feedback'
|
||||
days-before-stale: 24
|
||||
stale-issue-message: "This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days."
|
||||
|
||||
@@ -1,526 +0,0 @@
|
||||
name: Test All
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "*-stable"
|
||||
|
||||
jobs:
|
||||
set_release_type:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
outputs:
|
||||
RELEASE_TYPE: ${{ steps.set_release_type.outputs.RELEASE_TYPE }}
|
||||
env:
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
REF: ${{ github.ref }}
|
||||
steps:
|
||||
- id: set_release_type
|
||||
run: |
|
||||
if [[ $EVENT_NAME == "schedule" ]]; then
|
||||
echo "Setting release type to nightly"
|
||||
echo "RELEASE_TYPE=nightly" >> $GITHUB_OUTPUT
|
||||
elif [[ $EVENT_NAME == "push" && $REF == refs/tags/v* ]]; then
|
||||
echo "Setting release type to release"
|
||||
echo "RELEASE_TYPE=release" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Setting release type to dry-run"
|
||||
echo "RELEASE_TYPE=dry-run" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
echo "Should I run E2E tests? ${{ inputs.run-e2e-tests }}"
|
||||
|
||||
prebuild_apple_dependencies:
|
||||
if: github.repository == 'facebook/react-native'
|
||||
uses: ./.github/workflows/prebuild-ios-dependencies.yml
|
||||
secrets: inherit
|
||||
|
||||
prebuild_react_native_core:
|
||||
uses: ./.github/workflows/prebuild-ios-core.yml
|
||||
with:
|
||||
use-hermes-nightly: ${{ !endsWith(github.ref_name, '-stable') }}
|
||||
secrets: inherit
|
||||
needs: [prebuild_apple_dependencies]
|
||||
|
||||
test_ios_rntester_ruby_3_2_0:
|
||||
runs-on: macos-15
|
||||
needs:
|
||||
[prebuild_apple_dependencies, prebuild_react_native_core]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Run it
|
||||
uses: ./.github/actions/test-ios-rntester
|
||||
with:
|
||||
ruby-version: "3.2.0"
|
||||
flavor: Debug
|
||||
|
||||
test_ios_rntester:
|
||||
runs-on: macos-15-large
|
||||
needs:
|
||||
[prebuild_apple_dependencies, prebuild_react_native_core]
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [Debug, Release]
|
||||
frameworks: [StaticLibraries, DynamicFrameworks]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Run it
|
||||
uses: ./.github/actions/test-ios-rntester
|
||||
with:
|
||||
use-frameworks: ${{ matrix.frameworks }}
|
||||
flavor: ${{ matrix.flavor }}
|
||||
|
||||
test_e2e_ios_rntester:
|
||||
runs-on: macos-15-large
|
||||
needs:
|
||||
[test_ios_rntester]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [Debug, Release]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Download App
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: RNTesterApp-NewArch-${{ matrix.flavor }}
|
||||
path: /tmp/RNTesterBuild/RNTester.app
|
||||
- name: Check downloaded folder content
|
||||
run: ls -lR /tmp/RNTesterBuild
|
||||
- name: Setup xcode
|
||||
uses: ./.github/actions/setup-xcode
|
||||
with:
|
||||
platform: ios
|
||||
- name: Run E2E Tests
|
||||
uses: ./.github/actions/maestro-ios
|
||||
with:
|
||||
app-path: "/tmp/RNTesterBuild/RNTester.app"
|
||||
app-id: com.meta.RNTester.localDevelopment
|
||||
maestro-flow: ./packages/rn-tester/.maestro/
|
||||
flavor: ${{ matrix.flavor }}
|
||||
|
||||
test_e2e_ios_templateapp:
|
||||
runs-on: macos-15-large
|
||||
needs: [build_npm_package, prebuild_apple_dependencies]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [Debug, Release]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup xcode
|
||||
uses: ./.github/actions/setup-xcode
|
||||
with:
|
||||
platform: ios
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Run yarn
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Setup ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6.10
|
||||
- name: Download React Native Package
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: react-native-package
|
||||
path: /tmp/react-native-tmp
|
||||
- name: Print /tmp folder
|
||||
run: ls -lR /tmp/react-native-tmp
|
||||
- name: Download ReactNativeDependencies
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
|
||||
path: /tmp/third-party
|
||||
- name: Print third-party folder
|
||||
shell: bash
|
||||
run: ls -lR /tmp/third-party
|
||||
- name: Download React Native Prebuilds
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ReactCore${{ matrix.flavor }}.xcframework.tar.gz
|
||||
path: /tmp/ReactCore
|
||||
- name: Print ReactCore folder
|
||||
shell: bash
|
||||
run: ls -lR /tmp/ReactCore
|
||||
- name: Configure git
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global user.email "react-native-bot@meta.com"
|
||||
git config --global user.name "React Native Bot"
|
||||
- name: Prepare artifacts
|
||||
run: |
|
||||
REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz")
|
||||
echo "React Native tgs is $REACT_NATIVE_PKG"
|
||||
|
||||
# For stable branches, we want to use the stable branch of the template
|
||||
# In all the other cases, we want to use "main"
|
||||
BRANCH=${{ github.ref_name }}
|
||||
if ! [[ $BRANCH == *-stable* ]]; then
|
||||
BRANCH=main
|
||||
fi
|
||||
|
||||
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch $BRANCH --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
|
||||
|
||||
cd /tmp/RNTestProject/ios
|
||||
bundle install
|
||||
NEW_ARCH_ENABLED=1
|
||||
|
||||
export RCT_USE_LOCAL_RN_DEP=/tmp/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
|
||||
# Disable prebuilds for now, as they are causing issues with E2E tests for 0.82-stable branch
|
||||
# export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ matrix.flavor }}.xcframework.tar.gz"
|
||||
RCT_NEW_ARCH_ENABLED=$NEW_ARCH_ENABLED bundle exec pod install
|
||||
|
||||
xcodebuild \
|
||||
-scheme "RNTestProject" \
|
||||
-workspace RNTestProject.xcworkspace \
|
||||
-configuration "${{ matrix.flavor }}" \
|
||||
-sdk "iphonesimulator" \
|
||||
-destination "generic/platform=iOS Simulator" \
|
||||
-derivedDataPath "/tmp/RNTestProject"
|
||||
- name: Run E2E Tests
|
||||
uses: ./.github/actions/maestro-ios
|
||||
with:
|
||||
app-path: "/tmp/RNTestProject/Build/Products/${{ matrix.flavor }}-iphonesimulator/RNTestProject.app"
|
||||
app-id: org.reactjs.native.example.RNTestProject
|
||||
maestro-flow: ./scripts/e2e/.maestro/
|
||||
flavor: ${{ matrix.flavor }}
|
||||
working-directory: /tmp/RNTestProject
|
||||
|
||||
test_e2e_android_templateapp:
|
||||
runs-on: 4-core-ubuntu
|
||||
needs: build_npm_package
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [debug, release]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Run yarn
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'zulu'
|
||||
- name: Download Maven Local
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: maven-local
|
||||
path: /tmp/react-native-tmp/maven-local
|
||||
- name: Download React Native Package
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: react-native-package
|
||||
path: /tmp/react-native-tmp
|
||||
- name: Print /tmp folder
|
||||
run: ls -lR /tmp/react-native-tmp
|
||||
- name: Prepare artifacts
|
||||
id: prepare-artifacts
|
||||
run: |
|
||||
REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz")
|
||||
echo "React Native tgs is $REACT_NATIVE_PKG"
|
||||
|
||||
MAVEN_LOCAL=/tmp/react-native-tmp/maven-local
|
||||
echo "Maven local path is $MAVEN_LOCAL"
|
||||
|
||||
# For stable branches, we want to use the stable branch of the template
|
||||
# In all the other cases, we want to use "main"
|
||||
BRANCH=${{ github.ref_name }}
|
||||
if ! [[ $BRANCH == *-stable* ]]; then
|
||||
BRANCH=main
|
||||
fi
|
||||
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch $BRANCH --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
|
||||
|
||||
echo "Feed maven local to gradle.properties"
|
||||
cd /tmp/RNTestProject
|
||||
echo "react.internal.mavenLocalRepo=$MAVEN_LOCAL" >> android/gradle.properties
|
||||
|
||||
# Build
|
||||
cd android
|
||||
CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}')
|
||||
./gradlew assemble$CAPITALIZED_FLAVOR --no-daemon -PreactNativeArchitectures=x86
|
||||
|
||||
- name: Run E2E Tests
|
||||
uses: ./.github/actions/maestro-android
|
||||
timeout-minutes: 60
|
||||
with:
|
||||
app-path: /tmp/RNTestProject/android/app/build/outputs/apk/${{ matrix.flavor }}/app-${{ matrix.flavor }}.apk
|
||||
app-id: com.rntestproject
|
||||
maestro-flow: ./scripts/e2e/.maestro/
|
||||
install-java: 'false'
|
||||
flavor: ${{ matrix.flavor }}
|
||||
working-directory: /tmp/RNTestProject
|
||||
|
||||
run_fantom_tests:
|
||||
runs-on: 8-core-ubuntu
|
||||
needs: [set_release_type]
|
||||
container:
|
||||
image: reactnativecommunity/react-native-android:latest
|
||||
env:
|
||||
TERM: "dumb"
|
||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
||||
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Test Fantom
|
||||
uses: ./.github/actions/run-fantom-tests
|
||||
with:
|
||||
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
|
||||
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
|
||||
|
||||
build_android:
|
||||
runs-on: 8-core-ubuntu
|
||||
needs: [set_release_type]
|
||||
container:
|
||||
image: reactnativecommunity/react-native-android:latest
|
||||
env:
|
||||
TERM: "dumb"
|
||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
||||
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build Android
|
||||
uses: ./.github/actions/build-android
|
||||
with:
|
||||
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
|
||||
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
|
||||
|
||||
test_e2e_android_rntester:
|
||||
runs-on: 4-core-ubuntu
|
||||
needs: [build_android]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [debug, release]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Install node dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Download APK
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: rntester-${{ matrix.flavor }}
|
||||
path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.flavor }}/
|
||||
- name: Print folder structure
|
||||
run: ls -lR ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.flavor }}/
|
||||
- name: Run E2E Tests
|
||||
uses: ./.github/actions/maestro-android
|
||||
timeout-minutes: 60
|
||||
with:
|
||||
app-path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.flavor }}/app-x86-${{ matrix.flavor }}.apk
|
||||
app-id: com.facebook.react.uiapp
|
||||
maestro-flow: ./packages/rn-tester/.maestro
|
||||
flavor: ${{ matrix.flavor }}
|
||||
|
||||
build_npm_package:
|
||||
runs-on: 8-core-ubuntu
|
||||
needs:
|
||||
[
|
||||
set_release_type,
|
||||
build_android,
|
||||
prebuild_apple_dependencies,
|
||||
prebuild_react_native_core,
|
||||
]
|
||||
container:
|
||||
image: reactnativecommunity/react-native-android:latest
|
||||
env:
|
||||
TERM: "dumb"
|
||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build NPM Package
|
||||
uses: ./.github/actions/build-npm-package
|
||||
with:
|
||||
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
|
||||
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
|
||||
|
||||
test_android_helloworld:
|
||||
runs-on: 4-core-ubuntu
|
||||
needs: build_npm_package
|
||||
container:
|
||||
image: reactnativecommunity/react-native-android:latest
|
||||
env:
|
||||
# Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in conatiners
|
||||
# via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127
|
||||
LC_ALL: C.UTF8
|
||||
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
||||
TERM: "dumb"
|
||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||
TARGET_ARCHITECTURE: "arm64-v8a"
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [Debug, Release]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup git safe folders
|
||||
run: git config --global --add safe.directory '*'
|
||||
- name: Download npm package artifact
|
||||
uses: actions/download-artifact@v4.1.3
|
||||
with:
|
||||
name: react-native-package
|
||||
path: build
|
||||
- name: Download maven-local artifact
|
||||
uses: actions/download-artifact@v4.1.3
|
||||
with:
|
||||
name: maven-local
|
||||
path: /tmp/maven-local
|
||||
- name: Setup gradle
|
||||
uses: ./.github/actions/setup-gradle
|
||||
with:
|
||||
cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
|
||||
- name: Run yarn install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Set nightly Hermes versions
|
||||
shell: bash
|
||||
run: |
|
||||
node ./scripts/releases/use-hermes-nightly.js
|
||||
- name: Run yarn install again, with the correct hermes version
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Prepare the Helloworld application
|
||||
shell: bash
|
||||
run: node ./scripts/e2e/init-project-e2e.js --useHelloWorld --pathToLocalReactNative "$GITHUB_WORKSPACE/build/$(cat build/react-native-package-version)"
|
||||
- name: Build the Helloworld application for ${{ matrix.flavor }} with Architecture set to New Architecture.
|
||||
shell: bash
|
||||
run: |
|
||||
cd private/helloworld/android
|
||||
args=()
|
||||
if [[ ${{ matrix.flavor }} == "Release" ]]; then
|
||||
args+=(--prod)
|
||||
fi
|
||||
yarn build android "${args[@]}" -P reactNativeArchitectures="$TARGET_ARCHITECTURE" -P react.internal.mavenLocalRepo="/tmp/maven-local"
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
name: helloworld-apk-${{ matrix.flavor }}-NewArch-hermes
|
||||
path: ./private/helloworld/android/app/build/outputs/apk/
|
||||
compression-level: 0
|
||||
|
||||
test_ios_helloworld_with_ruby_3_2_0:
|
||||
runs-on: macos-15
|
||||
needs: [prebuild_apple_dependencies, prebuild_react_native_core]
|
||||
env:
|
||||
PROJECT_NAME: iOSTemplateProject
|
||||
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/test-ios-helloworld
|
||||
with:
|
||||
ruby-version: 3.2.0
|
||||
flavor: Debug
|
||||
|
||||
test_ios_helloworld:
|
||||
runs-on: macos-15
|
||||
needs: [prebuild_apple_dependencies, prebuild_react_native_core]
|
||||
strategy:
|
||||
matrix:
|
||||
flavor: [Debug, Release]
|
||||
use_frameworks: [StaticLibraries, DynamicFrameworks]
|
||||
exclude:
|
||||
# This config is tested with Ruby 3.2.0. Let's not double test it.
|
||||
- flavor: Debug
|
||||
use_frameworks: StaticLibraries
|
||||
env:
|
||||
PROJECT_NAME: iOSTemplateProject
|
||||
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/test-ios-helloworld
|
||||
with:
|
||||
flavor: ${{ matrix.flavor }}
|
||||
use-frameworks: ${{ matrix.use_frameworks }}
|
||||
|
||||
test_js:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-version: ["24.4.1", "22", "20.19.4"]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Test JS
|
||||
uses: ./.github/actions/test-js
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Run all the linters
|
||||
uses: ./.github/actions/lint
|
||||
with:
|
||||
github-token: ${{ env.GH_TOKEN }}
|
||||
|
||||
# This job should help with the E2E flakyness.
|
||||
# In case E2E tests fails, it launches a new retry-workflow workflow, passing the current run_id as input.
|
||||
# The retry-workflow reruns only the failed jobs of the current test-all workflow using
|
||||
# ```
|
||||
# gh run rerun ${{ inputs.run_id }} --failed
|
||||
# ```
|
||||
# From https://stackoverflow.com/a/78314483 it seems like that adding the extra workflow
|
||||
# rather then calling directly this command should improve stability of this solution.
|
||||
# This is exactly the same as rerunning failed tests from the GH UI, but automated.
|
||||
rerun-failed-jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test_e2e_ios_rntester, test_e2e_android_rntester, test_e2e_ios_templateapp, test_e2e_android_templateapp]
|
||||
if: ${{ github.ref == 'refs/heads/main' && always() }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Rerun failed jobs in the current workflow
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
SHOULD_RETRY=${{fromJSON(github.run_attempt) < 3}}
|
||||
if [[ $SHOULD_RETRY == "false" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RNTESTER_ANDROID_FAILED=${{ needs.test_e2e_android_rntester.result == 'failure' }}
|
||||
TEMPLATE_ANDROID_FAILED=${{ needs.test_e2e_android_templateapp.result == 'failure' }}
|
||||
RNTESTER_IOS_FAILED=${{ needs.test_e2e_ios_rntester.result == 'failure' }}
|
||||
TEMPLATE_IOS_FAILED=${{ needs.test_e2e_ios_templateapp.result == 'failure' }}
|
||||
|
||||
echo "RNTESTER_ANDROID_FAILED: $RNTESTER_ANDROID_FAILED"
|
||||
echo "TEMPLATE_ANDROID_FAILED: $TEMPLATE_ANDROID_FAILED"
|
||||
echo "RNTESTER_IOS_FAILED: $RNTESTER_IOS_FAILED"
|
||||
echo "TEMPLATE_IOS_FAILED: $TEMPLATE_IOS_FAILED"
|
||||
|
||||
if [[ $RNTESTER_ANDROID_FAILED == "true" || $TEMPLATE_ANDROID_FAILED == "true" || $RNTESTER_IOS_FAILED == "true" || $TEMPLATE_IOS_FAILED == "true" ]]; then
|
||||
echo "Rerunning failed jobs in the current workflow"
|
||||
gh workflow run retry-workflow.yml -F run_id=${{ github.run_id }}
|
||||
fi
|
||||
@@ -1,49 +0,0 @@
|
||||
name: Validate DotSlash Artifacts
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- packages/debugger-shell/bin/react-native-devtools
|
||||
- "scripts/releases/**"
|
||||
- package.json
|
||||
- yarn.lock
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- packages/debugger-shell/bin/react-native-devtools
|
||||
- "scripts/releases/**"
|
||||
- package.json
|
||||
- yarn.lock
|
||||
# Same time as the nightly build: 2:15 AM UTC
|
||||
schedule:
|
||||
- cron: "15 2 * * *"
|
||||
|
||||
jobs:
|
||||
validate-dotslash-artifacts:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'facebook/react-native'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Configure Git
|
||||
shell: bash
|
||||
run: |
|
||||
git config --local user.email "bot@reactnative.dev"
|
||||
git config --local user.name "React Native Bot"
|
||||
- name: Validate DotSlash artifacts
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const {validateDotSlashArtifacts} = require('./scripts/releases/validate-dotslash-artifacts.js');
|
||||
await validateDotSlashArtifacts();
|
||||
+17
-40
@@ -24,13 +24,13 @@ project.xcworkspace
|
||||
|
||||
# Gradle
|
||||
/build/
|
||||
/packages/react-native-gradle-plugin/build/
|
||||
/packages/rn-tester/build
|
||||
/packages/rn-tester/android/app/.cxx/
|
||||
/packages/rn-tester/android/app/build/
|
||||
/packages/rn-tester/android/app/gradle/
|
||||
/packages/rn-tester/android/app/gradlew
|
||||
/packages/rn-tester/android/app/gradlew.bat
|
||||
/packages/react-native/build/
|
||||
/packages/react-native/ReactAndroid/build/
|
||||
/packages/react-native/ReactAndroid/.cxx/
|
||||
/packages/react-native/ReactAndroid/gradle/
|
||||
@@ -40,8 +40,8 @@ project.xcworkspace
|
||||
/packages/react-native/ReactAndroid/external-artifacts/artifacts/
|
||||
/packages/react-native/ReactAndroid/hermes-engine/build/
|
||||
/packages/react-native/ReactAndroid/hermes-engine/.cxx/
|
||||
/private/helloworld/android/app/build/
|
||||
/private/helloworld/android/build/
|
||||
/packages/react-native/template/android/app/build/
|
||||
/packages/react-native/template/android/build/
|
||||
/packages/react-native-popup-menu-android/android/build/
|
||||
|
||||
# Buck
|
||||
@@ -68,7 +68,6 @@ local.properties
|
||||
*.iml
|
||||
/packages/react-native/android/*
|
||||
!/packages/react-native/android/README.md
|
||||
.kotlin/
|
||||
|
||||
# Node
|
||||
node_modules
|
||||
@@ -107,43 +106,33 @@ package-lock.json
|
||||
|
||||
# Ruby Gems (Bundler)
|
||||
/packages/react-native/vendor
|
||||
/private/helloworld/vendor
|
||||
/packages/react-native/template/vendor
|
||||
.ruby-version
|
||||
/**/.ruby-version
|
||||
vendor/
|
||||
|
||||
# iOS / CocoaPods
|
||||
/private/helloworld/ios/build/
|
||||
/private/helloworld/ios/Pods/
|
||||
/private/helloworld/ios/Podfile.lock
|
||||
/packages/rn-tester/bin/
|
||||
/packages/rn-tester/cache/
|
||||
/packages/rn-tester/extensions/
|
||||
/packages/rn-tester/gems/
|
||||
/packages/rn-tester/specifications/
|
||||
/packages/react-native/template/ios/build/
|
||||
/packages/react-native/template/ios/Pods/
|
||||
/packages/react-native/template/ios/Podfile.lock
|
||||
/packages/rn-tester/Gemfile.lock
|
||||
/packages/**/RCTLegacyInteropComponents.mm
|
||||
/packages/sourcemap.ios.map
|
||||
|
||||
# Ignore RNTester specific Pods, but keep the __offline_mirrors__ here.
|
||||
/packages/rn-tester/Pods/*
|
||||
!/packages/rn-tester/Pods/__offline_mirrors_hermes__
|
||||
!/packages/rn-tester/Pods/__offline_mirrors_jsc__
|
||||
|
||||
# Swift Package build folder
|
||||
/packages/react-native/.build
|
||||
/packages/react-native/.swiftpm
|
||||
/packages/react-native/React/includes/
|
||||
|
||||
# @react-native/codegen
|
||||
/packages/react-native/React/FBReactNativeSpec/
|
||||
/packages/react-native/React/FBReactNativeSpec/FBReactNativeSpec
|
||||
/packages/react-native-codegen/lib
|
||||
/packages/react-native-codegen/tmp/
|
||||
/packages/react-native/ReactCommon/react/renderer/components/rncore/
|
||||
/packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec*
|
||||
/**/RCTThirdPartyFabricComponentsProvider.*
|
||||
|
||||
# @react-native/codegen-typescript-test
|
||||
/private/react-native-codegen-typescript-test/lib
|
||||
/packages/react-native-codegen-typescript-test/lib
|
||||
|
||||
# Additional SDKs
|
||||
/packages/react-native/sdks/download
|
||||
@@ -151,16 +140,8 @@ vendor/
|
||||
/packages/react-native/sdks/hermesc
|
||||
/packages/react-native/sdks/hermes-engine/hermes-engine-from-local-source-dir.tar.gz
|
||||
|
||||
# iOS prebuilds
|
||||
/packages/react-native/third-party/
|
||||
fix_*.patch
|
||||
*.xcframework
|
||||
|
||||
# Visual Studio Code (config dir - if present, this merges user defined
|
||||
# workspace settings on top of react-native.code-workspace)
|
||||
/.vscode
|
||||
|
||||
# Visual Studio
|
||||
# Visual studio
|
||||
.vscode
|
||||
.vs
|
||||
|
||||
# Android memory profiler files
|
||||
@@ -169,13 +150,9 @@ fix_*.patch
|
||||
# Temporary files created by Metro to check the health of the file watcher
|
||||
.metro-health-check*
|
||||
|
||||
# Jest Integration
|
||||
/private/react-native-fantom/build/
|
||||
/private/react-native-fantom/.out/
|
||||
/private/react-native-fantom/tester/build/
|
||||
# E2E files
|
||||
/packages/rn-tester-e2e/apps/*.apk
|
||||
/packages/rn-tester-e2e/apps/*.app
|
||||
|
||||
# [Experimental] Generated TS type definitions
|
||||
/packages/**/types_generated/
|
||||
|
||||
/packages/debugger-shell/build/
|
||||
/packages/*/dist/
|
||||
# CircleCI
|
||||
.circleci/generated_config.yml
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import relativeLinksRule from 'markdownlint-rule-relative-links';
|
||||
|
||||
const config = {
|
||||
config: {
|
||||
default: false,
|
||||
'heading-increment': true,
|
||||
'no-reversed-links': true,
|
||||
'no-missing-space-atx': true,
|
||||
'no-duplicate-heading': {
|
||||
siblings_only: true,
|
||||
},
|
||||
'single-title': true,
|
||||
'no-trailing-punctuation': true,
|
||||
'no-space-in-emphasis': true,
|
||||
'no-space-in-code': true,
|
||||
'no-space-in-links': true,
|
||||
'fenced-code-language': true,
|
||||
'first-line-heading': true,
|
||||
'no-empty-links': true,
|
||||
'no-alt-text': true,
|
||||
'link-fragments': true,
|
||||
'table-column-count': true,
|
||||
|
||||
// The rest of default rules are already handled by prettier
|
||||
|
||||
// Custom rules
|
||||
'relative-links': true,
|
||||
},
|
||||
globs: ['**/__docs__/*.md'],
|
||||
ignores: ['**/node_modules', '__docs__/README-template.md'],
|
||||
customRules: [relativeLinksRule],
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -7,6 +7,3 @@
|
||||
|
||||
packages/*/dist
|
||||
vendor
|
||||
packages/**/types_generated/
|
||||
|
||||
packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"bracketSameLine": true,
|
||||
"bracketSpacing": false,
|
||||
"requirePragma": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"endOfLine": "lf",
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.js.flow"
|
||||
],
|
||||
"options": {
|
||||
"parser": "hermes"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
let plugins = ['prettier-plugin-hermes-parser'];
|
||||
try {
|
||||
plugins = require('./.prettier-plugins.fb.js');
|
||||
} catch {}
|
||||
|
||||
module.exports = {
|
||||
arrowParens: 'avoid',
|
||||
bracketSameLine: true,
|
||||
bracketSpacing: false,
|
||||
requirePragma: true,
|
||||
singleQuote: true,
|
||||
trailingComma: 'all',
|
||||
endOfLine: 'lf',
|
||||
plugins,
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.code-workspace'],
|
||||
options: {
|
||||
parser: 'json',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.js', '*.js.flow'],
|
||||
options: {
|
||||
parser: 'hermes',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/__docs__/*.md'],
|
||||
options: {
|
||||
parser: 'markdown',
|
||||
proseWrap: 'always',
|
||||
requirePragma: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
-2316
File diff suppressed because it is too large
Load Diff
-4964
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1975
-1480
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user