diff --git a/.github/actions/composite/setupNode/action.yml b/.github/actions/composite/setupNode/action.yml index aeade96bb623..7618c481b7c2 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: @@ -32,24 +39,27 @@ runs: - id: stickydisk-node-modules if: steps.runner-info.outputs.use-sticky-disk == 'true' - uses: useblacksmith/stickydisk@6d373c96a74cbde0c99fedc5ea5d3a7ba66ba494 # v1.4.0 + uses: useblacksmith/stickydisk@74f3f01ab1392726dd6ee06904f0452b0ec1e151 # v1.6.0 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' - uses: useblacksmith/stickydisk@6d373c96a74cbde0c99fedc5ea5d3a7ba66ba494 # v1.4.0 + uses: useblacksmith/stickydisk@74f3f01ab1392726dd6ee06904f0452b0ec1e151 # v1.6.0 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' - uses: useblacksmith/stickydisk@6d373c96a74cbde0c99fedc5ea5d3a7ba66ba494 # v1.4.0 + uses: useblacksmith/stickydisk@74f3f01ab1392726dd6ee06904f0452b0ec1e151 # v1.6.0 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'