Skip to content

Commit efee259

Browse files
committed
Update workflow to run two benchmarks
This commit is a test to check if running both the benchmarks in the same workflow would make any difference to the results Upload and download benchmarks Signed-off-by: Arjun Raja Yogidas <[email protected]>
1 parent a33954e commit efee259

File tree

1 file changed

+55
-35
lines changed

1 file changed

+55
-35
lines changed

Diff for: .github/workflows/benchmark_regression_test.yml

+55-35
Original file line numberDiff line numberDiff line change
@@ -28,48 +28,68 @@ jobs:
2828
- run: make
2929
- name: Run benchmark
3030
run: make benchmarks-perf-test
31-
- name: Make previous directory
32-
run: mkdir -v ${{ github.workspace }}/previous
33-
- name: Copy results to previous directory
34-
run: cp -r ${{ github.workspace }}/benchmark/performanceTest/output ${{ github.workspace }}/previous
31+
- name: Upload latest benchmark result
32+
uses: actions/upload-artifact@v3
33+
with:
34+
name: benchmark-result-artifact-main
35+
path: ${{github.workspace}}/benchmark/performanceTest/output/results.json
36+
- name: remove output directory
37+
run: sudo rm -rf ${{ github.workspace }}/benchmark/performanceTest/output
38+
- name: Stash uncommitted changes
39+
run: git stash push --keep-index --include-untracked -m "Stashing changes for tests"
3540
- name: Check out PR
3641
uses: actions/checkout@v3
3742
with:
3843
ref: ${{ github.event.pull_request.head.sha }}
3944
- run: make
4045
- name: Run benchmark
4146
run: make benchmarks-perf-test
42-
- name: Make current directory
43-
run: mkdir -v ${{ github.workspace }}/current
44-
- name: Stash uncommitted changes
45-
run: git stash push --keep-index --include-untracked -m "Stashing changes for tests"
46-
# If you're using Git version 2.28 or later, use this line instead:
47-
# run: git stash push --keep-index --include-untracked -m "Stashing changes for tests"
48-
# This will ensure that uncommitted changes do not interfere with the tests.
49-
- name: Copy results to current directory
50-
run: cp -r ${{ github.workspace }}/benchmark/performanceTest/output ${{ github.workspace }}/current
51-
- name: Perform Comparison and log results
52-
id: run-compare
53-
run: |
54-
sudo chmod +x ${{ github.workspace }}/scripts/check_regression.sh
55-
if sudo ${{ github.workspace }}/scripts/check_regression.sh ${{ github.workspace }}/previous/results.json ${{github.workspace}}/current/results.json; then
56-
echo "Comparison successful. All P90 values are within the acceptable range."
57-
else
58-
echo "Comparison failed. Current P90 values exceed 110% of the corresponding past values."
59-
echo "regression-detected=true" >> $GITHUB_OUTPUT
60-
fi
61-
- name: Stop the workflow if regression is detected
62-
if: steps.run-compare.outputs.regression-detected == 'true'
63-
uses: actions/github-script@v6
47+
- name: Upload latest benchmark result
48+
uses: actions/upload-artifact@v3
6449
with:
65-
github-token: ${{ secrets.GITHUB_TOKEN }}
66-
script: |
67-
const comment = `
68-
:warning: **Regression Detected** :warning:
50+
name: benchmark-result-artifact-pr
51+
path: ${{github.workspace}}/benchmark/performanceTest/output/results.json
52+
53+
download_and_perform_comparison:
54+
runs-on: ubuntu-20.04
55+
needs: test-twice
56+
steps:
57+
- name: Make previous directory
58+
run: mkdir -v ${{ github.workspace }}/previous
59+
- name: Make current directory
60+
run: mkdir -v ${{ github.workspace }}/current
61+
- name: Download previous benchmark result
62+
uses: actions/download-artifact@v3
63+
with:
64+
name: benchmark-result-artifact-main
65+
path: ${{github.workspace}}/previous
66+
- name: Download current benchmark result
67+
uses: actions/download-artifact@v3
68+
with:
69+
name: benchmark-result-artifact-pr
70+
path: ${{github.workspace}}/current
71+
- name: Perform Comparison and log results
72+
id: run-compare
73+
run: |
74+
sudo chmod +x ${{ github.workspace }}/scripts/check_regression.sh
75+
if sudo ${{ github.workspace }}/scripts/check_regression.sh ${{ github.workspace }}/previous/benchmark-result-artifact-main/results.json ${{github.workspace}}/current/benchmark-result-artifact-pr/results.json; then
76+
echo "Comparison successful. All P90 values are within the acceptable range."
77+
else
78+
echo "Comparison failed. Current P90 values exceed 110% of the corresponding past values."
79+
echo "regression-detected=true" >> $GITHUB_OUTPUT
80+
fi
81+
- name: Stop the workflow if regression is detected
82+
if: steps.run-compare.outputs.regression-detected == 'true'
83+
uses: actions/github-script@v6
84+
with:
85+
github-token: ${{ secrets.GITHUB_TOKEN }}
86+
script: |
87+
const comment = `
88+
:warning: **Regression Detected** :warning:
6989
70-
The benchmark comparison indicates that there has been a performance regression.
71-
Please investigate and address the issue.
72-
To Investigate check logs of the previous job above.
73-
`;
90+
The benchmark comparison indicates that there has been a performance regression.
91+
Please investigate and address the issue.
92+
To Investigate check logs of the previous job above.
93+
`;
7494
75-
core.setFailed(comment);
95+
core.setFailed(comment);

0 commit comments

Comments
 (0)