Skip to content

chore: drop CommonJS distribution. #773

chore: drop CommonJS distribution.

chore: drop CommonJS distribution. #773

Workflow file for this run

name: bench
permissions:
contents: read
on:
push:
branches:
- master
paths-ignore:
- '.github/workflows/preview.yml'
- 'assets/**'
- 'docs/**'
- 'example/**'
- 'site/**'
- '.gitignore'
- '.node-version'
- '.npmrc'
- '.nvmrc'
- '.prettierignore'
- '.prettierrc.json'
- '*.md'
- 'deno*'
- 'jsr*'
- 'LICENSE'
- 'outdated-typescript.d.ts'
pull_request:
paths-ignore:
- '.github/workflows/preview.yml'
- 'assets/**'
- 'docs/**'
- 'example/**'
- 'site/**'
- '.gitignore'
- '.node-version'
- '.npmrc'
- '.nvmrc'
- '.prettierignore'
- '.prettierrc.json'
- '*.md'
- 'deno*'
- 'jsr*'
- 'LICENSE'
- 'outdated-typescript.d.ts'
workflow_dispatch:
jobs:
typescript:
name: TypeScript Benchmarks
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- name: Use Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
cache: 'pnpm'
node-version: lts/*
- name: Install dependencies
run: pnpm install
- name: Run benchmarks
id: bench
run: |
# Run benchmarks and capture output
pnpm bench:ts > /tmp/bench_output.txt 2>&1
exit_code=$?
# Extract summary (everything from "⏱️" to end of file)
summary=$(grep -A999 "⏱️" /tmp/bench_output.txt || echo "✅ ⏱️ No benchmark changes detected.")
# Check if there are benchmark changes
if echo "$summary" | grep -q "No benchmark changes detected"; then
has_changes="false"
else
has_changes="true"
fi
# Set outputs
echo "benchmark_failed=$([ $exit_code -eq 0 ] && echo 'false' || echo 'true')" >> $GITHUB_OUTPUT
echo "has_changes=$has_changes" >> $GITHUB_OUTPUT
echo "summary<<EOF" >> $GITHUB_OUTPUT
echo "$summary" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Post benchmark results (with changes)
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && steps.bench.outputs.has_changes == 'true'
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
comment-tag: typescript-benchmarks
message: |
<details>
<summary>⏱️ <strong>TypeScript Benchmark Results</strong></summary>
```
${{ steps.bench.outputs.summary }}
```
</details>
- name: Post benchmark results (no changes)
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && steps.bench.outputs.has_changes == 'false'
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
comment-tag: typescript-benchmarks
message: |
⏱️ **TypeScript Benchmark Results**
```
${{ steps.bench.outputs.summary }}
```
- name: Fail job if benchmark command failed
if: steps.bench.outputs.benchmark_failed == 'true'
run: |
echo "Benchmark command failed with exit code 1"
exit 1