|
| 1 | +name: Setup Workspace |
| 2 | +description: Install the pinned Bun and Node toolchain, mount the dependency (and optionally Turbo) caches, and install workspace dependencies. |
| 3 | + |
| 4 | +inputs: |
| 5 | + provider: |
| 6 | + description: The CI_PROVIDER repo variable, forwarded to cache-mount. |
| 7 | + required: false |
| 8 | + default: '' |
| 9 | + turbo-cache-key: |
| 10 | + description: Suffix for a Turbo cache mounted at ./.turbo. Empty skips the mount. Jobs that write Turbo entries need distinct suffixes, or last-writer-wins commits evict each other's entries. |
| 11 | + required: false |
| 12 | + default: '' |
| 13 | + |
| 14 | +# Cache keys are scoped by event name, and fork PRs get their own namespace on |
| 15 | +# top: untrusted fork runs must never share a cache with push runs (whose caches |
| 16 | +# feed production image builds) or with trusted internal-PR runs. |
| 17 | +# |
| 18 | +# node_modules also keys on the lockfile hash: a sticky disk is a mutable volume, |
| 19 | +# and `bun install --frozen-lockfile` adds what the lockfile needs without |
| 20 | +# pruning what it dropped, so branches on different lockfiles were contaminating |
| 21 | +# each other (a stale @next/swc 16.2.6 outlived the 16.2.11 bump). The bun and |
| 22 | +# Turbo caches are content/hash-addressed, so they stay shared — that is what |
| 23 | +# keeps a fresh node_modules disk cheap to fill. |
| 24 | +runs: |
| 25 | + using: composite |
| 26 | + steps: |
| 27 | + - name: Setup Bun |
| 28 | + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 |
| 29 | + with: |
| 30 | + bun-version: 1.4.2 |
| 31 | + |
| 32 | + - name: Setup Node |
| 33 | + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
| 34 | + with: |
| 35 | + node-version: 24 |
| 36 | + |
| 37 | + - name: Mount Bun cache |
| 38 | + uses: ./.github/actions/cache-mount |
| 39 | + with: |
| 40 | + provider: ${{ inputs.provider }} |
| 41 | + key: ${{ github.repository }}-bun-cache-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }} |
| 42 | + path: ~/.bun/install/cache |
| 43 | + |
| 44 | + - name: Mount node_modules |
| 45 | + uses: ./.github/actions/cache-mount |
| 46 | + with: |
| 47 | + provider: ${{ inputs.provider }} |
| 48 | + key: ${{ github.repository }}-node-modules-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}-${{ hashFiles('bun.lock') }} |
| 49 | + path: ./node_modules |
| 50 | + |
| 51 | + - name: Mount Turbo cache |
| 52 | + if: inputs.turbo-cache-key != '' |
| 53 | + uses: ./.github/actions/cache-mount |
| 54 | + with: |
| 55 | + provider: ${{ inputs.provider }} |
| 56 | + key: ${{ github.repository }}-${{ inputs.turbo-cache-key }}-${{ github.event_name }}${{ github.event.pull_request.head.repo.fork && '-fork' || '' }} |
| 57 | + path: ./.turbo |
| 58 | + |
| 59 | + - name: Install dependencies |
| 60 | + shell: bash |
| 61 | + run: bun install --frozen-lockfile --ignore-scripts |
0 commit comments