Skip to content

Commit

Permalink
feat: Make yarn cache folder configurable (react-native-community#103
Browse files Browse the repository at this point in the history
…by @ronwsmith)
  • Loading branch information
ronwsmith committed Jul 13, 2021
1 parent 7b0390e commit c6ccaa1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/commands/yarn_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ parameters:
description: Save and restore the build cache? Defaults to true
type: boolean
default: true
cache_folder:
description: The path to the yarn cache folder. Defaults to /tmp/yarn
type: string
default: "/tmp/yarn"

steps:
- when:
Expand All @@ -21,12 +25,12 @@ steps:
- yarn-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ checksum "~/.tmp/checksumfiles/yarn.lock" }}-{{ .Environment.CACHE_VERSION }}
- run:
name: Yarn Install
command: yarn install --frozen-lockfile --non-interactive --cache-folder /tmp/yarn
command: "yarn install --frozen-lockfile --non-interactive --cache-folder <<parameters.cache_folder>>"
- when:
condition: <<parameters.cache>>
steps:
- save_cache:
paths:
- /tmp/yarn
- <<parameters.cache_folder>>
key: |
yarn-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ checksum "~/.tmp/checksumfiles/yarn.lock" }}-{{ .Environment.CACHE_VERSION }}
5 changes: 5 additions & 0 deletions src/jobs/ios_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ parameters:
description: Should we cache after yarn install? Defaults to true
type: boolean
default: true
yarn_cache_folder:
description: The path to the yarn cache folder
type: string
default: "/tmp/yarn"
# For the iOS build command
project_type:
description: If the iOS app is built using a project file (*.xcodeproj) or a workspace.
Expand Down Expand Up @@ -81,6 +85,7 @@ steps:
homebrew_cache: <<parameters.homebrew_cache>>
- yarn_install:
cache: <<parameters.yarn_cache>>
cache_folder: <<parameters.yarn_cache_folder>>
- when:
condition: <<parameters.on_after_initialize>>
steps:
Expand Down
5 changes: 5 additions & 0 deletions src/jobs/ios_build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ parameters:
description: Should we cache after yarn install? Defaults to true
type: boolean
default: true
yarn_cache_folder:
description: The path to the yarn cache folder
type: string
default: "/tmp/yarn"
# For the iOS build command
project_type:
description: If the iOS app is built using a project file (*.xcodeproj) or a workspace.
Expand Down Expand Up @@ -101,6 +105,7 @@ steps:
device: <<parameters.device>>
- yarn_install:
cache: <<parameters.yarn_cache>>
cache_folder: <<parameters.yarn_cache_folder>>
- when:
condition: <<parameters.on_after_initialize>>
steps:
Expand Down

0 comments on commit c6ccaa1

Please sign in to comment.