ci: don't run benchmark on main commits by default

This commit is contained in:
Daniel Roe 2023-12-21 14:59:23 +00:00
parent a46b0c876c
commit 064615e8c2
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B
2 changed files with 64 additions and 40 deletions

54
.github/workflows/benchmark.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: benchmark
on:
workflow_dispatch:
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
branches:
- main
- "!v[0-9]*"
# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml
env:
# 7 GiB by default on GitHub, setting to 6 GiB
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
NODE_OPTIONS: --max-old-space-size=6144
# install playwright binary manually (because pnpm only runs install script once)
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
# Remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: ${{ github.event_name != 'push' }}
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- run: corepack enable
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build (stub)
run: pnpm dev:prepare
- name: Build
run: pnpm build
- name: Run benchmarks
uses: CodSpeedHQ/action@ad0378e48c3cb4c700f1cdc5e10943dbad3cc4ec # v2.0.2
with:
run: pnpm vitest bench
token: ${{ secrets.CODSPEED_TOKEN }}

View File

@ -23,7 +23,6 @@ env:
# install playwright binary manually (because pnpm only runs install script once) # install playwright binary manually (because pnpm only runs install script once)
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
# Remove default permissions of GITHUB_TOKEN for security # Remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs # https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions: {} permissions: {}
@ -102,35 +101,6 @@ jobs:
with: with:
category: "/language:javascript" category: "/language:javascript"
benchmark:
runs-on: ubuntu-latest
permissions: {}
needs:
- build
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- run: corepack enable
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Restore dist cache
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
with:
name: dist
path: packages
- name: Run benchmarks
uses: CodSpeedHQ/action@ad0378e48c3cb4c700f1cdc5e10943dbad3cc4ec # v2.0.2
with:
run: pnpm vitest bench
token: ${{ secrets.CODSPEED_TOKEN }}
typecheck: typecheck:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 10 timeout-minutes: 10
@ -140,7 +110,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
module: ['bundler', 'node'] module: ["bundler", "node"]
steps: steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@ -223,16 +193,16 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
env: ['dev', 'built'] env: ["dev", "built"]
builder: ['vite', 'webpack'] builder: ["vite", "webpack"]
context: ['async', 'default'] context: ["async", "default"]
manifest: ['manifest-on', 'manifest-off'] manifest: ["manifest-on", "manifest-off"]
node: [18] node: [18]
exclude: exclude:
- env: 'dev' - env: "dev"
builder: 'webpack' builder: "webpack"
- manifest: 'manifest-off' - manifest: "manifest-off"
builder: 'webpack' builder: "webpack"
timeout-minutes: 15 timeout-minutes: 15