Skip to content

Commit

Permalink
Merge pull request #20436 from Expensify/Rory-CacheNodeModules
Browse files Browse the repository at this point in the history
[No QA] Cache node modules in GitHub Actions
  • Loading branch information
roryabraham authored Jun 8, 2023
2 parents 38ba7c8 + 79bd37d commit 93a7a3d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
34 changes: 31 additions & 3 deletions .github/actions/composite/setupNode/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,38 @@ runs:
with:
node-version-file: '.nvmrc'
cache: npm
cache-dependency-path: |
package-lock.json
desktop/package-lock.json
- name: Install node packages
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
- id: cache-node-modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}

- id: cache-desktop-node-modules
uses: actions/cache@v3
with:
path: desktop/node_modules
key: ${{ runner.os }}-desktop-node-modules-${{ hashFiles('desktop/package-lock.json') }}

- name: Install root project node packages
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
with:
timeout_minutes: 30
max_attempts: 3
command: npm ci --ignore-scripts

- name: Run patch-package
run: npx patch-package
shell: bash

- name: Install node packages for desktop submodule
if: steps.cache-desktop-node-modules.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
with:
timeout_minutes: 30
max_attempts: 3
command: npm ci
command: cd desktop && npm ci
3 changes: 1 addition & 2 deletions .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,12 @@ jobs:

- uses: actions/cache@v3
id: cache-pods
if: github.run_attempt == '1'
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}

- name: Install cocoapods
if: github.run_attempt != '1' || steps.cache-pods.outputs.cache-hit != 'true'
if: steps.cache-pods.outputs.cache-hit != 'true'
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
with:
timeout_minutes: 10
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,12 @@ jobs:

- uses: actions/cache@v3
id: cache-pods
if: github.run_attempt == '1'
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}

- name: Install cocoapods
if: github.run_attempt != '1' || steps.cache-pods.outputs.cache-hit != 'true'
if: steps.cache-pods.outputs.cache-hit != 'true'
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
with:
timeout_minutes: 10
Expand Down

0 comments on commit 93a7a3d

Please sign in to comment.