forked from IntersectMBO/plutus
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.76 KB
/
benchmark.yml
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
name: Benchmarking
on:
issue_comment:
types: [created]
jobs:
benchmark:
runs-on: [self-hosted, plutus-benchmark]
permissions:
pull-requests: write
if: |
startsWith(github.event.comment.body, '/benchmark') &&
github.event.issue.pull_request
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
- name: React with Rocket
uses: actions/github-script@v6
with:
script: |
github.rest.reactions.createForIssueComment({
owner: context.issue.owner,
repo: context.issue.repo,
comment_id: context.payload.comment.id,
content: "rocket"
});
- name: Extract Benchmark Name
id: extract-benchmark
uses: actions/github-script@v6
with:
script: |
const regex = '^\/benchmark\s*(.*?)\s*$';
const comment = context.payload.comment.body;
const match = comment.match(regex)
if (match !== null && match.length == 2)
core.setOutput('benchmark', match[1]);
else
core.setFailed(`Unable to extract benchmark name from {comment}`);
- name: Extract Comment Branch
uses: xt0rted/pull-request-comment-branch@v1.4.0
id: extract-branch
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
- run: |
nix develop --no-warn-dirty --accept-flake-config --command bash ./scripts/ci-plutus-benchmark.sh
if: success()
env:
GITHUB_TOKEN: ${{ github.token }}
BENCHMARK_NAME: ${{ steps.extract-benchmark.outputs.benchmark }}
PR_NUMBER: ${{ github.event.issue.number }}
PR_BRANCH: ${{ steps.extract-branch.outputs.head_ref }}