From def4657ed2d9a019e0f1eb3c0fab244c68da20fa Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Thu, 19 Oct 2023 05:32:24 -0700 Subject: [PATCH] Make hermes build more robust to avoid cache poisoning (#41076) Summary: In one of the latests commits on main, Hermes failed somehow to build dSYMs in some slices. However, the slices were cached (so the cache is poisoned) and the overall process failed. With this change, we aim to make the slice's build process fail if the dSYM or the actual framework is not built properly, before caching, so they are not poisoned ## Changelog: [Internal] - Fail the build if dSYM or hermes.frameworks are not built Pull Request resolved: https://github.com/facebook/react-native/pull/41076 Test Plan: CircleCI is green Reviewed By: huntie Differential Revision: D50453598 Pulled By: cipolleschi fbshipit-source-id: 06bf16ef1472bd9bc9825977b817445272477a10 --- .circleci/configurations/jobs.yml | 16 ++++++++++++++++ .circleci/configurations/top_level.yml | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.circleci/configurations/jobs.yml b/.circleci/configurations/jobs.yml index d183a09dbb7102..4633e33ecb6efb 100644 --- a/.circleci/configurations/jobs.yml +++ b/.circleci/configurations/jobs.yml @@ -859,6 +859,22 @@ jobs: echo "Moving from build_$SLICE to $FINAL_PATH" mv build_"$SLICE" "$FINAL_PATH" + + # check whether everything is there + if [[ -d "$FINAL_PATH/API/hermes/hermes.framework" ]]; then + echo "Successfully built hermes.framework for $SLICE in $FLAVOR" + else + echo "Failed to built hermes.framework for $SLICE in $FLAVOR" + exit 1 + fi + + if [[ -d "$FINAL_PATH/API/hermes/hermes.framework.dSYM" ]]; then + echo "Successfully built hermes.framework.dSYM for $SLICE in $FLAVOR" + else + echo "Failed to built hermes.framework.dSYM for $SLICE in $FLAVOR" + echo "Please try again" + exit 1 + fi - save_cache: key: << parameters.slice_base_cache_key >>-<< parameters.slice >>-<< parameters.flavor >> paths: diff --git a/.circleci/configurations/top_level.yml b/.circleci/configurations/top_level.yml index 4d44e1eae976f1..a3f1070bcf98bc 100644 --- a/.circleci/configurations/top_level.yml +++ b/.circleci/configurations/top_level.yml @@ -82,7 +82,7 @@ references: 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 v2-hermesc-apple-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }} - hermes_apple_slices_cache_key: &hermes_apple_slices_cache_key v2-hermes-apple-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }} + hermes_apple_slices_cache_key: &hermes_apple_slices_cache_key v3-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 v4-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 v3-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 v1-hermes-release-macosx-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}