fix(ci): isolate bun cache per job

This commit is contained in:
Tam Nhu Tran
2026-04-21 12:34:43 -04:00
parent 478d64a50a
commit 08edf1eef4
+13 -5
View File
@@ -17,13 +17,17 @@ concurrency:
jobs:
validate:
runs-on: [self-hosted, linux, x64]
env:
# Keep Bun cache isolated per job workspace so parallel self-hosted runs
# do not race on ~/.bun/install/cache and corrupt restore/install state.
BUN_INSTALL_CACHE_DIR: ${{ github.workspace }}/.bun/install/cache
strategy:
fail-fast: false
matrix:
check:
- { name: typecheck, cmd: 'bun run typecheck' }
- { name: lint, cmd: 'bun run lint' }
- { name: format, cmd: 'bun run format:check' }
- { name: lint, cmd: 'bun run lint' }
- { name: format, cmd: 'bun run format:check' }
name: ${{ matrix.check.name }}
steps:
@@ -44,7 +48,7 @@ jobs:
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
${{ env.BUN_INSTALL_CACHE_DIR }}
key: ${{ runner.os }}-bun-cache-v2-${{ hashFiles('bun.lock', 'ui/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-cache-v2-
@@ -58,6 +62,8 @@ jobs:
build:
runs-on: [self-hosted, linux, x64]
name: build
env:
BUN_INSTALL_CACHE_DIR: ${{ github.workspace }}/.bun/install/cache
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -76,7 +82,7 @@ jobs:
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
${{ env.BUN_INSTALL_CACHE_DIR }}
key: ${{ runner.os }}-bun-cache-v2-${{ hashFiles('bun.lock', 'ui/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-cache-v2-
@@ -99,6 +105,8 @@ jobs:
runs-on: [self-hosted, linux, x64]
name: test
needs: [build]
env:
BUN_INSTALL_CACHE_DIR: ${{ github.workspace }}/.bun/install/cache
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -117,7 +125,7 @@ jobs:
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
${{ env.BUN_INSTALL_CACHE_DIR }}
key: ${{ runner.os }}-bun-cache-v2-${{ hashFiles('bun.lock', 'ui/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-cache-v2-