Skip to content

Commit afd5ce5

Browse files
author
Ashwin Kumar
committed
ci(action): add caching for react-native on ci
1 parent 289f3e8 commit afd5ce5

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

.github/workflows/callable-e2e-test-detox.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
timeout-minutes: ${{ inputs.timeout_minutes }}
2626

2727
steps:
28+
- name: Start iOS simulator (background)
29+
run: |
30+
xcrun simctl boot "iPhone 15" &
31+
shell: bash
2832
- name: Checkout repository
2933
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3034
with:
@@ -37,21 +41,32 @@ jobs:
3741
GH_TOKEN_STAGING_READ: ${{ secrets.GH_TOKEN_STAGING_READ }}
3842
- name: Load Verdaccio with AmplifyJs
3943
uses: ./amplify-js/.github/actions/load-verdaccio-with-amplify-js
44+
- name: Cache node_modules
45+
id: modules-cache
46+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
47+
with:
48+
path: ./node_modules
49+
key: ${{ inputs.test_name }}-detox-modules-${{ hashFiles('yarn.lock') }}
4050
- name: Yarn Install
51+
if: steps.modules-cache.outputs.cache-hit != 'true'
4152
working-directory: ${{ inputs.working_directory }}
4253
run: |
4354
echo "Current NPM registry: " $(yarn config get registry)
4455
$GITHUB_WORKSPACE/amplify-js/scripts/retry-yarn-script.sh -s 'install --frozen-lockfile --non-interactive' -n 3
4556
shell: bash
57+
58+
- name: Cache Pods
59+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
60+
id: pods-cache
61+
with:
62+
path: ios/Pods
63+
key: ${{ inputs.test_name }}-pods-${{ hashFiles('ios/Podfile.lock') }}
4664
- name: Install CocoaPods
65+
if: steps.pods-cache.outputs.cache-hit != 'true' || steps.modules-cache.outputs.cache-hit != 'true'
4766
run: |
4867
cd ios && pod install
4968
working-directory: ${{ inputs.working_directory }}
5069
shell: bash
51-
- name: Start iOS simulator (background)
52-
run: |
53-
xcrun simctl boot "iPhone 15" &
54-
shell: bash
5570
- name: Start Metro Packager (background)
5671
run: |
5772
yarn start &
@@ -66,7 +81,15 @@ jobs:
6681
yarn global add detox-cli
6782
working-directory: ${{ inputs.working_directory }}
6883
shell: bash
84+
- name: Cache Detox build
85+
id: cache-detox-build
86+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
87+
with:
88+
path: ios/build
89+
key: ${{ inputs.test_name }}-detox-build
90+
6991
- name: Detox Build
92+
if: steps.cache-detox-build.outputs.cache-hit != 'true' || steps.modules-cache.outputs.cache-hit != 'true' || steps.pods-cache.outputs.cache-hit != 'true'
7093
run: |
7194
detox build -c ios.sim.debug
7295
env:

0 commit comments

Comments
 (0)