-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (87 loc) · 2.74 KB
/
Copy pathci.yml
File metadata and controls
107 lines (87 loc) · 2.74 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Benchmark
on:
push:
branches:
- main
paths:
- 'src/**'
- 'benchmark/**'
pull_request:
branches:
- main
paths:
- 'src/**'
- 'benchmark/**'
workflow_dispatch:
permissions:
contents: write
jobs:
benchmark:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y cmake wget
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22
sudo apt-get update
wget https://github.com/sharkdp/hyperfine/releases/download/v1.20.0/hyperfine_1.20.0_amd64.deb
sudo dpkg -i hyperfine_1.20.0_amd64.deb
- name: Select LLVM 22
run: |
echo "CC=clang-22" >> "$GITHUB_ENV"
echo "CXX=clang++-22" >> "$GITHUB_ENV"
echo "AR=llvm-ar-22" >> "$GITHUB_ENV"
echo "NM=llvm-nm-22" >> "$GITHUB_ENV"
echo "RANLIB=llvm-ranlib-22" >> "$GITHUB_ENV"
echo "/usr/lib/llvm-22/bin" >> "$GITHUB_PATH"
- name: Verify LLVM 22
run: |
clang-22 --version
llvm-config-22 --version
- name: Build
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
clang ./benchmark/bf.c -o build/simple_c -O3
- name: Run benchmarks
run: |
set -euo pipefail
result_file="$(mktemp)"
block_file="$(mktemp)"
tmp_readme="$(mktemp)"
trap 'rm -f "$result_file" "$block_file" "$tmp_readme"' EXIT
hyperfine -w 1 -r 10 -N \
"./build/bfjit ./examples/hanoi.b.txt" \
"./build/simple_c ./examples/hanoi.b.txt" \
"bun ./benchmark/bf.js ./examples/hanoi.b.txt" \
| tee "$result_file"
{
printf '```text\n'
cat "$result_file"
printf '```\n'
} > "$block_file"
sed '/<!-- benchmark:start -->/,/<!-- benchmark:end -->/{//!d;}' README.md \
| sed "/<!-- benchmark:start -->/r $block_file" \
> "$tmp_readme"
mv "$tmp_readme" README.md
- name: Commit and push README update
if: github.event_name != 'pull_request'
run: |
set -euo pipefail
if git diff --quiet -- README.md; then
echo "README.md is unchanged"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "update benchmark results"
git push