Skip to content

Commit

Permalink
Dry run to see real data in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hyf0 committed Mar 31, 2024
1 parent b1114cd commit 776678c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ jobs:
- name: Build packages
run: pnpm build:release

- name: Dry Run
uses: CodSpeedHQ/action@v2
with:
run: pnpm --filter bench run bench-ci
env:
DISABLE_CODSPEED: true

- name: Run the benchmarks
uses: CodSpeedHQ/action@v2
with:
Expand Down
15 changes: 11 additions & 4 deletions packages/bench/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { defineConfig } from 'vitest/config'
// @ts-expect-error: `@codspeed/vitest-plugin` doesn't specify `types` in `package.json#exports`.
import codspeedPlugin from '@codspeed/vitest-plugin'
const IS_CI = !!process.env.CI
const DISABLE_CODSPEED = !!process.env.DISABLE_CODSPEED

export default defineConfig({
plugins: process.env.CI ? [codspeedPlugin()] : [],
export default defineConfig(async () => {
let codspeedPlugin
if (!DISABLE_CODSPEED && IS_CI) {
// @ts-expect-error: `@codspeed/vitest-plugin` doesn't specify `types` in `package.json#exports`.
codspeedPlugin = (await import('@codspeed/vitest-plugin')).default
}
return {
plugins: [codspeedPlugin].filter(Boolean),
}
})

0 comments on commit 776678c

Please sign in to comment.