Skip to content

Commit c6ccaa1

Browse files
authored
feat: Make yarn cache folder configurable (#103 by @ronwsmith)
1 parent 7b0390e commit c6ccaa1

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/commands/yarn_install.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ parameters:
55
description: Save and restore the build cache? Defaults to true
66
type: boolean
77
default: true
8+
cache_folder:
9+
description: The path to the yarn cache folder. Defaults to /tmp/yarn
10+
type: string
11+
default: "/tmp/yarn"
812

913
steps:
1014
- when:
@@ -21,12 +25,12 @@ steps:
2125
- yarn-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ checksum "~/.tmp/checksumfiles/yarn.lock" }}-{{ .Environment.CACHE_VERSION }}
2226
- run:
2327
name: Yarn Install
24-
command: yarn install --frozen-lockfile --non-interactive --cache-folder /tmp/yarn
28+
command: "yarn install --frozen-lockfile --non-interactive --cache-folder <<parameters.cache_folder>>"
2529
- when:
2630
condition: <<parameters.cache>>
2731
steps:
2832
- save_cache:
2933
paths:
30-
- /tmp/yarn
34+
- <<parameters.cache_folder>>
3135
key: |
3236
yarn-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ checksum "~/.tmp/checksumfiles/yarn.lock" }}-{{ .Environment.CACHE_VERSION }}

src/jobs/ios_build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ parameters:
2424
description: Should we cache after yarn install? Defaults to true
2525
type: boolean
2626
default: true
27+
yarn_cache_folder:
28+
description: The path to the yarn cache folder
29+
type: string
30+
default: "/tmp/yarn"
2731
# For the iOS build command
2832
project_type:
2933
description: If the iOS app is built using a project file (*.xcodeproj) or a workspace.
@@ -81,6 +85,7 @@ steps:
8185
homebrew_cache: <<parameters.homebrew_cache>>
8286
- yarn_install:
8387
cache: <<parameters.yarn_cache>>
88+
cache_folder: <<parameters.yarn_cache_folder>>
8489
- when:
8590
condition: <<parameters.on_after_initialize>>
8691
steps:

src/jobs/ios_build_and_test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ parameters:
2828
description: Should we cache after yarn install? Defaults to true
2929
type: boolean
3030
default: true
31+
yarn_cache_folder:
32+
description: The path to the yarn cache folder
33+
type: string
34+
default: "/tmp/yarn"
3135
# For the iOS build command
3236
project_type:
3337
description: If the iOS app is built using a project file (*.xcodeproj) or a workspace.
@@ -101,6 +105,7 @@ steps:
101105
device: <<parameters.device>>
102106
- yarn_install:
103107
cache: <<parameters.yarn_cache>>
108+
cache_folder: <<parameters.yarn_cache_folder>>
104109
- when:
105110
condition: <<parameters.on_after_initialize>>
106111
steps:

0 commit comments

Comments
 (0)