Skip to content

Commit ab91a7d

Browse files
committed
WIP
1 parent 80a2c2c commit ab91a7d

2 files changed

Lines changed: 75 additions & 57 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Longitudinal Benchmarking
2+
#
3+
# This workflow will run the benchmarks defined in the environment variable BENCHMARKS.
4+
# It will collect and aggreate the benchmark output, format it and feed it to github-action-benchmark.
5+
#
6+
# The benchmark charts are live at https://input-output-hk.github.io/plutus/dev/bench
7+
# The benchmark data is available at https://input-output-hk.github.io/plutus/dev/bench/data.js
8+
9+
name: Longitudinal Benchmarking
10+
11+
on:
12+
push:
13+
branches:
14+
- master
15+
16+
permissions:
17+
# Deployments permission to deploy GitHub pages website
18+
deployments: write
19+
# Contents permission to update benchmark contents in gh-pages branch
20+
contents: write
21+
22+
jobs:
23+
new-benchmark:
24+
name: Performance regression check
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v3.3.0
28+
29+
- name: Run benchmarks
30+
env:
31+
BENCHMARKS: "validation validation-decode"
32+
run: |
33+
for bench in $BENCHMARKS; do
34+
2>&1 cabal run "$bench" | tee "$bench-output.txt"
35+
done
36+
37+
read -r -d '' PYTHON_SCRIPT <<- END_SCRIPT
38+
import json
39+
result = []
40+
for benchmark in "$BENCHMARKS".split():
41+
with open(f"{benchmark}-output.txt", "r") as file:
42+
name = ""
43+
for line in file.readlines():
44+
if line.startswith("benchmarking"):
45+
name = line.split()[1]
46+
elif line.startswith("mean"):
47+
parts = line.split()
48+
mean = parts[1]
49+
unit = parts[2]
50+
result.append({
51+
"name": f"{benchmark}-{name}",
52+
"unit": unit,
53+
"value": float(mean)
54+
})
55+
with open("output.json", "w") as file:
56+
json.dump(result, file)
57+
END_SCRIPT
58+
59+
- name: Store benchmark result
60+
uses: benchmark-action/github-action-benchmark@v1.16.2
61+
with:
62+
name: My Project Go Benchmark
63+
tool: 'customSmallerIsBetter'
64+
output-file-path: output.json
65+
github-token: ${{ secrets.GITHUB_TOKEN }}
66+
# Push and deploy GitHub pages branch automatically
67+
auto-push: true
68+
# Enable alert commit comment
69+
comment-on-alert: true
70+
# Mention @input-output-hk/plutus-core in the commit comment
71+
alert-comment-cc-users: '@input-output-hk/plutus-core'
72+
# Percentage value like "110%".
73+
# It is a ratio indicating how worse the current benchmark result is.
74+
# For example, if we now get 110 ns/iter and previously got 100 ns/iter, it gets 110% worse.
75+
alert-threshold: '105%'

.github/workflows/new-benchmark.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)