Skip to content

Commit 8cd3598

Browse files
Manan17Manan Shahvaibhavjindal
authored
Automate benchmarking - for every release (#828)
## Summary <!--- This is a required section; please describe the main purpose of this proposed code change. ---> This pr adds code for running benchmarks for every release. <!--- ## Details This is an optional section; is there anything specific that reviewers should be aware of? ---> ## Testing Done <!--- This is a required section; please describe how this change was tested. ---> <!-- Replace BLANK with your device type. For example, A100-80G-PCIe Complete the following tasks before sending your PR, and replace `[ ]` with `[x]` to indicate you have done them. --> - Hardware Type: <BLANK> - [ ] run `make test` to ensure correctness - [ ] run `make checkstyle` to ensure code style - [ ] run `make test-convergence` to ensure convergence --------- Co-authored-by: Manan Shah <[email protected]> Co-authored-by: Vaibhav Jindal <[email protected]>
1 parent f20b25f commit 8cd3598

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

.github/workflows/benchmark.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Benchmarks
22

33
on:
4+
release:
5+
types: [published]
46
schedule:
57
# Runs at 00:00 UTC every Friday
68
- cron: '0 0 * * 5'
@@ -69,10 +71,8 @@ jobs:
6971
7072
# Save benchmark folder from main
7173
cp -r benchmark /tmp/benchmark_main
72-
7374
# Checkout back to target commit
7475
git checkout $ORIG_COMMIT
75-
7676
# Replace old benchmark with one from main
7777
rm -rf benchmark
7878
cp -r /tmp/benchmark_main benchmark
@@ -124,8 +124,17 @@ jobs:
124124

125125
# Step 6: Copy benchmark CSV to gh-pages directory
126126
- name: Copy generated benchmark to gh-pages
127+
id: copy_benchmark
127128
run: |
128-
COMMIT_DIR="gh-pages/${OUTPUT_DIR}/${{ steps.choose_commit.outputs.hash }}"
129+
if [[ "${{ github.event_name }}" == "release" ]]; then
130+
echo "Release event detected"
131+
path=${{steps.choose_commit.outputs.hash}}-${{ github.event.release.tag_name }}
132+
else
133+
echo "Not a release event"
134+
path=${{steps.choose_commit.outputs.hash}}
135+
fi
136+
COMMIT_DIR="gh-pages/${OUTPUT_DIR}/${path}"
137+
129138
mkdir -p "$COMMIT_DIR"
130139
131140
if [ -f "$COMMIT_DIR/${OUTPUT_FILENAME}" ]; then
@@ -144,7 +153,8 @@ jobs:
144153
mkdir -p ${OUTPUT_DIR}
145154
touch ${OUTPUT_DIR}/commits.txt
146155
147-
echo "${{ steps.choose_commit.outputs.hash }}" >> ${OUTPUT_DIR}/commits.txt
156+
echo "${{ steps.copy_benchmark.outputs.path }}" >> ${OUTPUT_DIR}/commits.txt
157+
148158
echo "Added commit hash to commits.txt"
149159
# Step 7: Commit and push
150160
- name: Commit and push to gh-pages
@@ -153,6 +163,5 @@ jobs:
153163
git config user.name github-actions[bot]
154164
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
155165
git add .
156-
git commit -m "Add benchmark for commit ${{ steps.choose_commit.outputs.hash }}" || echo "No changes to commit"
166+
git commit -m "Add benchmark for commit ${{ steps.copy_benchmark.outputs.path }}" || echo "No changes to commit"
157167
git push origin gh-pages
158-

0 commit comments

Comments
 (0)