Skip to content
Draft
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
18 changes: 1 addition & 17 deletions .github/workflows/client-nav-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,7 @@
name: Benchmarks

on:
push:
# Broad on purpose: CodSpeed compares each PR against the run on its
# merge-base commit. Skipping main pushes that don't touch packages/**
# (pnpm config, CI, root tooling) leaves those commits without a baseline
# run, and CodSpeed silently falls back to an older, possibly outlier run —
# which then flags phantom regressions on every PR until the next eligible
# push. Only paths that cannot affect benchmark results are excluded.
branches:
- 'main'
paths-ignore:
- 'docs/**'
- 'examples/**'
- 'e2e/**'
pull_request:
paths:
- 'packages/**'
- 'benchmarks/**'
# CI runs these benchmarks through the PR workflow's Nx Agents.
workflow_dispatch:

permissions:
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
env:
TSR_TMP_DIR: ./tmp
steps:
Expand All @@ -27,7 +30,12 @@ jobs:
fetch-depth: 0
persist-credentials: false
- name: Start Nx Agents
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
run: |
codspeed_env_vars="ACTIONS_ID_TOKEN_REQUEST_TOKEN,ACTIONS_ID_TOKEN_REQUEST_URL,CI,GITHUB_ACTIONS,GITHUB_ACTOR,GITHUB_ACTOR_ID,GITHUB_API_URL,GITHUB_BASE_REF,GITHUB_EVENT_NAME,GITHUB_HEAD_REF,GITHUB_JOB,GITHUB_REF,GITHUB_REF_NAME,GITHUB_REF_TYPE,GITHUB_REPOSITORY,GITHUB_REPOSITORY_ID,GITHUB_RUN_ATTEMPT,GITHUB_RUN_ID,GITHUB_RUN_NUMBER,GITHUB_SERVER_URL,GITHUB_SHA,GITHUB_WORKFLOW,GITHUB_WORKFLOW_REF,GITHUB_WORKFLOW_SHA,GITHUB_WORKSPACE"

npx nx-cloud start-ci-run \
--distribute-on=".nx/workflows/dynamic-changesets.yaml" \
--with-env-vars="$codspeed_env_vars"
- name: Setup Tools
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
- name: Get base and head commits for `nx affected`
Expand All @@ -36,6 +44,17 @@ jobs:
main-branch-name: main
- name: Run Checks
run: pnpm run test:pr --parallel=3
- name: Run CodeSpeed Benchmarks
run: |
if [ -z "$CODSPEED_TOKEN" ] && { [ -z "$ACTIONS_ID_TOKEN_REQUEST_TOKEN" ] || [ -z "$ACTIONS_ID_TOKEN_REQUEST_URL" ]; }; then
echo "::notice::Skipping CodeSpeed benchmarks because neither CODSPEED_TOKEN nor GitHub OIDC auth is configured for Nx Agent execution."
exit 0
fi

pnpm nx run-many \
--projects=@benchmarks/client-nav,@benchmarks/ssr \
--targets=test:codspeed:react,test:codspeed:solid,test:codspeed:vue \
--outputStyle=stream
- name: Stop Nx Agents
if: ${{ always() }}
run: npx nx-cloud stop-all-agents
Expand Down
7 changes: 7 additions & 0 deletions .nx/workflows/dynamic-changesets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@ distribute-on:
small-changeset: 4 linux-medium-js
medium-changeset: 8 linux-medium-js
large-changeset: 14 linux-medium-js

