From 1c5c510a6c8b03dd558f60f64bb30e47da4da2c2 Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Fri, 21 Aug 2026 21:42:57 -0700 Subject: [PATCH] CI: cache installs and lint, and check only what a PR changes The affected-package filter and the lint caches from CL-6589 only ever helped a local run. CI checks out fresh, never set WORKBENCH_CHECK_SINCE, and threw both caches away every time, so every PR paid for all 110 packages and a cold 108-second eslint. - fetch-depth: 0 so the filter can resolve a merge base. - WORKBENCH_CHECK_SINCE is the PR's base commit for typecheck and test. A push to main leaves it unset and still checks everything, so main is never validated by a subset. - Bun's install cache is keyed on the lockfile; the eslint and prettier caches restore from the most recent run. A pull request now typechecks and tests the packages it can actually break instead of the whole workspace. --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abf8e166..868b4b51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,40 +24,79 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: oven-sh/setup-bun@v2 with: bun-version: latest + - uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }} + restore-keys: bun-${{ runner.os }}- - run: bun install --frozen-lockfile + - uses: actions/cache@v4 + with: + path: | + .eslintcache + node_modules/.cache/prettier + key: lint-${{ runner.os }}-${{ github.sha }} + restore-keys: lint-${{ runner.os }}- - run: bun run lint typecheck: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: oven-sh/setup-bun@v2 with: bun-version: latest + - uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }} + restore-keys: bun-${{ runner.os }}- - run: bun install --frozen-lockfile - run: bun run typecheck + env: + WORKBENCH_CHECK_SINCE: ${{ github.event.pull_request.base.sha }} build-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: oven-sh/setup-bun@v2 with: bun-version: latest + - uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }} + restore-keys: bun-${{ runner.os }}- - run: bun install --frozen-lockfile - run: bun run build - run: bun run test + env: + WORKBENCH_CHECK_SINCE: ${{ github.event.pull_request.base.sha }} structural: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: oven-sh/setup-bun@v2 with: bun-version: latest + - uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }} + restore-keys: bun-${{ runner.os }}- - run: bun install --frozen-lockfile - name: Structural check self-tests run: bun test scripts/checks/test @@ -99,9 +138,16 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: oven-sh/setup-bun@v2 with: bun-version: latest + - uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }} + restore-keys: bun-${{ runner.os }}- - run: bun install --frozen-lockfile # The committed template ships a placeholder secret and a