Skip to content

Commit bc2f52f

Browse files
author
Jake Perkins
committed
bundler-cache
1 parent 4a81330 commit bc2f52f

1 file changed

Lines changed: 25 additions & 13 deletions

File tree

.github/actions/setup-e2e-env/action.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
description: 'Node.js version'
99
required: false
1010
default: '20.18.0'
11+
yarn-version:
12+
description: Yarn version to use with Corepack
13+
required: false
14+
default: '1.22.22'
1115
setup-simulator:
1216
description: 'Whether to setup simulator/emulator'
1317
required: false
@@ -46,25 +50,24 @@ runs:
4650
## Yarn Setup & Cache Management
4751

4852
- name: Install Yarn
49-
run: corepack enable && corepack prepare yarn@stable --activate
53+
run: corepack enable && corepack prepare yarn@${{ inputs.yarn-version }} --activate
5054
shell: bash
5155

56+
5257
- name: Restore Yarn cache
5358
uses: actions/cache@v4
5459
with:
5560
path: |
56-
**/node_modules
61+
node_modules
5762
key: ${{ inputs.cache-prefix }}-yarn-${{ inputs.platform }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
5863
restore-keys: |
5964
${{ inputs.cache-prefix }}-yarn-${{ inputs.platform }}-${{ runner.os }}-
6065
61-
# Step 3: Install JS deps (fast if node_modules is cached)
6266
- name: Install JavaScript dependencies
6367
if: ${{ inputs.platform == 'ios' }}
6468
run: yarn install --frozen-lockfile
6569
shell: bash
6670

67-
6871
- name: Install Detox CLI
6972
run: yarn global add detox-cli
7073
shell: bash
@@ -74,33 +77,42 @@ runs:
7477
shell: bash
7578

7679
## IOS Setup ##
80+
81+
## Ruby Setup & Cache Management
7782
- name: Setup Ruby
7883
if: ${{ inputs.platform == 'ios' }}
7984
uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651
8085
with:
8186
ruby-version: ${{ inputs.ruby-version }}
8287

83-
- name: Install JavaScript dependencies
84-
if: ${{ inputs.platform == 'ios' }}
85-
run: yarn install --frozen-lockfile
86-
shell: bash
87-
88+
# Install Bundler first
8889
- name: Install bundler
8990
if: ${{ inputs.platform == 'ios' }}
9091
run: gem install bundler -v ${{ inputs.bundler-version }}
9192
shell: bash
9293

93-
- name: Select Xcode version
94+
# Restore cached Ruby gems
95+
- name: Restore Bundler cache
9496
if: ${{ inputs.platform == 'ios' }}
95-
run: sudo xcode-select -s /Applications/Xcode_${{ inputs.xcode-version }}.app
96-
shell: bash
97+
uses: actions/cache@v4
98+
with:
99+
path: ios/vendor/bundle
100+
key: ${{ inputs.cache-prefix }}-bundler-${{ inputs.platform }}-${{ runner.os }}-${{ hashFiles('ios/Gemfile.lock') }}
101+
restore-keys: |
102+
${{ inputs.cache-prefix }}-bundler-${{ inputs.platform }}-${{ runner.os }}-
97103
104+
# Install Ruby gems into ios/vendor/bundle ( cache management & awareness )
98105
- name: Install Ruby gems via bundler
99106
if: ${{ inputs.platform == 'ios' }}
100-
run: bundle install
107+
run: bundle install --path=vendor/bundle
101108
working-directory: ios
102109
shell: bash
103110

111+
- name: Select Xcode version
112+
if: ${{ inputs.platform == 'ios' }}
113+
run: sudo xcode-select -s /Applications/Xcode_${{ inputs.xcode-version }}.app
114+
shell: bash
115+
104116
- name: Install CocoaPods via bundler
105117
if: ${{ inputs.platform == 'ios' && inputs.setup-simulator == 'true' }}
106118
run: bundle exec pod install

0 commit comments

Comments
 (0)