.github/workflows/codspeed.yml
name: codspeed-benchmarks
on:
push:
branches:
- "main"
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
strategy:
matrix:
node-version: [ 20.x ]
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
# Fetch all git history so that yarn workspaces --since can compare with the correct commits
# @link https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
fetch-depth: 0
- name: ⚙️ Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: ⚙️ Nx setup - SHAs for base and head for `nx affected` commands
id: nx-set-shas
uses: nrwl/nx-set-shas@v4
- run: |
echo "BASE: ${{ steps.nx-set-shas.outputs.base }}"
echo "HEAD: ${{ steps.nx-set-shas.outputs.head }}"
- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install
- name: 🌠 Run benchmarks
uses: CodSpeedHQ/action@v3
with:
run: yarn g:bench-codspeed
token: ${{ secrets.CODSPEED_TOKEN }}