@@ -19,18 +19,20 @@ jobs:
1919 COMMENT_FILE : ${{ github.workspace }}/benchmark-comment.md
2020 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2121 steps :
22- - id : get-sha
22+ - id : get-master- sha
2323 run : |
2424 # getting exact master sha at the moment to reference it in the comment
2525 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"
2626
2727 - uses : actions/checkout@v4
2828 with :
29- ref : ${{ steps.get-sha.outputs.sha }}
29+ ref : ${{ steps.get-master- sha.outputs.sha }}
3030 path : benchmark-master
3131
3232 - uses : actions/checkout@v4
3333 with :
34+ # https://github.com/actions/checkout/issues/518#issuecomment-890401887
35+ ref : " ${{ github.event.pull_request.merge_commit_sha }}"
3436 path : benchmark-pull-request
3537
3638 - name : Set up JDK
@@ -41,25 +43,28 @@ jobs:
4143
4244 - name : Run benchmarks (pull-request)
4345 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
5347
5448 - name : Run benchmarks (master)
5549 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
5851
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
6368
6469 - name : Find benchmark results comment
6570 uses : peter-evans/find-comment@v3
0 commit comments