From 4906002a6ee6f746b0452afbdc92d50bbe026f99 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Thu, 8 Jun 2023 10:44:01 +0100 Subject: [PATCH] Revert "Make CircleCI caches for hermesc be version dependent (#37452)" This reverts commit b959dbdfe65b0d667230a2149f79af463ac2c023. --- .circleci/config.yml | 184 ++----------------------------------------- 1 file changed, 6 insertions(+), 178 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a88de005906..99840a20218 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,53 +30,6 @@ references: attach_workspace: at: *hermes_workspace_root - main_only: &main_only - filters: - branches: - only: main - 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 "14.0.1" - nodelts_image: &nodelts_image "cimg/node:18.12.1" - nodeprevlts_image: &nodeprevlts_image "cimg/node:16.18.1" - - # ------------------------- - # Cache Key Anchors - # ------------------------- - # Anchors for the cache keys - - cache_keys: - checkout_cache_key: &checkout_cache_key v5-checkout - gems_cache_key: &gems_cache_key v1-gems-{{ checksum "Gemfile.lock" }} - gradle_cache_key: &gradle_cache_key v1-gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "ReactAndroid/gradle.properties" }} - hermes_workspace_cache_key: &hermes_workspace_cache_key v4-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }} - hermes_workspace_debug_cache_key: &hermes_workspace_debug_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }} - hermes_workspace_release_cache_key: &hermes_workspace_release_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }} - 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_tarball_debug_cache_key: &hermes_tarball_debug_cache_key v4-hermes-tarball-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }} - hermes_tarball_release_cache_key: &hermes_tarball_release_cache_key v3-hermes-tarball-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }} - pods_cache_key: &pods_cache_key v8-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}-{{ checksum "packages/rn-tester/Podfile" }} - windows_yarn_cache_key: &windows_yarn_cache_key v1-win-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }} - yarn_cache_key: &yarn_cache_key v5-yarn-cache-{{ .Environment.CIRCLE_JOB }} - - cache_paths: - hermes_workspace_macos_cache_paths: &hermes_workspace_macos_cache_paths - - ~/react-native/sdks/hermes/build_macosx - - ~/react-native/sdks/hermes/destroot - hermes_tarball_cache_paths: &hermes_tarball_cache_paths - - *hermes_tarball_artifacts_dir - # ------------------------- # Filters # ------------------------- @@ -293,124 +246,7 @@ commands: 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 - get_react_native_version: - steps: - - run: - name: Get React Native version - command: | - VERSION=$(cat 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/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/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 - - with_hermesc_span: - description: "Makes hermesc available to the provided steps, if hermesc is present." + with_hermes_sdk_cache_span: parameters: steps: type: steps @@ -782,12 +618,7 @@ jobs: command: ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=$BUILD_THREADS no_output_timeout: 30m - - store_test_results: - path: ~/react-native/ReactAndroid/build/test-results - - - store_test_results: - path: ~/react-native/packages/react-native-gradle-plugin/build/test-results - + # Build JavaScript Bundle for instrumentation tests - run: name: Build JavaScript Bundle command: node cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js @@ -1124,18 +955,17 @@ jobs: docker: - image: debian:bullseye resource_class: "xlarge" + working_directory: /root steps: - - checkout_code_with_cache - run: name: Install dependencies command: | apt update apt install -y git openssh-client cmake build-essential \ - libreadline-dev libicu-dev jq zip python3 + libreadline-dev libicu-dev zip python3 - *attach_hermes_workspace - - get_react_native_version - restore_cache: - key: *hermes_linux_cache_key + key: v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }} - run: name: Set up workspace command: | @@ -1154,7 +984,7 @@ jobs: cp /tmp/hermes/build/bin/hermesc /tmp/hermes/linux64-bin/. fi - save_cache: - key: *hermes_linux_cache_key + key: v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }} paths: - /tmp/hermes/linux64-bin/ - /tmp/hermes/hermes/destroot/ @@ -1235,9 +1065,7 @@ jobs: - MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin' - CMAKE_DIR: 'C:\Program Files\CMake\bin' steps: - - checkout_code_with_cache - *attach_hermes_workspace - - get_react_native_version_windows - restore_cache: key: v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "tmp/hermes/hermesversion" }} - run: