Skip to content

Commit

Permalink
feat: add codspeed benchmarks tracking to compare performance changes
Browse files Browse the repository at this point in the history
  • Loading branch information
patzick committed Jan 31, 2024
1 parent 280b1b6 commit 8246e8c
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/codspeed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: codspeed-benchmarks

on:
push:
branches:
- "main" # or "master"
pull_request:
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:

jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-node@v4"
with:
node-version: 20
- run: corepack enable
- run: pnpm --version
- uses: actions/setup-node@v3
with:
node-version: 20
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- name: install
run: pnpm install --frozen-lockfile --prefer-offline
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
run: pnpm run test:bench
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"test": "turbo run test",
"test:bench": "turbo run test:bench",
"test:e2e": "turbo run test:e2e",
"format": "prettier --write \"**/*.{ts,tsx,md,vue}\"",
"version": "changeset version",
Expand Down
1 change: 1 addition & 0 deletions packages/api-client-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"test:watch": "vitest"
},
"devDependencies": {
"@codspeed/vitest-plugin": "^2.3.1",
"@shopware/api-gen": "workspace:*",
"@types/prettier": "^3.0.0",
"@vitest/coverage-v8": "^1.2.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/api-client-next/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { defineConfig } from "vitest/config";
import codspeedPlugin from "@codspeed/vitest-plugin";

export default defineConfig({
plugins: [codspeedPlugin()],
test: {
coverage: {
enabled: true,
Expand Down
1 change: 0 additions & 1 deletion packages/api-gen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"lint": "eslint src/**/*.ts* --fix --max-warnings=0 && pnpm run typecheck",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:bench": "vitest bench",
"test:watch": "vitest"
},
"devDependencies": {
Expand Down
63 changes: 62 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"dependsOn": ["^build"],
"outputs": []
},
"test:bench": {
"outputs": []
},
"dev": {
"cache": false
},
Expand Down

0 comments on commit 8246e8c

Please sign in to comment.