From 00984133fc2c722cc04e8dc539184df2a754ee73 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 15 May 2026 22:40:32 +0000 Subject: [PATCH] ci(preflight): extract preflight steps into a composite action Same 5-step preflight body (setup-bun, setup-node, cache, install, lint, format:check) was duplicated across 5 workflows. Move it to .github/actions/preflight/action.yml so future tweaks (adding typecheck, swapping the cache key, etc.) are a single-file change. Net diff: +33 / -65. Addresses the "shared preflight" follow-up Vai called out on #877. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/actions/preflight/action.yml | 31 ++++++++++++++++++++++++ .github/workflows/catalog-previews.yml | 14 +---------- .github/workflows/player-perf.yml | 14 +---------- .github/workflows/preview-regression.yml | 14 +---------- .github/workflows/regression.yml | 14 +---------- .github/workflows/windows-render.yml | 14 +---------- 6 files changed, 36 insertions(+), 65 deletions(-) create mode 100644 .github/actions/preflight/action.yml diff --git a/.github/actions/preflight/action.yml b/.github/actions/preflight/action.yml new file mode 100644 index 000000000..dd78d6888 --- /dev/null +++ b/.github/actions/preflight/action.yml @@ -0,0 +1,31 @@ +name: Preflight +description: | + Cheap lint + format gate that runs before expensive CI jobs (regression + shards, perf shards, parity renders, Windows renders, catalog previews). + Single source of truth for the gate's bun/node/cache/lint/format steps — + tweak here and every preflight job picks it up. + +runs: + using: composite + steps: + - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 + + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 + with: + node-version: 22 + + - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4 + with: + path: ~/.bun/install/cache + key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }} + restore-keys: | + bun-${{ runner.os }}- + + - shell: bash + run: bun install --frozen-lockfile + + - shell: bash + run: bun run lint + + - shell: bash + run: bun run format:check diff --git a/.github/workflows/catalog-previews.yml b/.github/workflows/catalog-previews.yml index b4734eda9..3c6263979 100644 --- a/.github/workflows/catalog-previews.yml +++ b/.github/workflows/catalog-previews.yml @@ -23,19 +23,7 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version: 22 - - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # 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 lint - - run: bun run format:check + - uses: ./.github/actions/preflight render-previews: name: Render catalog previews diff --git a/.github/workflows/player-perf.yml b/.github/workflows/player-perf.yml index 9bfb95407..5a4926079 100644 --- a/.github/workflows/player-perf.yml +++ b/.github/workflows/player-perf.yml @@ -45,19 +45,7 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version: 22 - - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # 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 lint - - run: bun run format:check + - uses: ./.github/actions/preflight perf-shards: name: "Perf: ${{ matrix.shard }}" diff --git a/.github/workflows/preview-regression.yml b/.github/workflows/preview-regression.yml index 6a3d89516..af1bf93a9 100644 --- a/.github/workflows/preview-regression.yml +++ b/.github/workflows/preview-regression.yml @@ -49,19 +49,7 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version: 22 - - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # 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 lint - - run: bun run format:check + - uses: ./.github/actions/preflight preview-parity: name: Preview parity diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 2d5c4d1e0..62e2bc503 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -42,19 +42,7 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version: 22 - - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # 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 lint - - run: bun run format:check + - uses: ./.github/actions/preflight regression-shards: needs: [changes, preflight] diff --git a/.github/workflows/windows-render.yml b/.github/workflows/windows-render.yml index 7804ad0a7..f5e8f19f1 100644 --- a/.github/workflows/windows-render.yml +++ b/.github/workflows/windows-render.yml @@ -67,19 +67,7 @@ jobs: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: ref: ${{ github.event.inputs.ref }} - - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version: 22 - - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # 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 lint - - run: bun run format:check + - uses: ./.github/actions/preflight render-windows: name: Render on windows-latest