3
3
pull_request :
4
4
paths :
5
5
- ' stack-graphs/**'
6
+
7
+ # In the event that there is a new push to the ref, cancel any running jobs because there are now obsolete, and wasting resources.
8
+ concurrency :
9
+ group : ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress : true
11
+
6
12
env :
7
13
BASE_REPO : ${{ github.event.pull_request.base.repo.owner.login }}/${{ github.event.pull_request.base.repo.name }}
8
14
BASE_SHA : ${{ github.event.pull_request.base.sha }}
14
20
HEAD_DIR : head
15
21
HEAD_DB : head.sqlite
16
22
HEAD_ARTIFACT : head-perf-results
23
+ TEST_NAME : typescript_benchmark
17
24
TEST_REPO : microsoft/TypeScript
18
25
TEST_REF : v4.9.5
19
- TEST_DIR : test
20
- TEST_SRC : src/compiler
26
+ TEST_SRC : src/compiler/utilities.ts
21
27
MASSIF_OUT : perf.out
22
28
MASSIF_REPORT : perf.txt
23
29
TSSG_TS : tree-sitter-stack-graphs-typescript
40
46
ref : ${{ env.BASE_SHA }}
41
47
path : ${{ env.BASE_DIR }}
42
48
fetch-depth : 0
49
+ lfs : false
43
50
- name : Find last relevant base commit
44
51
run : |
45
52
printf 'BASE_SHA=%s\n' "$(git rev-list -1 ${{ env.BASE_SHA }} -- stack-graphs)" >> $GITHUB_ENV
51
58
ref : ${{ env.HEAD_SHA }}
52
59
path : ${{ env.HEAD_DIR }}
53
60
fetch-depth : 0
61
+ lfs : false
54
62
- name : " Find last relevant head commit"
55
63
run : |
56
64
printf 'HEAD_SHA=%s\n' "$(git rev-list -1 ${{ env.HEAD_SHA }} -- stack-graphs)" >> $GITHUB_ENV
60
68
uses : actions/cache/restore@v3
61
69
with :
62
70
path : done
63
- key : ${{ runner.os }}-perf-tested-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_REPO }}@${{ env.TEST_REF }}/${{ env.TEST_SRC }}
71
+ key : ${{ runner.os }}-perf-tested-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_NAME }}
64
72
lookup-only : ' true'
65
73
66
74
# #
73
81
env :
74
82
BASE_SHA : ${{ needs.changes.outputs.base-sha }}
75
83
steps :
76
- #
77
- # Install tools
78
- #
79
84
- name : Install Rust environment
80
85
uses : hecrj/setup-rust-action@v1
81
86
with :
@@ -90,58 +95,45 @@ jobs:
90
95
run : |
91
96
sudo apt-get update
92
97
sudo apt-get install -y valgrind
93
- #
94
- # Cache results
95
- #
96
98
- name : " Cache base result"
97
99
id : cache-base-result
98
100
uses : actions/cache@v3
99
101
with :
100
102
path : |
101
103
${{ env.MASSIF_OUT }}
102
104
${{ env.MASSIF_REPORT }}
103
- key : ${{ runner.os }}-perf-result-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.TEST_REPO }}@${{ env.TEST_REF }}/${{ env.TEST_SRC }}
104
- #
105
- # Checkout code
106
- #
105
+ key : ${{ runner.os }}-perf-result-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.TEST_NAME }}
107
106
- name : " Checkout base code"
108
107
if : steps.cache-base-result.outputs.cache-hit != 'true'
109
108
uses : actions/checkout@v3
110
109
with :
111
110
repository : ${{ env.BASE_REPO }}
112
111
ref : ${{ env.BASE_SHA }}
113
112
path : ${{ env.BASE_DIR }}
114
- #
115
- # Build code
116
- #
113
+ lfs : true
117
114
- name : " Build base CLI"
118
115
if : steps.cache-base-result.outputs.cache-hit != 'true'
119
116
run : cargo build --package ${{ env.TSSG_TS }} --features cli --release
120
117
working-directory : ${{ env.BASE_DIR }}
121
118
env :
122
119
CARGO_PROFILE_RELEASE_DEBUG : true
123
- #
124
- # Test performance
125
- #
126
- - name : Checkout test code
120
+ - name : Checkout benchmark code
127
121
if : steps.cache-base-result.outputs.cache-hit != 'true'
128
122
uses : actions/checkout@v3
129
123
with :
130
124
repository : ${{ env.TEST_REPO }}
131
125
ref : ${{ env.TEST_REF }}
132
- path : ${{ env.TEST_DIR }}
126
+ path : ${{ env.BASE_DIR }}/data/${{ env.TEST_NAME }}
133
127
- name : Profile base memory
134
128
if : steps.cache-base-result.outputs.cache-hit != 'true'
135
129
run : |
136
130
valgrind \
137
131
--tool=massif \
138
132
--massif-out-file=${{ env.MASSIF_OUT }} \
139
133
${{ env.BASE_DIR }}/target/release/${{ env.TSSG_TS }} \
140
- index -D ${{ env.BASE_DB }} --max-file-time=30 --hide-error-details -- ${{ env.TEST_DIR }}/${{ env.TEST_SRC }}
134
+ index -D ${{ env.BASE_DB }} --max-file-time=30 --hide-error-details -- \
135
+ ${{ env.BASE_DIR }}/data/${{ env.TEST_NAME }}/${{ env.TEST_SRC }}
141
136
ms_print ${{ env.MASSIF_OUT }} > ${{ env.MASSIF_REPORT }}
142
- #
143
- # Upload results
144
- #
145
137
- name : Upload results
146
138
uses : actions/upload-artifact@v3
147
139
with :
@@ -160,9 +152,6 @@ jobs:
160
152
env :
161
153
HEAD_SHA : ${{ needs.changes.outputs.head-sha }}
162
154
steps :
163
- #
164
- # Install tools
165
- #
166
155
- name : Install Rust environment
167
156
uses : hecrj/setup-rust-action@v1
168
157
with :
@@ -177,58 +166,43 @@ jobs:
177
166
run : |
178
167
sudo apt-get update
179
168
sudo apt-get install -y valgrind
180
- #
181
- # Cache results
182
- #
183
169
- name : " Cache head result"
184
170
id : cache-head-result
185
171
uses : actions/cache@v3
186
172
with :
187
173
path : |
188
174
${{ env.MASSIF_OUT }}
189
175
${{ env.MASSIF_REPORT }}
190
- key : ${{ runner.os }}-perf-result-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_REPO }}@${{ env.TEST_REF }}/${{ env.TEST_SRC }}
191
- #
192
- # Checkout code
193
- #
176
+ key : ${{ runner.os }}-perf-result-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_NAME }}
194
177
- name : " Checkout head code"
195
178
if : steps.cache-head-result.outputs.cache-hit != 'true'
196
179
uses : actions/checkout@v3
197
180
with :
198
181
repository : ${{ env.HEAD_REPO }}
199
182
ref : ${{ env.HEAD_SHA }}
200
183
path : ${{ env.HEAD_DIR }}
201
- #
202
- # Build code
203
- #
184
+ lfs : true
204
185
- name : " Build head CLI"
205
186
if : steps.cache-head-result.outputs.cache-hit != 'true'
206
187
run : cargo build --package ${{ env.TSSG_TS }} --features cli --release
207
188
working-directory : ${{ env.HEAD_DIR }}
208
189
env :
209
190
CARGO_PROFILE_RELEASE_DEBUG : true
210
- #
211
- # Test performance
212
- #
213
- - name : Checkout test code
191
+ - name : Checkout benchmark code
214
192
if : steps.cache-head-result.outputs.cache-hit != 'true'
215
- uses : actions/checkout@v3
216
- with :
217
- repository : ${{ env.TEST_REPO }}
218
- ref : ${{ env.TEST_REF }}
219
- path : ${{ env.TEST_DIR }}
193
+ run : |
194
+ unzip ${{ env.TEST_NAME }}.zip
195
+ working-directory : ${{ env.HEAD_DIR }}/data
220
196
- name : Profile head memory
221
197
if : steps.cache-head-result.outputs.cache-hit != 'true'
222
198
run : |
223
199
valgrind \
224
200
--tool=massif \
225
201
--massif-out-file=${{ env.MASSIF_OUT }} \
226
202
${{ env.HEAD_DIR }}/target/release/${{ env.TSSG_TS }} \
227
- index -D ${{ env.HEAD_DB }} --max-file-time=30 --hide-error-details -- ${{ env.TEST_DIR }}/${{ env.TEST_SRC }}
203
+ index -D ${{ env.HEAD_DB }} --max-file-time=30 --hide-error-details -- \
204
+ ${{ env.HEAD_DIR }}/data/${{ env.TEST_NAME }}
228
205
ms_print ${{ env.MASSIF_OUT }} > ${{ env.MASSIF_REPORT }}
229
- #
230
- # Upload results
231
- #
232
206
- name : Upload results
233
207
uses : actions/upload-artifact@v3
234
208
with :
@@ -285,7 +259,7 @@ jobs:
285
259
${{ env.SRC_DIR }}/script/ci-perf-summary-md \
286
260
${{ env.BASE_ARTIFACT }}/${{ env.MASSIF_OUT }} \
287
261
${{ env.HEAD_ARTIFACT }}/${{ env.MASSIF_OUT }} \
288
- 'Comparing base ${{ env.BASE_REPO }}@${{ env.BASE_SHA }} with head ${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }} on [ ${{ env.TEST_REPO }}@${{ env.TEST_REF }}](${{ github.server_url }}/${{ env.TEST_REPO }}/tree/${{ env.TEST_REF }}) . For details see [workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) artifacts. _Note that performance is tested on the last commits with changes in `stack-graphs`, not on every commit._' \
262
+ 'Comparing base ${{ env.BASE_REPO }}@${{ env.BASE_SHA }} with head ${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }} on ${{ env.TEST_NAME }} benchmark . For details see [workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) artifacts. _Note that performance is tested on the last commits with changes in `stack-graphs`, not on every commit._' \
289
263
| ${{ env.SRC_DIR }}/script/ci-comment-json > ${{ env.COMMENT_JSON }}
290
264
- name : Add summary comment to PR
291
265
run : |
@@ -302,4 +276,4 @@ jobs:
302
276
uses : actions/cache/save@v3
303
277
with :
304
278
path : done
305
- key : ${{ runner.os }}-perf-tested-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_REPO }}@${{ env.TEST_REF }}/${{ env.TEST_SRC }}
279
+ key : ${{ runner.os }}-perf-tested-${{ env.BASE_REPO }}@${{ env.BASE_SHA }}-${{ env.HEAD_REPO }}@${{ env.HEAD_SHA }}-${{ env.TEST_NAME }}
0 commit comments