33 pull_request :
44 paths :
55 - ' 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+
612env :
713 BASE_REPO : ${{ github.event.pull_request.base.repo.owner.login }}/${{ github.event.pull_request.base.repo.name }}
814 BASE_SHA : ${{ github.event.pull_request.base.sha }}
1420 HEAD_DIR : head
1521 HEAD_DB : head.sqlite
1622 HEAD_ARTIFACT : head-perf-results
23+ TEST_NAME : typescript_benchmark
1724 TEST_REPO : microsoft/TypeScript
1825 TEST_REF : v4.9.5
19- TEST_DIR : test
20- TEST_SRC : src/compiler
26+ TEST_SRC : src/compiler/utilities.ts
2127 MASSIF_OUT : perf.out
2228 MASSIF_REPORT : perf.txt
2329 TSSG_TS : tree-sitter-stack-graphs-typescript
4046 ref : ${{ env.BASE_SHA }}
4147 path : ${{ env.BASE_DIR }}
4248 fetch-depth : 0
49+ lfs : false
4350 - name : Find last relevant base commit
4451 run : |
4552 printf 'BASE_SHA=%s\n' "$(git rev-list -1 ${{ env.BASE_SHA }} -- stack-graphs)" >> $GITHUB_ENV
5158 ref : ${{ env.HEAD_SHA }}
5259 path : ${{ env.HEAD_DIR }}
5360 fetch-depth : 0
61+ lfs : false
5462 - name : " Find last relevant head commit"
5563 run : |
5664 printf 'HEAD_SHA=%s\n' "$(git rev-list -1 ${{ env.HEAD_SHA }} -- stack-graphs)" >> $GITHUB_ENV
6068 uses : actions/cache/restore@v3
6169 with :
6270 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 }}
6472 lookup-only : ' true'
6573
6674 # #
7381 env :
7482 BASE_SHA : ${{ needs.changes.outputs.base-sha }}
7583 steps :
76- #
77- # Install tools
78- #
7984 - name : Install Rust environment
8085 uses : hecrj/setup-rust-action@v1
8186 with :
@@ -90,58 +95,45 @@ jobs:
9095 run : |
9196 sudo apt-get update
9297 sudo apt-get install -y valgrind
93- #
94- # Cache results
95- #
9698 - name : " Cache base result"
9799 id : cache-base-result
98100 uses : actions/cache@v3
99101 with :
100102 path : |
101103 ${{ env.MASSIF_OUT }}
102104 ${{ 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 }}
107106 - name : " Checkout base code"
108107 if : steps.cache-base-result.outputs.cache-hit != 'true'
109108 uses : actions/checkout@v3
110109 with :
111110 repository : ${{ env.BASE_REPO }}
112111 ref : ${{ env.BASE_SHA }}
113112 path : ${{ env.BASE_DIR }}
114- #
115- # Build code
116- #
113+ lfs : true
117114 - name : " Build base CLI"
118115 if : steps.cache-base-result.outputs.cache-hit != 'true'
119116 run : cargo build --package ${{ env.TSSG_TS }} --features cli --release
120117 working-directory : ${{ env.BASE_DIR }}
121118 env :
122119 CARGO_PROFILE_RELEASE_DEBUG : true
123- #
124- # Test performance
125- #
126- - name : Checkout test code
120+ - name : Checkout benchmark code
127121 if : steps.cache-base-result.outputs.cache-hit != 'true'
128122 uses : actions/checkout@v3
129123 with :
130124 repository : ${{ env.TEST_REPO }}
131125 ref : ${{ env.TEST_REF }}
132- path : ${{ env.TEST_DIR }}
126+ path : ${{ env.BASE_DIR }}/data/${{ env.TEST_NAME }}
133127 - name : Profile base memory
134128 if : steps.cache-base-result.outputs.cache-hit != 'true'
135129 run : |
136130 valgrind \
137131 --tool=massif \
138132 --massif-out-file=${{ env.MASSIF_OUT }} \
139133 ${{ 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 }}
141136 ms_print ${{ env.MASSIF_OUT }} > ${{ env.MASSIF_REPORT }}
142- #
143- # Upload results
144- #
145137 - name : Upload results
146138 uses : actions/upload-artifact@v3
147139 with :
@@ -160,9 +152,6 @@ jobs:
160152 env :
161153 HEAD_SHA : ${{ needs.changes.outputs.head-sha }}
162154 steps :
163- #
164- # Install tools
165- #
166155 - name : Install Rust environment
167156 uses : hecrj/setup-rust-action@v1
168157 with :
@@ -177,58 +166,43 @@ jobs:
177166 run : |
178167 sudo apt-get update
179168 sudo apt-get install -y valgrind
180- #
181- # Cache results
182- #
183169 - name : " Cache head result"
184170 id : cache-head-result
185171 uses : actions/cache@v3
186172 with :
187173 path : |
188174 ${{ env.MASSIF_OUT }}
189175 ${{ 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 }}
194177 - name : " Checkout head code"
195178 if : steps.cache-head-result.outputs.cache-hit != 'true'
196179 uses : actions/checkout@v3
197180 with :
198181 repository : ${{ env.HEAD_REPO }}
199182 ref : ${{ env.HEAD_SHA }}
200183 path : ${{ env.HEAD_DIR }}
201- #
202- # Build code
203- #
184+ lfs : true
204185 - name : " Build head CLI"
205186 if : steps.cache-head-result.outputs.cache-hit != 'true'
206187 run : cargo build --package ${{ env.TSSG_TS }} --features cli --release
207188 working-directory : ${{ env.HEAD_DIR }}
208189 env :
209190 CARGO_PROFILE_RELEASE_DEBUG : true
210- #
211- # Test performance
212- #
213- - name : Checkout test code
191+ - name : Checkout benchmark code
214192 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
220196 - name : Profile head memory
221197 if : steps.cache-head-result.outputs.cache-hit != 'true'
222198 run : |
223199 valgrind \
224200 --tool=massif \
225201 --massif-out-file=${{ env.MASSIF_OUT }} \
226202 ${{ 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 }}
228205 ms_print ${{ env.MASSIF_OUT }} > ${{ env.MASSIF_REPORT }}
229- #
230- # Upload results
231- #
232206 - name : Upload results
233207 uses : actions/upload-artifact@v3
234208 with :
@@ -285,7 +259,7 @@ jobs:
285259 ${{ env.SRC_DIR }}/script/ci-perf-summary-md \
286260 ${{ env.BASE_ARTIFACT }}/${{ env.MASSIF_OUT }} \
287261 ${{ 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._' \
289263 | ${{ env.SRC_DIR }}/script/ci-comment-json > ${{ env.COMMENT_JSON }}
290264 - name : Add summary comment to PR
291265 run : |
@@ -302,4 +276,4 @@ jobs:
302276 uses : actions/cache/save@v3
303277 with :
304278 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