Skip to content

Commit

Permalink
ci(action): add caching for react-native on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwin Kumar committed Feb 20, 2025
1 parent 289f3e8 commit afd5ce5
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/callable-e2e-test-detox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
timeout-minutes: ${{ inputs.timeout_minutes }}

steps:
- name: Start iOS simulator (background)
run: |
xcrun simctl boot "iPhone 15" &
shell: bash
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
Expand All @@ -37,21 +41,32 @@ jobs:
GH_TOKEN_STAGING_READ: ${{ secrets.GH_TOKEN_STAGING_READ }}
- name: Load Verdaccio with AmplifyJs
uses: ./amplify-js/.github/actions/load-verdaccio-with-amplify-js
- name: Cache node_modules
id: modules-cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ./node_modules
key: ${{ inputs.test_name }}-detox-modules-${{ hashFiles('yarn.lock') }}
- name: Yarn Install
if: steps.modules-cache.outputs.cache-hit != 'true'
working-directory: ${{ inputs.working_directory }}
run: |
echo "Current NPM registry: " $(yarn config get registry)
$GITHUB_WORKSPACE/amplify-js/scripts/retry-yarn-script.sh -s 'install --frozen-lockfile --non-interactive' -n 3
shell: bash

- name: Cache Pods
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
id: pods-cache
with:
path: ios/Pods
key: ${{ inputs.test_name }}-pods-${{ hashFiles('ios/Podfile.lock') }}
- name: Install CocoaPods
if: steps.pods-cache.outputs.cache-hit != 'true' || steps.modules-cache.outputs.cache-hit != 'true'
run: |
cd ios && pod install
working-directory: ${{ inputs.working_directory }}
shell: bash
- name: Start iOS simulator (background)
run: |
xcrun simctl boot "iPhone 15" &
shell: bash
- name: Start Metro Packager (background)
run: |
yarn start &
Expand All @@ -66,7 +81,15 @@ jobs:
yarn global add detox-cli
working-directory: ${{ inputs.working_directory }}
shell: bash
- name: Cache Detox build
id: cache-detox-build
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ios/build
key: ${{ inputs.test_name }}-detox-build

- name: Detox Build
if: steps.cache-detox-build.outputs.cache-hit != 'true' || steps.modules-cache.outputs.cache-hit != 'true' || steps.pods-cache.outputs.cache-hit != 'true'
run: |
detox build -c ios.sim.debug
env:
Expand Down

0 comments on commit afd5ce5

Please sign in to comment.