Files
Blake FriedmanandFacebook GitHub Bot 4410899ec7 Only cache node_modules on main (#45544)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45544

## This diff now does 5 things:
1. removes the old way we used `actions/setup-node` to manage the cache itself.
2. it creates a new `update-node-modules-cache` workflow, which is the only job that will update the node modules cache
3. it create a `yarn-install-with-cache` action that should be used install of directly calling `yarn install --non-interactive`.  This will load a cache against a hash of `package.json`.
4. updated the cache reaper to aggressively remove everything but the latest `npm-{{ hash('package.json') }}`.
5. removed a `cache-setup`, which couldn't be used (we're using artefacts now).

## Why are we doing this:
The various `node-cache-` keys for platforms and on various branches accounts for a very large proportion of the cache (10-20%).

We don't frequently change these dependencies, and even when we do running `yarn install` after loading the cache will resolve any issues.

Limiting the cache to `main` and aggressively pruning older cache entries will clean up a lot of "small win" caching.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D59917944

fbshipit-source-id: 4be6f1959e8fde642a4f208f7d19aceba2c3262f
2024-07-19 13:04:07 -07:00

94 lines
3.5 KiB
YAML

name: test-ios-helloworld
description: Test iOS Hello World
inputs:
jsengine:
description: Which JavaScript engine to use. Must be one of "Hermes", "JSC".
default: Hermes
use-frameworks:
description: The dependency building and linking strategy to use. Must be one of "StaticLibraries", "DynamicFrameworks"
default: StaticLibraries
architecture:
description: The React Native architecture to Test. RNTester has always Fabric enabled, but we want to run integration test with the old arch setup. Must be one of "OldArch" or "NewArch"
default: OldArch
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
hermes-version:
description: The version of hermes
required: true
react-native-version:
description: The version of react-native
required: true
runs:
using: composite
steps:
- name: Setup xcode
uses: ./.github/actions/setup-xcode
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Create Hermes folder
shell: bash
run: mkdir -p "$HERMES_WS_DIR"
- name: Download Hermes
uses: actions/download-artifact@v4
with:
name: hermes-darwin-bin-${{ inputs.flavor }}
path: /tmp/hermes/hermes-runtime-darwin/
- name: Print Downloaded hermes
shell: bash
run: ls -lR "$HERMES_WS_DIR"
- name: Run yarn
uses: ./.github/actions/yarn-install-with-cache
- name: Setup ruby
uses: ruby/setup-ruby@v1.170.0
with:
ruby-version: ${{ inputs.ruby-version }}
- name: Install iOS dependencies - Configuration ${{ inputs.flavor }}; New Architecture ${{ inputs.architecture }}; JS Engine ${{ inputs.jsengine }}
shell: bash
run: |
cd packages/helloworld
args=()
if [[ ${{ inputs.architecture }} == "OldArch" ]]; then
args+=(--arch old)
fi
if [[ ${{ inputs.use-frameworks }} == "DynamicFrameworks" ]]; then
args+=(--frameworks dynamic)
fi
if [[ ${{ inputs.jsengine }} == "JSC" ]]; then
args+=(--jsvm jsc)
yarn bootstrap ios "${args[@]}" | cat
else
# Tarball is restored with capital flavors suffix, but somehow the tarball name from JS at line 96 returns as lowercased.
# Let's ensure that the tarballs have the right names
if [[ -f "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Debug.tar.gz" ]]; then
mv "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Debug.tar.gz" "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-debug.tar.gz"
fi
if [[ -f "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Release.tar.gz" ]]; then
mv "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-Release.tar.gz" "$HERMES_WS_DIR/hermes-runtime-darwin/hermes-ios-release.tar.gz"
fi
BUILD_TYPE="${{ inputs.flavor }}"
TARBALL_FILENAME=$(node ../react-native/scripts/hermes/get-tarball-name.js --buildType "$BUILD_TYPE")
HERMES_PATH="$HERMES_WS_DIR/hermes-runtime-darwin/$TARBALL_FILENAME"
HERMES_ENGINE_TARBALL_PATH="$HERMES_PATH" yarn bootstrap ios "${args[@]}" | cat
fi
- name: Build HelloWorld project
shell: bash
run: |
cd packages/helloworld
args=()
if [[ ${{ inputs.flavor }} == "Release" ]]; then
args+=(--prod)
fi
yarn build ios "${args[@]}" | cat
yarn bundle ios "${args[@]}" | cat