ci: split test workflow across shards

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-15 11:41:35 +09:00
parent 53de295b21
commit fdd40815ba
2 changed files with 71 additions and 12 deletions
+53 -5
View File
@@ -32,7 +32,34 @@ jobs:
echo "PR targets '${BASE_REF}' branch - OK"
fi
test:
test-isolated:
name: Isolated tests (${{ matrix.shard }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3]
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.12"
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-1.3.12-${{ hashFiles('bun.lock') }}
- name: Install dependencies
run: bun install --frozen-lockfile
env:
BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi"
- name: Run isolated tests
run: bun run script/run-ci-tests.ts --phase=isolated --shard-count=4 --shard-index=${{ matrix.shard }}
test-shared:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -41,16 +68,24 @@ jobs:
with:
bun-version: "1.3.12"
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-1.3.12-${{ hashFiles('bun.lock') }}
- name: Install dependencies
run: bun install --frozen-lockfile
env:
BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/napi"
- name: Build plugin
run: bun run build
- name: Run shared tests
run: bun run script/run-ci-tests.ts --phase=shared
- name: Run tests
run: bun run script/run-ci-tests.ts
test:
runs-on: ubuntu-latest
needs: [test-isolated, test-shared]
steps:
- run: echo "All test shards passed"
typecheck:
runs-on: ubuntu-latest
@@ -61,6 +96,11 @@ jobs:
with:
bun-version: "1.3.12"
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-1.3.12-${{ hashFiles('bun.lock') }}
- name: Install dependencies
run: bun install --frozen-lockfile
env:
@@ -86,6 +126,11 @@ jobs:
with:
bun-version: "1.3.12"
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-1.3.12-${{ hashFiles('bun.lock') }}
- name: Install dependencies
run: bun install --frozen-lockfile
env:
@@ -99,6 +144,9 @@ jobs:
test -f dist/index.js || (echo "ERROR: dist/index.js not found!" && exit 1)
test -f dist/index.d.ts || (echo "ERROR: dist/index.d.ts not found!" && exit 1)
- name: Verify dist bundle tests
run: bun test src/shared/dist-bundle-bun-globals.test.ts
- name: Auto-commit schema changes
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |