Skip to content
Merged
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
101 changes: 101 additions & 0 deletions .github/workflows/bench-skill-rowbinary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: "skill: rowbinary benchmarks"

# Runs the RowBinary skill's benchmark suite (npm run bench) against a live
# ClickHouse server so the numbers cited externally (e.g. the @clickhouse/rowbinary
# blog post: RowBinary vs JSON, monomorphized vs API-combinator readers) have a
# timestamped, third-party-reproducible CI log + a machine-readable JSON artifact
# behind them — not just a maintainer's laptop.
#
# Decoupled from the correctness suite (tests-skill-rowbinary.yml): benchmarks are
# slower and their throughput numbers are noisy, so they shouldn't gate every PR.
# This runs on demand (workflow_dispatch) and on PRs that touch the skill or this
# workflow.

permissions: {}
on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/bench-skill-rowbinary.yml
- skills/clickhouse-js-node-rowbinary/**
- packages/datatype-parser/**

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

env:
# Network resilience: npm's default of 2 fetch retries is not enough for
# the transient registry errors (ECONNRESET) we regularly hit in CI.
NPM_CONFIG_FETCH_RETRIES: "5"
NPM_CONFIG_FETCH_RETRY_MINTIMEOUT: "10000"
NPM_CONFIG_FETCH_RETRY_MAXTIMEOUT: "60000"
NPM_CONFIG_FETCH_TIMEOUT: "600000"

jobs:
benchmarks:
timeout-minutes: 20
runs-on: ubuntu-latest
defaults:
run:
working-directory: skills/clickhouse-js-node-rowbinary
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Start ClickHouse (latest) in Docker
uses: hoverkraft-tech/compose-action@11beaa1c2dae4e8ed7b1665aa074723b6cecb0e4 # v3.0.0
env:
CLICKHOUSE_VERSION: latest
with:
# The benchmarks only need the single-node HTTP server on :8123.
compose-file: "docker-compose.yml"
services: "clickhouse"
down-flags: "--volumes"

- name: Setup NodeJS
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24

- name: Record environment (CPU, Node, ClickHouse version)
run: |
echo "Node: $(node -v)"
echo "CPU cores: $(nproc)"
grep -m1 'model name' /proc/cpuinfo || true
# The server may still be starting; poll briefly so the version is captured.
for _ in $(seq 1 30); do
chv=$(curl -s 'http://localhost:8123/?query=SELECT%20version()')
[ -n "$chv" ] && break
sleep 1
done
echo "ClickHouse: ${chv:-<unavailable>}"

# Build + pack the in-repo @clickhouse/datatype-parser so the skill is
# benchmarked against THIS checkout, not the version published to npm. The
# committed package.json keeps a published range for end users; we only
# override node_modules below (`npm install <tarball> --no-save`).
- name: Pack local @clickhouse/datatype-parser
working-directory: ${{ github.workspace }}
run: |
npm ci
npm pack --workspace @clickhouse/datatype-parser --pack-destination "${{ runner.temp }}"

- name: Install dependencies
run: npm ci

- name: Use the local datatype-parser build
run: npm install "${{ runner.temp }}"/clickhouse-datatype-parser-*.tgz --no-save

# Prints the human-readable tinybench summary (per-bench hz + "Nx faster"
# lines, incl. the ledger RowBinary-vs-JSON comparison) to the job log, and
# writes the same numbers as JSON for the uploaded artifact.
- name: Run benchmarks
run: npm run bench -- --outputJson "${{ runner.temp }}/rowbinary-bench-results.json"

- name: Upload benchmark results (JSON)
if: ${{ always() }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: rowbinary-bench-results
path: ${{ runner.temp }}/rowbinary-bench-results.json
if-no-files-found: error
16 changes: 8 additions & 8 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ on:
- "tsconfig.dev.json"
- "eslint.config.base.mjs"
- "docker-compose.yml"
- "vitest.node.config.ts"
- "vitest.node.setup.ts"
- "vitest.web.config.ts"
- "vitest.web.setup.ts"
- "packages/client-node/vitest.config.ts"
- "packages/client-node/vitest.setup.ts"
- "packages/client-web/vitest.config.ts"
- "packages/client-web/vitest.setup.ts"
- ".github/workflows/examples.yml"
pull_request:
paths:
Expand All @@ -33,10 +33,10 @@ on:
- "tsconfig.dev.json"
- "eslint.config.base.mjs"
- "docker-compose.yml"
- "vitest.node.config.ts"
- "vitest.node.setup.ts"
- "vitest.web.config.ts"
- "vitest.web.setup.ts"
- "packages/client-node/vitest.config.ts"
- "packages/client-node/vitest.setup.ts"
- "packages/client-web/vitest.config.ts"
- "packages/client-web/vitest.setup.ts"
- ".github/workflows/examples.yml"

concurrency:
Expand Down
33 changes: 8 additions & 25 deletions .github/workflows/tests-bun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ on:
- "tsconfig.dev.json"
- "eslint.config.base.mjs"
- "docker-compose.yml"
- "vitest.node.config.ts"
- "vitest.node.setup.ts"
- "vitest.web.config.ts"
- "vitest.web.setup.ts"
- "packages/client-node/vitest.config.ts"
- "packages/client-node/vitest.setup.ts"
- "packages/client-web/vitest.config.ts"
- "packages/client-web/vitest.setup.ts"
- ".github/workflows/tests-bun.yml"
pull_request:
paths:
Expand All @@ -31,34 +31,17 @@ on:
- "tsconfig.dev.json"
- "eslint.config.base.mjs"
- "docker-compose.yml"
- "vitest.node.config.ts"
- "vitest.node.setup.ts"
- "vitest.web.config.ts"
- "vitest.web.setup.ts"
- "packages/client-node/vitest.config.ts"
- "packages/client-node/vitest.setup.ts"
- "packages/client-web/vitest.config.ts"
- "packages/client-web/vitest.setup.ts"
- ".github/workflows/tests-bun.yml"

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
common-unit-tests:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0

- name: Install dependencies
run: |
bun install

- name: Run common unit tests
run: |
npm run test:common:unit:bun

node-unit-tests:
timeout-minutes: 5
runs-on: ubuntu-latest
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/tests-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ on:
- "tsconfig.dev.json"
- "eslint.config.base.mjs"
- "docker-compose.yml"
- "vitest.node.config.ts"
- "vitest.node.setup.ts"
- "vitest.web.config.ts"
- "vitest.web.setup.ts"
- "packages/client-node/vitest.config.ts"
- "packages/client-node/vitest.setup.ts"
- "packages/client-web/vitest.config.ts"
- "packages/client-web/vitest.setup.ts"
- ".github/workflows/tests-dist.yml"
pull_request:
paths:
Expand All @@ -31,10 +31,10 @@ on:
- "tsconfig.dev.json"
- "eslint.config.base.mjs"
- "docker-compose.yml"
- "vitest.node.config.ts"
- "vitest.node.setup.ts"
- "vitest.web.config.ts"
- "vitest.web.setup.ts"
- "packages/client-node/vitest.config.ts"
- "packages/client-node/vitest.setup.ts"
- "packages/client-web/vitest.config.ts"
- "packages/client-web/vitest.setup.ts"
- ".github/workflows/tests-dist.yml"

schedule:
Expand Down
58 changes: 8 additions & 50 deletions .github/workflows/tests-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ on:
- "tsconfig.dev.json"
- "eslint.config.base.mjs"
- "docker-compose.yml"
- "vitest.node.config.ts"
- "vitest.node.setup.ts"
- "vitest.web.config.ts"
- "vitest.web.setup.ts"
- "packages/client-node/vitest.config.ts"
- "packages/client-node/vitest.setup.ts"
- "packages/client-web/vitest.config.ts"
- "packages/client-web/vitest.setup.ts"
- ".github/workflows/tests-node.yml"
pull_request:
paths:
Expand All @@ -31,10 +31,10 @@ on:
- "tsconfig.dev.json"
- "eslint.config.base.mjs"
- "docker-compose.yml"
- "vitest.node.config.ts"
- "vitest.node.setup.ts"
- "vitest.web.config.ts"
- "vitest.web.setup.ts"
- "packages/client-node/vitest.config.ts"
- "packages/client-node/vitest.setup.ts"
- "packages/client-web/vitest.config.ts"
- "packages/client-web/vitest.setup.ts"
- ".github/workflows/tests-node.yml"

schedule:
Expand Down Expand Up @@ -100,48 +100,6 @@ jobs:
fi
cat prettier-output.txt

common-unit-tests:
timeout-minutes: 5
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [20, 22, 24, 26]
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Setup NodeJS ${{ matrix.node }}
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
run: |
npm install

- name: Run unit tests
run: |
npm run test:common:unit:node

- name: Export coverage metrics
env:
COVERAGE_REPORT_NAME: ${{ github.job }} (${{ matrix.node }})
run: |
node .scripts/export-coverage-metrics.mjs

- name: Upload coverage to Codecov
# Codecov token is not available for Dependabot PRs or PRs from forks; skip the upload in those cases.
# Upload coverage from a single canonical combination (Node 24) so Codecov
# receives exactly one upload per flag (see codecov.yml).
if: ${{ github.triggering_actor != 'dependabot[bot]' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && matrix.node == 24 }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
name: node-common-unit
flags: node-common-unit
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
fail_ci_if_error: true

unit-tests:
timeout-minutes: 5
runs-on: ubuntu-latest
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/tests-oss-dependents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ on:
- "tsconfig.dev.json"
- "eslint.config.base.mjs"
- "docker-compose.yml"
- "vitest.node.config.ts"
- "vitest.node.setup.ts"
- "vitest.web.config.ts"
- "vitest.web.setup.ts"
- "packages/client-node/vitest.config.ts"
- "packages/client-node/vitest.setup.ts"
- "packages/client-web/vitest.config.ts"
- "packages/client-web/vitest.setup.ts"
- ".github/workflows/tests-oss-dependents.yml"
pull_request:
paths:
Expand All @@ -31,10 +31,10 @@ on:
- "tsconfig.dev.json"
- "eslint.config.base.mjs"
- "docker-compose.yml"
- "vitest.node.config.ts"
- "vitest.node.setup.ts"
- "vitest.web.config.ts"
- "vitest.web.setup.ts"
- "packages/client-node/vitest.config.ts"
- "packages/client-node/vitest.setup.ts"
- "packages/client-web/vitest.config.ts"
- "packages/client-web/vitest.setup.ts"
- ".github/workflows/tests-oss-dependents.yml"

schedule:
Expand Down
Loading
Loading