Repository navigation
control codspeed vs vitest in benchmark #382
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Benchmark | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled] | |
| workflow_dispatch: | |
| env: | |
| MISE_IDIOMATIC_VERSION_FILE_ENABLE_TOOLS: node,pnpm | |
| jobs: | |
| benchmarks: | |
| name: Run benchmarks (${{ matrix.use-codspeed && 'CodSpeed' || 'Vitest' }}) | |
| # use a matrix to compute whether to use CodSpeed as that can be directly tied to runs-on and the steps as one var | |
| strategy: | |
| matrix: | |
| include: | |
| - use-codspeed: >- | |
| ${{ vars.CODSPEED_ENABLED == 'true' && ( | |
| github.ref == 'refs/heads/main' || ( | |
| github.event_name == 'pull_request' && | |
| github.event.action == 'labeled' && | |
| github.event.label.name == 'performance' | |
| ) | |
| ) }} | |
| runs-on: ${{ matrix.use-codspeed && 'codspeed-macro-arm64-graviton-ubuntu-22-04' || 'ubuntu-latest' }} | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0 | |
| - run: pnpm install --frozen-lockfile | |
| - name: Run benchmarks with CodSpeed | |
| if: ${{ matrix.use-codspeed }} | |
| uses: CodSpeedHQ/action@78102a468f96d8e0ccb92d0ec49425753fc42062 # v5 | |
| with: | |
| mode: walltime,memory | |
| run: pnpm bench | |
| - name: Run benchmarks without CodSpeed | |
| if: ${{ !matrix.use-codspeed }} | |
| run: pnpm bench |