@@ -19,18 +19,20 @@ jobs:
19
19
COMMENT_FILE : ${{ github.workspace }}/benchmark-comment.md
20
20
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
21
21
steps :
22
- - id : get-sha
22
+ - id : get-master- sha
23
23
run : |
24
24
# getting exact master sha at the moment to reference it in the comment
25
25
echo "sha=$( curl -u "u:${{ github.token }}" https://api.github.com/repos/${{ github.repository }}/git/ref/heads/${{ github.base_ref }} | jq .object.sha | tr -d '"' )" >> "$GITHUB_OUTPUT"
26
26
27
27
- uses : actions/checkout@v4
28
28
with :
29
- ref : ${{ steps.get-sha.outputs.sha }}
29
+ ref : ${{ steps.get-master- sha.outputs.sha }}
30
30
path : benchmark-master
31
31
32
32
- uses : actions/checkout@v4
33
33
with :
34
+ # https://github.com/actions/checkout/issues/518#issuecomment-890401887
35
+ ref : " ${{ github.event.pull_request.merge_commit_sha }}"
34
36
path : benchmark-pull-request
35
37
36
38
- name : Set up JDK
@@ -41,25 +43,28 @@ jobs:
41
43
42
44
- name : Run benchmarks (pull-request)
43
45
working-directory : benchmark-pull-request
44
- run : |
45
- ./mvnw -B -V --no-transfer-progress jmh:benchmark -Dlicense.skip=true
46
-
47
- echo '> [!NOTE]' >> ${{ env.COMMENT_FILE }}
48
- echo '> These results are affected by shared workloads on GitHub runners. Use the results only to detect possible regressions, but always rerun on more stable machine before making any conclusions!' >> ${{ env.COMMENT_FILE }}
49
- echo '### Benchmark results (pull-request, ${{ github.event.pull_request.head.sha }})' >> ${{ env.COMMENT_FILE }}
50
- echo '```text' >> ${{ env.COMMENT_FILE }}
51
- cat target/benchmark-results.txt >> ${{ env.COMMENT_FILE }}
52
- echo '```' >> ${{ env.COMMENT_FILE }}
46
+ run : ./mvnw -B -V --no-transfer-progress jmh:benchmark -Dlicense.skip=true
53
47
54
48
- name : Run benchmarks (master)
55
49
working-directory : benchmark-master
56
- run : |
57
- ./mvnw -B -V --no-transfer-progress jmh:benchmark -Dlicense.skip=true
50
+ run : ./mvnw -B -V --no-transfer-progress jmh:benchmark -Dlicense.skip=true
58
51
59
- echo '### Benchmark results (${{ github.base_ref }}, ${{ steps.get-sha.outputs.sha }})' >> ${{ env.COMMENT_FILE }}
60
- echo '```text' >> ${{ env.COMMENT_FILE }}
61
- cat target/benchmark-results.txt >> ${{ env.COMMENT_FILE }}
62
- echo '```' >> ${{ env.COMMENT_FILE }}
52
+ - name : Compose comment content
53
+ run : |
54
+ cat <<EOF >> ${{ env.COMMENT_FILE }}
55
+ > [!NOTE]
56
+ > These results are affected by shared workloads on GitHub runners. Use the results only to detect possible regressions, but always rerun on more stable machine before making any conclusions!
57
+
58
+ ### Benchmark results (pull-request, ${{ github.event.pull_request.head.sha }})
59
+ \`\`\`text
60
+ $(cat benchmark-pull-request/target/benchmark-results.txt)
61
+ \`\`\`
62
+
63
+ ### Benchmark results (${{ github.base_ref }}, ${{ steps.get-master-sha.outputs.sha }})
64
+ \`\`\`text
65
+ $(cat benchmark-master/target/benchmark-results.txt)
66
+ \`\`\`
67
+ EOF
63
68
64
69
- name : Find benchmark results comment
65
70
uses : peter-evans/find-comment@v3
0 commit comments