From 08edf1eef4459927ef72b794df0969b33460dd81 Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Tue, 21 Apr 2026 12:34:43 -0400 Subject: [PATCH] fix(ci): isolate bun cache per job --- .github/workflows/ci.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb7f95c7..0b5bf26a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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-