Skip to content

[typespec-java] flatten typespec-java, cleanup autorest related code … #1346

[typespec-java] flatten typespec-java, cleanup autorest related code …

[typespec-java] flatten typespec-java, cleanup autorest related code … #1346

Workflow file for this run

name: Benchmark
on:
push:
branches:
- main
pull_request:
branches:
- main
- release/*
workflow_dispatch:
inputs:
backfill_from:
description: "Backfill from: commit SHA or number of recent commits. Leave empty to run a normal benchmark."
required: false
type: string
branch:
description: "Data branch to store results (default: benchmark-data)"
required: false
type: string
default: "benchmark-data"
runner:
description: "Runner label (for stable runs prefer self-hosted or larger dedicated runner)"
required: false
type: string
default: "ubuntu-latest"
permissions:
contents: write
concurrency:
group: benchmark-${{ github.ref }}
cancel-in-progress: true
jobs:
benchmark:
name: Run Benchmarks
runs-on: ${{ github.event_name == 'workflow_dispatch' && inputs.runner || vars.BENCHMARK_RUNNER || 'ubuntu-latest' }}
env:
TYPESPEC_VS_CI_BUILD: true
TYPESPEC_SKIP_WEBSITE_BUILD: true
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: 24.15.0
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm -r --filter "@azure-tools/typespec-benchmark..." build
- name: Run backfill
if: ${{ github.event_name == 'workflow_dispatch' && inputs.backfill_from }}
run: |
node --max-old-space-size=6144 packages/benchmark/dist/src/cli.js backfill \
--from ${{ inputs.backfill_from }} \
--specs-dir packages/benchmark/specs \
--iterations 25 \
--warmup 3 \
--branch ${{ inputs.branch }} \
--push
- name: Run benchmarks
if: ${{ github.event_name != 'workflow_dispatch' || !inputs.backfill_from }}
run: |
node --max-old-space-size=6144 packages/benchmark/dist/src/cli.js run \
--specs-dir packages/benchmark/specs \
--iterations 25 \
--warmup 3 \
--noise-cv-threshold 0.08 \
--max-reruns 1 \
--rerun-iterations 10 \
--commit ${{ github.sha }} \
--output /tmp/benchmark-results.json
# On push to main: store results to benchmark-data branch
- name: Store benchmark results
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
node packages/benchmark/dist/src/cli.js store-results \
--results /tmp/benchmark-results.json \
--commit ${{ github.sha }}
# On PR: fetch baseline, compare, and upload as artifact for the comment workflow
- name: Generate PR comment
if: github.event_name == 'pull_request'
run: |
node packages/benchmark/dist/src/cli.js upload-pr-comment \
--results /tmp/benchmark-results.json \
--pr-number ${{ github.event.number }} \
--baseline-window 20 \
--output-dir /tmp/benchmark-artifacts
- name: Upload benchmark comment
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v7
with:
name: benchmark-comment
path: /tmp/benchmark-artifacts/
retention-days: 1