From fae7895e0263b69af967d22102ee1bcd56dcbd80 Mon Sep 17 00:00:00 2001 From: James Treanor Date: Thu, 25 Jul 2019 11:42:49 -0700 Subject: [PATCH] Test RNTesterPods on CI with use_frameworks! enabled (#25818) Summary: This adds a `test_ios_frameworks` job to CircleCI to test the `RNTesterPods` project with `use_frameworks!` enabled. It will ensure the issue in https://github.com/facebook/react-native/issues/25349 is not reintroduced as suggested in https://github.com/facebook/react-native/pull/25619#issuecomment-514380653. [iOS] [Internal] - Added CircleCI job for testing `RNTesterPods` with `use_frameworks!` enabled. Pull Request resolved: https://github.com/facebook/react-native/pull/25818 Test Plan: Tests seem to be failing on `master` at the moment but you can see that the new job builds successfully [here](https://circleci.com/gh/facebook/react-native/103929?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link). You can confirm it installs the pods with `use_frameworks!` by seeing that `Installing pods with use_frameworks!` is at the start of the log for the `Generate RNTesterPods Workspace` step. Reviewed By: hramos Differential Revision: D16495016 Pulled By: fkgozali fbshipit-source-id: 8ef607cc3a152f599d226f9f45d990fba50a65d4 --- .circleci/config.yml | 206 ++++++++++++++++++++++++++++++------------ RNTester/Podfile | 8 +- RNTester/Podfile.lock | 2 +- 3 files changed, 155 insertions(+), 61 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 35706e6aa4825f..d1aa3cf0a8b0d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,40 +96,89 @@ aliases: command: node ./scripts/run-ci-e2e-tests.js --android --retries 3; - # ------------------------- - # ALIASES: Branch Filters - # ------------------------- - - &filter-only-master - branches: - only: master - - - &filter-only-master-stable - branches: - only: - - /.*-stable/ - - master - - - &filter-only-stable - branches: - only: - - /.*-stable/ - - - &filter-ignore-gh-pages - branches: - ignore: gh-pages - - - &filter-only-version-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]+)?)?/ - - - &filter-only-forked-pull-requests - branches: - only: /^pull\/.*$/ + install_buck_tooling: + steps: + - restore_cache: + keys: + - v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}} + - v3-buck-v2019.01.10.01- + - run: + name: Install BUCK + command: | + buck --version + # Install related tooling + if [[ ! -e ~/okbuck ]]; then + git clone https://github.com/uber/okbuck.git ~/okbuck --depth=1 + fi + - save_cache: + paths: + - ~/buck + - ~/okbuck + key: v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }} + + brew_install: + parameters: + package: + description: Homebrew package to install + type: string + steps: + - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install << parameters.package >> >/dev/null + + with_brew_cache_span: + parameters: + steps: + type: steps + steps: + - restore_cache: + keys: + - v1-brew + - steps: << parameters.steps >> + - save_cache: + paths: + - /usr/local/Homebrew + - ~/Library/Caches/Homebrew + key: v1-brew + + with_pods_cache_span: + parameters: + steps: + type: steps + steps: + - run: + name: Setup CocoaPods cache + # Copy RNTester/Podfile.lock since it can be changed by pod install + command: cp RNTester/Podfile.lock RNTester/Podfile.lock.bak + - restore_cache: + keys: + - v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "RNTester/Podfile.lock.bak" }} + - v1-pods-{{ .Environment.CIRCLE_JOB }}- + - steps: << parameters.steps >> + - save_cache: + paths: + - RNTester/Pods + key: v1-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "RNTester/Podfile.lock.bak" }} + + download_gradle_dependencies: + steps: + - restore_cache: + keys: + - v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }} + - v1-gradle- + - run: + name: Download Dependencies Using Gradle + command: ./scripts/circleci/gradle_download_deps.sh + - save_cache: + paths: + - ~/.gradle + - ReactAndroid/build/downloads + - ReactAndroid/build/third-party-ndk + key: v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }} + + download_buck_dependencies: + steps: + - run: + name: Download Dependencies Using Buck + command: ./scripts/circleci/buck_fetch.sh # ------------------------- # ALIASES: Workflows @@ -335,7 +384,11 @@ jobs: # ------------------------- # Runs unit tests on iOS devices test_ios: - <<: *macos_defaults + executor: reactnativeios + parameters: + use_frameworks: + type: boolean + default: false environment: - REPORTS_DIR: "./reports" steps: @@ -362,15 +415,18 @@ jobs: touch .watchmanconfig - save-cache: *save-brew-cache - - run: - name: Start Metro packager - command: yarn start --max-workers=1 || echo "Can't start packager automatically" - background: true + - when: + condition: << parameters.use_frameworks >> + steps: + - run: + name: Set USE_FRAMEWORKS=1 + command: echo "export USE_FRAMEWORKS=1" >> $BASH_ENV - - run: - name: Start WebSocket test server - command: open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically" - background: true + - with_pods_cache_span: + steps: + - run: + name: Generate RNTesterPods Workspace + command: cd RNTester && pod install --verbose - run: name: Verify RNTester can be built @@ -707,20 +763,56 @@ workflows: tests: jobs: - - test_node_lts: - filters: *filter-ignore-gh-pages - - - checkout_code: - filters: *filter-ignore-gh-pages - - - analyze: *run-after-checkout - - test_javascript: *run-after-checkout - - test_android: *run-after-checkout - - test_ios: *run-after-checkout - - test_end_to_end: *run-after-checkout - - test_docker_build: - filters: *filter-ignore-gh-pages - + - setup: + name: setup_js + filters: + branches: + ignore: gh-pages + - setup: + name: setup_ios + checkout_type: ios + executor: reactnativeios + filters: + branches: + ignore: gh-pages + - setup: + name: setup_android + checkout_type: android + executor: reactnativeandroid + filters: + branches: + ignore: gh-pages + - test_js: + requires: + - setup_js + - test_js_e2e: + requires: + - setup_js + - test_js + - test_android: + requires: + - setup_android + - test_ios: + requires: + - setup_ios + - test_ios: + name: test_ios_frameworks + use_frameworks: true + requires: + - setup_ios + - test_ios_e2e: + requires: + - setup_ios + - test_js + - test_js: + name: test_js_lts + executor: nodelts + requires: + - setup_js + - test_docker: + filters: + branches: + ignore: gh-pages releases: jobs: - checkout_code: diff --git a/RNTester/Podfile b/RNTester/Podfile index 6c403e44fdd416..a578f1a1c80274 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -2,10 +2,12 @@ platform :ios, '9.0' require_relative '../scripts/autolink-ios' -target 'RNTester' do - # Uncomment for Swift - # use_frameworks! +if ENV['USE_FRAMEWORKS'] == '1' + puts "Installing pods with use_frameworks!" + use_frameworks! +end +def pods() project 'RNTesterPods.xcodeproj' # Enable TurboModule diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 7ab20c74c46913..61c45af462578c 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -372,6 +372,6 @@ SPEC CHECKSUMS: ReactCommon: 63d1a6355d5810a21a61efda9ac93804571a1b8b yoga: b72aa5b3708cc93c5897f8297122d6eba1331e07 -PODFILE CHECKSUM: bb578b8286c0068879a41ac092c9690cc3ede523 +PODFILE CHECKSUM: 060903e270072f1e192b064848e6c34528af1c87 COCOAPODS: 1.6.3