-
-
Notifications
You must be signed in to change notification settings - Fork 14
49 lines (42 loc) · 1.55 KB
/
benchmark.yml
File metadata and controls
49 lines (42 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Benchmark
on:
pull_request:
branches: [main]
jobs:
benchmark:
name: Benchmark
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Run benchmarks
id: benchmark
run: |
bun run bench > benchmark-results.txt 2>&1 || true
cat benchmark-results.txt
- name: Comment PR with benchmark results
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const benchmarkResults = fs.readFileSync('benchmark-results.txt', 'utf8');
const comment = '## Benchmark Results\n\n```\n' + benchmarkResults + '\n```';
const params = {
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
};
github.rest.issues.createComment(params);