Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/actions/calculate-shard-matrix/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Calculate Shard Matrix"
description: "Calculates the dynamic test shard matrix and shard total"
outputs:
shard_matrix:
description: "JSON array of shard indices"
value: ${{ steps.set-matrix.outputs.shard_matrix }}
shard_total:
description: "Total number of shards"
value: ${{ steps.set-matrix.outputs.shard_total }}
runs:
using: "composite"
steps:
- name: Calculate Matrix
id: set-matrix
shell: bash
env:
DRY_RUN_SHARDS: true
BUILD_TYPE: presubmit
TEST_TYPE: units
GIT_DIFF_ARG: "HEAD^1"
run: |
bash ci/run_conditional_tests.sh --strict
31 changes: 31 additions & 0 deletions .github/actions/check-shard-status/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Check Shard Status"
description: "Checks if all unit test shards passed for a given Node version"
inputs:
node-version:
required: true
description: "Node version to check"
runs:
using: "composite"
steps:
- name: Check shard status
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
script: |
const { data: { jobs } } = await github.rest.actions.listJobsForWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
});
const nodeVersion = '${{ inputs.node-version }}';
const shardJobs = jobs.filter(j => j.name.includes(`units (Node ${nodeVersion},`));
if (shardJobs.length === 0) {
core.setFailed(`No shard jobs found for Node ${nodeVersion}`);
return;
}
const failed = shardJobs.filter(j => j.conclusion === 'failure' || j.conclusion === 'cancelled');
if (failed.length > 0) {
const failedLinks = failed.map(j => `- ${j.name}: ${j.html_url}`).join('\n');
core.setFailed(`${failed.length} shards failed for Node ${nodeVersion}:\n${failedLinks}`);
} else {
core.info(`All shards passed for Node ${nodeVersion}`);
}
33 changes: 33 additions & 0 deletions .github/actions/run-unit-tests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Run Unit Test Shard"
description: "Sets up Node.js, pnpm, and runs a unit test shard"
inputs:
node-version:
required: true
description: "Node.js version to test"
shard-total:
required: true
description: "Total number of shards"
shard-index:
required: true
description: "0-based shard index"
runs:
using: "composite"
steps:
- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: ${{ inputs.node-version }}
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
with:
version: ^10.0.0
- run: node --version
shell: bash
- name: Run unit tests
shell: bash
run: bash ci/run_conditional_tests.sh --strict
env:
BUILD_TYPE: presubmit
TEST_TYPE: units
SHARD_TOTAL: ${{ inputs.shard-total }}
SHARD_INDEX: ${{ inputs.shard-index }}
GIT_DIFF_ARG: HEAD^1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
pull_request:
paths:
- 'handwritten/storage/**'
name: storage-conformance
name: conformance
jobs:
conformance-test:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
pull_request:
paths:
- 'handwritten/bigtable/**'
name: bigtable-conformance
name: conformance
jobs:
conformance:
runs-on: ubuntu-latest
Expand Down
53 changes: 40 additions & 13 deletions .github/workflows/presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,37 @@ on:
pull_request:
name: presubmit
jobs:
setup:
runs-on: ubuntu-latest
outputs:
shard-matrix: ${{ steps.set-matrix.outputs.shard_matrix }}
shard-total: ${{ steps.set-matrix.outputs.shard_total }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 2
persist-credentials: false
- id: set-matrix
uses: ./.github/actions/calculate-shard-matrix
units:
needs: setup
name: units (Node ${{ matrix.node-version }}, Shard ${{ matrix.shard-index }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24, 26]
shard-index: ${{ fromJSON(needs.setup.outputs.shard-matrix) }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 300
fetch-depth: 2
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
- uses: ./.github/actions/run-unit-tests
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
with:
version: ^10.0.0
- run: node --version
- run: ci/run_conditional_tests.sh
name: Run unit tests
env:
BUILD_TYPE: presubmit
TEST_TYPE: units
shard-total: ${{ needs.setup.outputs.shard-total }}
shard-index: ${{ matrix.shard-index }}
lint:
runs-on: ubuntu-latest
continue-on-error: true
Expand All @@ -42,6 +50,25 @@ jobs:
node-version: 24
- run: npm install
- run: node ./bin/linter.mjs --strict
name: Run monorepo linter
env:
GIT_DIFF_ARG: "HEAD^1"

# Dummy jobs to satisfy branch protection requirements for each node version
units-status:
name: units (${{ matrix.node-version }})
needs: units
runs-on: ubuntu-latest
if: always()
strategy:
fail-fast: false
matrix:
node-version: [22, 24, 26]
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Check shard status
uses: ./.github/actions/check-shard-status
with:
node-version: ${{ matrix.node-version }}
>>>>>>> 657c33a5f3 (feat(ci): run unit-tests in parallel to speed them up)
50 changes: 38 additions & 12 deletions .github/workflows/windows-presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,53 @@ on:
pull_request:
name: presubmit-windows
jobs:
setup:
runs-on: ubuntu-latest
outputs:
shard-matrix: ${{ steps.set-matrix.outputs.shard_matrix }}
shard-total: ${{ steps.set-matrix.outputs.shard_total }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 2
persist-credentials: false
- id: set-matrix
uses: ./.github/actions/calculate-shard-matrix
units:
needs: setup
name: units (Node ${{ matrix.node-version }}, Shard ${{ matrix.shard-index }})
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
node-version: [22, 24, 26]
shard-index: ${{ fromJSON(needs.setup.outputs.shard-matrix) }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 300
fetch-depth: 2
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
- uses: ./.github/actions/run-unit-tests
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
shard-total: ${{ needs.setup.outputs.shard-total }}
shard-index: ${{ matrix.shard-index }}

# Dummy jobs to satisfy branch protection requirements for each node version
units-status:
name: units (${{ matrix.node-version }})
needs: units
runs-on: ubuntu-latest
if: always()
strategy:
fail-fast: false
matrix:
node-version: [22, 24, 26]
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
version: ^10.0.0
- run: node --version
- run: bash ci/run_conditional_tests.sh
name: Run windows unit tests
shell: bash
env:
BUILD_TYPE: presubmit
TEST_TYPE: units
persist-credentials: false
- name: Check shard status
uses: ./.github/actions/check-shard-status
with:
node-version: ${{ matrix.node-version }}
Loading
Loading