mirror of
https://github.com/status-im/react-native.git
synced 2025-02-26 08:05:34 +00:00
Remove pull request check on npm deploys (#19856)
Summary: The publish script will fail on forked PRs anyway as the $CIRCLE_NPM_TOKEN envvar will be missing or incorrect. We also move buck fetches to their own own shell script. These are shared by the Android and Deploy jobs, and using -ex will allow us to see which specific command failed without the need to list all steps in the config file. Finally, cache keys are updated as architecture is only relevant in caches that may be reused across macOS and linux, which is not the case for Android. Pull Request resolved: https://github.com/facebook/react-native/pull/19856 Differential Revision: D8956879 Pulled By: hramos fbshipit-source-id: cfc360b9c603497fee53433471537bdc15a0a1c8
This commit is contained in:
parent
6bf9024107
commit
6da5779eb7
@ -36,16 +36,16 @@ aliases:
|
|||||||
|
|
||||||
- &restore-cache-gradle
|
- &restore-cache-gradle
|
||||||
keys:
|
keys:
|
||||||
- v1-gradle-{{ arch }}-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
|
- v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
|
||||||
# Fallback in case checksum fails
|
# Fallback in case checksum fails
|
||||||
- v1-gradle-{{ arch }}-{{ .Branch }}-{{ checksum "build.gradle" }}-
|
- v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-
|
||||||
- v1-gradle-{{ arch }}-{{ .Branch }}-
|
- v1-gradle-{{ .Branch }}-
|
||||||
# Fallback in case this is a first-time run on a fork
|
# Fallback in case this is a first-time run on a fork
|
||||||
- v1-gradle-{{ arch }}-master-
|
- v1-gradle-master-
|
||||||
- &save-cache-gradle
|
- &save-cache-gradle
|
||||||
paths:
|
paths:
|
||||||
- ~/.gradle
|
- ~/.gradle
|
||||||
key: v1-gradle-{{ arch }}-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
|
key: v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
|
||||||
|
|
||||||
- &restore-cache-apt
|
- &restore-cache-apt
|
||||||
keys:
|
keys:
|
||||||
@ -59,20 +59,21 @@ aliases:
|
|||||||
|
|
||||||
- &restore-cache-ndk
|
- &restore-cache-ndk
|
||||||
keys:
|
keys:
|
||||||
- v3-android-ndk-{{ arch }}-r10e-{{ checksum "scripts/android-setup.sh" }}
|
- v3-android-ndk-r10e-{{ checksum "scripts/android-setup.sh" }}
|
||||||
- &save-cache-ndk
|
- &save-cache-ndk
|
||||||
paths:
|
paths:
|
||||||
- /opt/ndk
|
- /opt/ndk
|
||||||
key: v3-android-ndk-{{ arch }}-r10e-{{ checksum "scripts/android-setup.sh" }}
|
key: v3-android-ndk-r10e-{{ checksum "scripts/android-setup.sh" }}
|
||||||
|
|
||||||
- &restore-cache-buck
|
- &restore-cache-downloads-buck
|
||||||
keys:
|
keys:
|
||||||
- v3-buck-{{ arch }}-v2018.06.25.01
|
- v3-buck-v2018.06.25.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}}
|
||||||
- &save-cache-buck
|
- v3-buck-v2018.06.25.01-
|
||||||
|
- &save-cache-downloads-buck
|
||||||
paths:
|
paths:
|
||||||
- ~/buck
|
- ~/buck
|
||||||
- ~/okbuck
|
- ~/okbuck
|
||||||
key: v3-buck-{{ arch }}-v2018.06.25.01
|
key: v3-buck-v2018.06.25.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}
|
||||||
|
|
||||||
- &restore-cache-watchman
|
- &restore-cache-watchman
|
||||||
keys:
|
keys:
|
||||||
@ -82,16 +83,16 @@ aliases:
|
|||||||
- ~/watchman
|
- ~/watchman
|
||||||
key: v1-watchman-{{ arch }}-v4.9.0
|
key: v1-watchman-{{ arch }}-v4.9.0
|
||||||
|
|
||||||
- &restore-cache-gradle-downloads
|
- &restore-cache-downloads-gradle
|
||||||
keys:
|
keys:
|
||||||
- v1-gradle-{{ arch }}-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
- v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
||||||
- v1-gradle-{{ arch }}-
|
- v1-gradle-
|
||||||
- &save-cache-gradle-downloads
|
- &save-cache-downloads-gradle
|
||||||
paths:
|
paths:
|
||||||
- ~/.gradle
|
- ~/.gradle
|
||||||
- ReactAndroid/build/downloads
|
- ReactAndroid/build/downloads
|
||||||
- ReactAndroid/build/third-party-ndk
|
- ReactAndroid/build/third-party-ndk
|
||||||
key: v1-gradle-{{ arch }}-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
key: v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
||||||
|
|
||||||
# Branch Filtering
|
# Branch Filtering
|
||||||
- &filter-only-master-stable
|
- &filter-only-master-stable
|
||||||
@ -222,10 +223,14 @@ aliases:
|
|||||||
./scripts/circleci/check_cache.sh
|
./scripts/circleci/check_cache.sh
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
- &gradle-download-deps
|
- &download-dependencies-gradle
|
||||||
name: Download C++ Dependencies
|
name: Download Dependencies Using Gradle
|
||||||
command: ./scripts/circleci/gradle_download_deps.sh
|
command: ./scripts/circleci/gradle_download_deps.sh
|
||||||
|
|
||||||
|
- &download-dependencies-buck
|
||||||
|
name: Download Dependencies Using Buck
|
||||||
|
command: ./scripts/circleci/buck_fetch.sh
|
||||||
|
|
||||||
- &build-android-app
|
- &build-android-app
|
||||||
name: Build Android App
|
name: Build Android App
|
||||||
command: |
|
command: |
|
||||||
@ -266,6 +271,10 @@ aliases:
|
|||||||
fi
|
fi
|
||||||
source scripts/android-setup.sh && NO_BUCKD=1 retry3 timeout 300 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
|
source scripts/android-setup.sh && NO_BUCKD=1 retry3 timeout 300 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
|
||||||
|
|
||||||
|
- &build-android-rntester-app
|
||||||
|
name: Build Android RNTester App
|
||||||
|
command: ./gradlew RNTester:android:app:assembleRelease -Pjobs=$BUILD_THREADS
|
||||||
|
|
||||||
- &collect-android-test-results
|
- &collect-android-test-results
|
||||||
name: Collect Test Results
|
name: Collect Test Results
|
||||||
command: |
|
command: |
|
||||||
@ -472,59 +481,6 @@ jobs:
|
|||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: ~/react-native/reports/junit
|
path: ~/react-native/reports/junit
|
||||||
|
|
||||||
# Publishes new version onto npm
|
|
||||||
publish_npm_package:
|
|
||||||
<<: *android_defaults
|
|
||||||
steps:
|
|
||||||
# Checkout code so that we can work with `git` in publish.js
|
|
||||||
- checkout
|
|
||||||
|
|
||||||
# Configure Android SDK and related dependencies
|
|
||||||
- run: *configure-android-path
|
|
||||||
- run: *install-android-build-dependencies
|
|
||||||
|
|
||||||
- restore-cache: *restore-cache-android-packages
|
|
||||||
- run: *install-android-packages
|
|
||||||
- save-cache: *save-cache-android-packages
|
|
||||||
|
|
||||||
# Install Android NDK
|
|
||||||
- run: *create-ndk-directory
|
|
||||||
- restore-cache: *restore-cache-ndk
|
|
||||||
- run: *install-ndk
|
|
||||||
- save-cache: *save-cache-ndk
|
|
||||||
|
|
||||||
# Fetch dependencies using BUCK
|
|
||||||
- restore-cache: *restore-cache-buck
|
|
||||||
- run: *install-buck
|
|
||||||
- save-cache: *save-cache-buck
|
|
||||||
|
|
||||||
- run: buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
|
|
||||||
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react
|
|
||||||
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
|
|
||||||
- run: buck fetch ReactAndroid/src/test/...
|
|
||||||
- run: buck fetch ReactAndroid/src/androidTest/...
|
|
||||||
|
|
||||||
- restore-cache: *restore-cache-gradle-downloads
|
|
||||||
- run: *gradle-download-deps
|
|
||||||
- save-cache: *save-cache-gradle-downloads
|
|
||||||
|
|
||||||
- restore-cache: *restore-yarn-cache
|
|
||||||
- run: *yarn
|
|
||||||
- save-cache: *save-yarn-cache
|
|
||||||
|
|
||||||
- run:
|
|
||||||
name: Publish React Native Package
|
|
||||||
command: |
|
|
||||||
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
|
|
||||||
echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
|
|
||||||
git config --global user.email "reactjs-bot@users.noreply.github.com"
|
|
||||||
git config --global user.name "npm Deployment Script"
|
|
||||||
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
|
|
||||||
node ./scripts/publish-npm.js
|
|
||||||
else
|
|
||||||
echo "Skipping deploy."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set up an Android environment for downstream jobs
|
# Set up an Android environment for downstream jobs
|
||||||
test_android:
|
test_android:
|
||||||
<<: *android_defaults
|
<<: *android_defaults
|
||||||
@ -542,6 +498,7 @@ jobs:
|
|||||||
- run: *install-android-packages
|
- run: *install-android-packages
|
||||||
- save-cache: *save-cache-android-packages
|
- save-cache: *save-cache-android-packages
|
||||||
|
|
||||||
|
# Validate Android SDK installation and packages
|
||||||
- run: *validate-android-sdk
|
- run: *validate-android-sdk
|
||||||
|
|
||||||
# Starting emulator in advance as it takes some time to boot.
|
# Starting emulator in advance as it takes some time to boot.
|
||||||
@ -556,22 +513,21 @@ jobs:
|
|||||||
- run: *install-ndk
|
- run: *install-ndk
|
||||||
- save-cache: *save-cache-ndk
|
- save-cache: *save-cache-ndk
|
||||||
|
|
||||||
# Fetch dependencies using BUCK
|
# Install Buck
|
||||||
- restore-cache: *restore-cache-buck
|
- restore-cache: *restore-cache-downloads-buck
|
||||||
- run: *install-buck
|
- run: *install-buck
|
||||||
- save-cache: *save-cache-buck
|
- save-cache: *save-cache-downloads-buck
|
||||||
|
|
||||||
|
# Validate Android test environment (including Buck)
|
||||||
- run: *validate-android-test-env
|
- run: *validate-android-test-env
|
||||||
|
|
||||||
- run: buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
|
# Download dependencies using Buck
|
||||||
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react
|
- run: *download-dependencies-buck
|
||||||
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
|
|
||||||
- run: buck fetch ReactAndroid/src/test/...
|
|
||||||
- run: buck fetch ReactAndroid/src/androidTest/...
|
|
||||||
|
|
||||||
- restore-cache: *restore-cache-gradle-downloads
|
# Download dependencies using Gradle
|
||||||
- run: *gradle-download-deps
|
- restore-cache: *restore-cache-downloads-gradle
|
||||||
- save-cache: *save-cache-gradle-downloads
|
- run: *download-dependencies-gradle
|
||||||
|
- save-cache: *save-cache-downloads-gradle
|
||||||
|
|
||||||
# Build and compile
|
# Build and compile
|
||||||
- run: *build-android-app
|
- run: *build-android-app
|
||||||
@ -586,12 +542,7 @@ jobs:
|
|||||||
# Test Suite
|
# Test Suite
|
||||||
- run: *run-android-unit-tests
|
- run: *run-android-unit-tests
|
||||||
- run: *run-android-instrumentation-tests
|
- run: *run-android-instrumentation-tests
|
||||||
|
- run: *build-android-rntester-app
|
||||||
# Build Android RNTester
|
|
||||||
- run:
|
|
||||||
name: Build Android RNTester
|
|
||||||
command: |
|
|
||||||
./gradlew RNTester:android:app:assembleRelease -Pjobs=$BUILD_THREADS
|
|
||||||
|
|
||||||
# Run Android end-to-end tests
|
# Run Android end-to-end tests
|
||||||
# Disabled
|
# Disabled
|
||||||
@ -646,6 +597,47 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
|
# Publishes new version onto npm
|
||||||
|
# Only works on stable branches when a properly tagged commit is pushed
|
||||||
|
publish_npm_package:
|
||||||
|
<<: *android_defaults
|
||||||
|
steps:
|
||||||
|
- attach_workspace:
|
||||||
|
at: ~/react-native
|
||||||
|
|
||||||
|
# Configure Android SDK and related dependencies
|
||||||
|
- run: *configure-android-path
|
||||||
|
- run: *install-android-build-dependencies
|
||||||
|
|
||||||
|
- restore-cache: *restore-cache-android-packages
|
||||||
|
- run: *install-android-packages
|
||||||
|
|
||||||
|
# Install Android NDK
|
||||||
|
- run: *create-ndk-directory
|
||||||
|
- restore-cache: *restore-cache-ndk
|
||||||
|
- run: *install-ndk
|
||||||
|
|
||||||
|
# Fetch dependencies using Buck
|
||||||
|
- restore-cache: *restore-cache-downloads-buck
|
||||||
|
- run: *install-buck
|
||||||
|
- run: *download-dependencies-buck
|
||||||
|
|
||||||
|
# Fetch dependencies using Gradle
|
||||||
|
- restore-cache: *restore-cache-downloads-gradle
|
||||||
|
- run: *download-dependencies-gradle
|
||||||
|
|
||||||
|
- restore-cache: *restore-yarn-cache
|
||||||
|
- run: *yarn
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: Publish React Native Package
|
||||||
|
command: |
|
||||||
|
echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
|
||||||
|
git config --global user.email "reactjs-bot@users.noreply.github.com"
|
||||||
|
git config --global user.name "npm Deployment Script"
|
||||||
|
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
|
||||||
|
node ./scripts/publish-npm.js
|
||||||
|
|
||||||
# Workflows enables us to run multiple jobs in parallel
|
# Workflows enables us to run multiple jobs in parallel
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
9
scripts/circleci/buck_fetch.sh
Executable file
9
scripts/circleci/buck_fetch.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
|
||||||
|
buck fetch ReactAndroid/src/main/java/com/facebook/react
|
||||||
|
buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
|
||||||
|
buck fetch ReactAndroid/src/test/...
|
||||||
|
buck fetch ReactAndroid/src/androidTest/...
|
Loading…
x
Reference in New Issue
Block a user