diff --git a/.github/actions/composite/setupNode/action.yml b/.github/actions/composite/setupNode/action.yml index aeade96bb623..91cb2fb06426 100644 --- a/.github/actions/composite/setupNode/action.yml +++ b/.github/actions/composite/setupNode/action.yml @@ -7,6 +7,13 @@ inputs: description: 'Indicates if node is set up for hybrid app' required: false default: 'false' + SEED_STICKY_DISKS: + description: | + 'true' only in the seedStickyDisks workflow, which installs dependencies and nothing else. + Everywhere else the disks are mounted read-through so no job can persist build artifacts or + tool caches into the snapshot. + required: false + default: 'false' outputs: cache-hit: @@ -36,6 +43,7 @@ runs: with: key: ${{ format('{0}-{1}-{2}-node-modules-{3}', github.repository, runner.os, runner.arch, inputs.IS_HYBRID_BUILD == 'true' && hashFiles('normalized-package-lock.json', 'patches/**', 'Mobile-Expensify/patches/**') || hashFiles('normalized-package-lock.json', 'patches/**')) }} path: node_modules + commit: ${{ inputs.SEED_STICKY_DISKS == 'true' && 'if-missing' || 'false' }} - id: stickydisk-old-dot-node-modules if: steps.runner-info.outputs.use-sticky-disk == 'true' && inputs.IS_HYBRID_BUILD == 'true' @@ -43,6 +51,7 @@ runs: with: key: ${{ format('{0}-{1}-{2}-old-dot-node-modules-{3}', github.repository, runner.os, runner.arch, hashFiles('Mobile-Expensify/package-lock.json', 'Mobile-Expensify/patches/**')) }} path: Mobile-Expensify/node_modules + commit: ${{ inputs.SEED_STICKY_DISKS == 'true' && 'if-missing' || 'false' }} - id: stickydisk-npm if: steps.runner-info.outputs.use-sticky-disk == 'true' @@ -50,6 +59,7 @@ runs: with: key: ${{ format('{0}-{1}-{2}-npm', github.repository, runner.os, runner.arch) }} path: ~/.npm + commit: on-change - id: cache-node-modules if: steps.runner-info.outputs.use-sticky-disk != 'true' diff --git a/.github/workflows/seedStickyDisks.yml b/.github/workflows/seedStickyDisks.yml new file mode 100644 index 000000000000..39246bb81e94 --- /dev/null +++ b/.github/workflows/seedStickyDisks.yml @@ -0,0 +1,39 @@ +name: Seed sticky disks + +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + seedStandalone: + name: Seed standalone node_modules + runs-on: blacksmith-2vcpu-ubuntu-2404 + steps: + - name: Checkout + uses: useblacksmith/checkout@1c9394c220d293645707b625ba9d79685f093a8f # v1 + + - name: Setup Node (seed) + uses: ./.github/actions/composite/setupNode + with: + SEED_STICKY_DISKS: 'true' + + seedHybrid: + name: Seed hybrid node_modules + runs-on: blacksmith-2vcpu-ubuntu-2404 + steps: + - name: Checkout + uses: useblacksmith/checkout@1c9394c220d293645707b625ba9d79685f093a8f # v1 + with: + submodules: true + token: ${{ secrets.OS_BOTIFY_TOKEN }} + + - name: Setup Node (seed) + uses: ./.github/actions/composite/setupNode + with: + IS_HYBRID_BUILD: 'true' + SEED_STICKY_DISKS: 'true'