diff --git a/.github/actions/composite/setupNode/action.yml b/.github/actions/composite/setupNode/action.yml index 8eb4f6474638..086a2a383d28 100644 --- a/.github/actions/composite/setupNode/action.yml +++ b/.github/actions/composite/setupNode/action.yml @@ -1,6 +1,12 @@ name: Set up Node description: Set up Node +inputs: + IS_HYBRID_BUILD: + description: "Indicates if node is set up for hybrid app" + required: false + default: 'false' + outputs: cache-hit: description: Was there a cache hit on the main node_modules? @@ -27,14 +33,26 @@ runs: path: node_modules key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json', 'patches/**') }} + - id: cache-old-dot-node-modules + if: inputs.IS_HYBRID_BUILD == 'true' + uses: actions/cache@v4 + with: + path: Mobile-Expensify/node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('Mobile-Expensify/package-lock.json', 'Mobile-Expensify/patches/**') }} + - id: cache-desktop-node-modules uses: actions/cache@v4 with: path: desktop/node_modules key: ${{ runner.os }}-desktop-node-modules-${{ hashFiles('desktop/package-lock.json', 'desktop/patches/**') }} + - name: Remove ND node_modules if needed for hybrid app build + if: inputs.IS_HYBRID_BUILD == 'true' && steps.cache-node-modules.outputs.cache-hit == 'true' && steps.cache-old-dot-node-modules.outputs.cache-hit != 'true' + shell: bash + run: rm -rf node_modules + - name: Install root project node packages - if: steps.cache-node-modules.outputs.cache-hit != 'true' + if: steps.cache-node-modules.outputs.cache-hit != 'true' || (inputs.IS_HYBRID_BUILD == 'true' && steps.cache-old-dot-node-modules.outputs.cache-hit != 'true') uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847 with: timeout_minutes: 30 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 354b78d437a3..86bfa195cd75 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -137,6 +137,8 @@ jobs: - name: Setup Node id: setup-node uses: ./.github/actions/composite/setupNode + with: + IS_HYBRID_BUILD: 'true' - name: Run grunt build run: | @@ -449,6 +451,8 @@ jobs: - name: Setup Node id: setup-node uses: ./.github/actions/composite/setupNode + with: + IS_HYBRID_BUILD: 'true' - name: Setup Ruby uses: ruby/setup-ruby@v1.190.0 diff --git a/.github/workflows/testBuildHybrid.yml b/.github/workflows/testBuildHybrid.yml index c8027f93a2a5..1dd968c8cb6d 100644 --- a/.github/workflows/testBuildHybrid.yml +++ b/.github/workflows/testBuildHybrid.yml @@ -115,6 +115,8 @@ jobs: - name: Setup Node id: setup-node uses: ./.github/actions/composite/setupNode + with: + IS_HYBRID_BUILD: 'true' - name: Run grunt build run: | @@ -223,6 +225,8 @@ jobs: - name: Setup Node id: setup-node uses: ./.github/actions/composite/setupNode + with: + IS_HYBRID_BUILD: 'true' - name: Create .env.adhoc file based on staging and add PULL_REQUEST_NUMBER env to it run: |