Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit d18b017

Browse files
author
Hendrik van Antwerpen
committed
Post only summary and upload full reports as artifacts
1 parent 837aa90 commit d18b017

File tree

3 files changed

+60
-63
lines changed

3 files changed

+60
-63
lines changed

.github/workflows/perf.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ jobs:
1212
BASE_SHA: ${{ github.event.pull_request.base.sha }}
1313
BASE_DIR: base
1414
BASE_MASSIF_OUT: base-perf.out
15+
BASE_REPORT: base-perf.txt
1516
HEAD_REPO: ${{ github.event.pull_request.head.repo.owner.login }}/${{ github.event.pull_request.head.repo.name }}
1617
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
1718
HEAD_DIR: head
1819
HEAD_MASSIF_OUT: head-perf.out
20+
HEAD_REPORT: head-perf.txt
1921
TEST_REPO: microsoft/TypeScript
2022
TEST_REF: v4.9.5
2123
TEST_DIR: test
2224
TEST_SRC: src/compiler/binder.ts
2325
TSSG_TS: tree-sitter-stack-graphs-typescript
24-
REPORT_COMMENT: perf-report.json
26+
COMMENT_JSON: perf-summary.json
2527
steps:
2628
#
2729
# Install tools
@@ -122,19 +124,30 @@ jobs:
122124
repository: ${{ env.HEAD_REPO }}
123125
ref: ${{ env.HEAD_SHA }}
124126
path: ${{ env.HEAD_DIR }}
125-
- name: Generate report
127+
- name: Generate reports and summary
126128
run: |
127-
${{ env.HEAD_DIR }}/script/ci-perf-report-md \
129+
ms_print ${{ env.BASE_MASSIF_OUT }} > ${{ env.BASE_REPORT }}
130+
ms_print ${{ env.HEAD_MASSIF_OUT }} > ${{ env.HEAD_REPORT }}
131+
${{ env.HEAD_DIR }}/script/ci-perf-summary-md \
128132
${{ env.BASE_MASSIF_OUT }} \
129133
${{ env.HEAD_MASSIF_OUT }} \
130-
'Comparing base ${{ env.BASE_REPO }}@${{ env.BASE_SHA }} with head ${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }} on `${{ env.TEST_SRC }}` in ${{ env.TEST_REPO }}@${{ env.TEST_REF }}.' \
131-
| ${{ env.HEAD_DIR }}/script/ci-comment-json >> ${{ env.REPORT_COMMENT }}
132-
- name: Add report comment to PR
134+
'Comparing base ${{ env.BASE_REPO }}@${{ env.BASE_SHA }} with head ${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }} on `${{ env.TEST_SRC }}` in ${{ env.TEST_REPO }}@${{ env.TEST_REF }}. For details see [workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs/${{ github.job }}) artifacts.' \
135+
| ${{ env.HEAD_DIR }}/script/ci-comment-json > ${{ env.COMMENT_JSON }}
136+
- name: Upload reports
137+
uses: actions/upload-artifact@v3
138+
with:
139+
name: perf
140+
path: |
141+
${{ env.BASE_MASSIF_OUT }}
142+
${{ env.BASE_REPORT }}
143+
${{ env.HEAD_MASSIF_OUT }}
144+
${{ env.HEAD_REPORT }}
145+
- name: Add summary comment to PR
133146
run: |
134147
curl \
135148
-X POST \
136149
-H "Accept: application/vnd.github+json" \
137150
-H "Authorization: Bearer ${{ github.TOKEN }}" \
138151
-H "X-GitHub-Api-Version: 2022-11-28" \
139152
${{ github.event.pull_request.comments_url }} \
140-
-d '@${{ env.REPORT_COMMENT }}'
153+
-d '@${{ env.COMMENT_JSON }}'

script/ci-perf-report-md

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

script/ci-perf-summary-md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
graph_w=72
6+
graph_h=12
7+
8+
summary_lines=$((graph_h + 10))
9+
10+
if [ $# -lt 2 ]; then
11+
echo "Usage: $0 MASSIF_OUT_BEFORE MASSIF_OUT_AFTER DESC?" 1>&2
12+
exit 1
13+
fi
14+
massif_before="$1"
15+
massif_after="$2"
16+
shift 2
17+
18+
desc=
19+
if [ $# -gt 0 ]; then
20+
desc="$1"
21+
fi
22+
shift 1
23+
24+
printf '## Performance Summary\n'
25+
printf '\n'
26+
if [ -n "$desc" ]; then
27+
printf '%s\n' "$desc"
28+
printf '\n'
29+
fi
30+
printf '### Before\n'
31+
printf '\n'
32+
printf '```\n'
33+
ms_print --x="$graph_w" --y="$graph_h" "$massif_before" | head -n +$summary_lines
34+
printf '```\n'
35+
printf '\n'
36+
printf '### After\n'
37+
printf '\n'
38+
printf '```\n'
39+
ms_print --x="$graph_w" --y="$graph_h" "$massif_after" | head -n +$summary_lines
40+
printf '```\n'

0 commit comments

Comments
 (0)