forked from flix/flix
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (95 loc) · 3.81 KB
/
benchmark-on-demand.yaml
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
name: Benchmark on Demand
on:
issue_comment:
types: [created]
jobs:
handle-request:
if: github.event.issue.pull_request && (contains(github.event.comment.body, '!!!benchmark') || contains(github.event.comment.body, '🤖🤖🤖') || contains(github.event.comment.body, '🤖 🤖 🤖'))
runs-on: ubuntu-latest
steps:
- name: Acknowledge request
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: >
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Running benchmark...'
})
- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 1.11
- name: Lookup branches
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: >
var pull_promise = github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
pull_promise.then(pull => {
core.exportVariable("feature_repo", pull.data.head.repo.full_name);
core.exportVariable("feature_ref", pull.data.head.ref);
core.exportVariable("master_repo", pull.data.base.repo.full_name);
core.exportVariable("master_ref", pull.data.base.ref);
});
- name: Check out feature branch
uses: actions/checkout@v2
with:
repository: ${{ env.feature_repo }}
ref: ${{ env.feature_ref }}
- name: Build
run: ./gradlew classes testClasses
- name: Benchmark feature phases
run: ./gradlew run -q --args="--Xbenchmark-phases --json" > feature-phases.json
- name: Benchmark feature throughput
run: ./gradlew run -q --args="--Xbenchmark-throughput --json" > feature-throughput.json
- name: Upload feature phases results
uses: actions/upload-artifact@v1
with:
name: feature-phases
path: feature-phases.json
- name: Upload feature throughput results
uses: actions/upload-artifact@v1
with:
name: feature-throughput
path: feature-throughput.json
- uses: actions/checkout@v2
name: Check out master branch
with:
repository: ${{ env.master_repo }}
ref: ${{ env.master_ref }}
- name: Download feature phases results
uses: actions/download-artifact@v2
with:
name: feature-phases
- name: Download feature throughput results
uses: actions/download-artifact@v2
with:
name: feature-throughput
- name: Build
run: ./gradlew classes testClasses
- name: Benchmark master phases
run: ./gradlew run -q --args="--Xbenchmark-phases --json" > master-phases.json
- name: Benchmark master throughput
run: ./gradlew run -q --args="--Xbenchmark-throughput --json" > master-throughput.json
- name: Create report
run: python3 .github/workflows/compare_branches.py master-throughput.json master-phases.json feature-throughput.json feature-phases.json > report.txt
- name: Store report
run: echo "REPORT<<END_REPORT" >> $GITHUB_ENV; cat report.txt >> $GITHUB_ENV; echo "END_REPORT" >> $GITHUB_ENV
- name: Comment phase report
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: >
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.REPORT
})