assignment-rules:
- targets:
- 'test:codspeed:*'
run-on:
- agent: linux-medium-js
parallelism: 1
78 changes: 75 additions & 3 deletions benchmarks/client-nav/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"test:perf:react": "NODE_ENV=production vitest bench --config ./vitest.react.config.ts",
"test:perf:solid": "NODE_ENV=production vitest bench --config ./vitest.solid.config.ts",
"test:perf:vue": "NODE_ENV=production vitest bench --config ./vitest.vue.config.ts",
"test:codspeed:react": "node ../../scripts/nx/run-codspeed-benchmark.mjs client-nav react",
"test:codspeed:solid": "node ../../scripts/nx/run-codspeed-benchmark.mjs client-nav solid",
"test:codspeed:vue": "node ../../scripts/nx/run-codspeed-benchmark.mjs client-nav vue",
"test:types": "pnpm run test:types:react && pnpm run test:types:solid && pnpm run test:types:vue",
"test:types:react": "tsc -p ./react/tsconfig.json --noEmit",
"test:types:solid": "tsc -p ./solid/tsconfig.json --noEmit",
Expand Down Expand Up @@ -45,7 +48,14 @@
"nx": {
"targets": {
"build:react": {
"cache": false,
"cache": true,
"inputs": [
"production",
"^production"
],
"outputs": [
"{projectRoot}/react/dist"
],
"dependsOn": [
{
"projects": [
Expand Down Expand Up @@ -73,7 +83,14 @@
]
},
"build:solid": {
"cache": false,
"cache": true,
"inputs": [
"production",
"^production"
],
"outputs": [
"{projectRoot}/solid/dist"
],
"dependsOn": [
{
"projects": [
Expand Down Expand Up @@ -101,7 +118,14 @@
]
},
"build:vue": {
"cache": false,
"cache": true,
"inputs": [
"production",
"^production"
],
"outputs": [
"{projectRoot}/vue/dist"
],
"dependsOn": [
{
"projects": [
Expand Down Expand Up @@ -172,6 +196,54 @@
"build:vue"
]
},
"test:codspeed:react": {
"cache": true,
"inputs": [
"default",
"^production",
{
"env": "GITHUB_RUN_ID"
},
{
"env": "GITHUB_RUN_ATTEMPT"
}
],
"dependsOn": [
"build:react"
]
},
"test:codspeed:solid": {
"cache": true,
"inputs": [
"default",
"^production",
{
"env": "GITHUB_RUN_ID"
},
{
"env": "GITHUB_RUN_ATTEMPT"
}
],
"dependsOn": [
"build:solid"
]
},
"test:codspeed:vue": {
"cache": true,
"inputs": [
"default",
"^production",
{
"env": "GITHUB_RUN_ID"
},
{
"env": "GITHUB_RUN_ATTEMPT"
}
],
"dependsOn": [
"build:vue"
]
},
"test:types": {
"cache": false,
"dependsOn": [
Expand Down
66 changes: 63 additions & 3 deletions benchmarks/memory/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"targets": {
"build:react": {
"executor": "nx:noop",
"cache": false,
"cache": true,
"dependsOn": [
{
"projects": [
Expand All @@ -57,7 +57,7 @@
},
"build:solid": {
"executor": "nx:noop",
"cache": false,
"cache": true,
"dependsOn": [
{
"projects": [
Expand All @@ -74,7 +74,7 @@
},
"build:vue": {
"executor": "nx:noop",
"cache": false,
"cache": true,
"dependsOn": [
{
"projects": [
Expand Down Expand Up @@ -227,6 +227,66 @@
"cwd": "benchmarks/memory/client"
}
},
"test:codspeed:react": {
"executor": "nx:run-commands",
"cache": true,
"inputs": [
"default",
"^production",
{
"env": "GITHUB_RUN_ID"
},
{
"env": "GITHUB_RUN_ATTEMPT"
}
],
"dependsOn": [
"build:react"
],
"options": {
"command": "node scripts/nx/run-codspeed-benchmark.mjs memory-client react"
}
},
"test:codspeed:solid": {
"executor": "nx:run-commands",
"cache": true,
"inputs": [
"default",
"^production",
{
"env": "GITHUB_RUN_ID"
},
{
"env": "GITHUB_RUN_ATTEMPT"
}
],
"dependsOn": [
"build:solid"
],
"options": {
"command": "node scripts/nx/run-codspeed-benchmark.mjs memory-client solid"
}
},
"test:codspeed:vue": {
"executor": "nx:run-commands",
"cache": true,
"inputs": [
"default",
"^production",
{
"env": "GITHUB_RUN_ID"
},
{
"env": "GITHUB_RUN_ATTEMPT"
}
],
"dependsOn": [
"build:vue"
],
"options": {
"command": "node scripts/nx/run-codspeed-benchmark.mjs memory-client vue"
}
},
"test:types": {
"executor": "nx:noop",
"dependsOn": [
Expand Down
66 changes: 63 additions & 3 deletions benchmarks/memory/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"targets": {
"build:react": {
"executor": "nx:noop",
"cache": false,
"cache": true,
"dependsOn": [
{
"projects": [
Expand All @@ -55,7 +55,7 @@
},
"build:solid": {
"executor": "nx:noop",
"cache": false,
"cache": true,
"dependsOn": [
{
"projects": [
Expand All @@ -73,7 +73,7 @@
},
"build:vue": {
"executor": "nx:noop",
"cache": false,
"cache": true,
"dependsOn": [
{
"projects": [
Expand Down Expand Up @@ -233,6 +233,66 @@
"cwd": "benchmarks/memory/server"
}
},
"test:codspeed:react": {
"executor": "nx:run-commands",
"cache": true,
"inputs": [
"default",
"^production",
{
"env": "GITHUB_RUN_ID"
},
{
"env": "GITHUB_RUN_ATTEMPT"
}
],
"dependsOn": [
"build:react"
],
"options": {
"command": "node scripts/nx/run-codspeed-benchmark.mjs memory-server react"
}
},
"test:codspeed:solid": {
"executor": "nx:run-commands",
"cache": true,
"inputs": [
"default",
"^production",
{
"env": "GITHUB_RUN_ID"
},
{
"env": "GITHUB_RUN_ATTEMPT"
}
],
"dependsOn": [
"build:solid"
],
"options": {
"command": "node scripts/nx/run-codspeed-benchmark.mjs memory-server solid"
}
},
"test:codspeed:vue": {
"executor": "nx:run-commands",
"cache": true,
"inputs": [
"default",
"^production",
{
"env": "GITHUB_RUN_ID"
},
{
"env": "GITHUB_RUN_ATTEMPT"
}
],
"dependsOn": [
"build:vue"
],
"options": {
"command": "node scripts/nx/run-codspeed-benchmark.mjs memory-server vue"
}
},
"test:types": {
"executor": "nx:noop",
"dependsOn": [
Expand Down
Loading
Loading