Skip to content

Commit 64b0ed2

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 64b0ed2

File tree

1 file changed

+64
-35
lines changed

1 file changed

+64
-35
lines changed

Diff for: .github/workflows/benchmark_regression_test.yml

+64-35
Original file line numberDiff line numberDiff line change
@@ -28,48 +28,77 @@ 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+
- uses: actions/setup-go@v4
58+
with:
59+
go-version: '1.18.10'
60+
- name: Checkout main
61+
uses: actions/checkout@v3
62+
with:
63+
ref: main
64+
- run: make
65+
66+
- name: Create previous directory
67+
run: mkdir -v ${{ github.workspace }}/previous
68+
- name: Create current directory
69+
run: mkdir -v ${{ github.workspace }}/current
70+
- name: Download previous benchmark result
71+
uses: actions/download-artifact@v3
72+
with:
73+
name: benchmark-result-artifact-main
74+
path: ${{github.workspace}}/previous
75+
- name: Download current benchmark result
76+
uses: actions/download-artifact@v3
77+
with:
78+
name: benchmark-result-artifact-pr
79+
path: ${{github.workspace}}/current
80+
- name: Perform Comparison and log results
81+
id: run-compare
82+
run: |
83+
sudo chmod +x ${{ github.workspace }}/scripts/check_regression.sh
84+
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
85+
echo "Comparison successful. All P90 values are within the acceptable range."
86+
else
87+
echo "Comparison failed. Current P90 values exceed 110% of the corresponding past values."
88+
echo "regression-detected=true" >> $GITHUB_OUTPUT
89+
fi
90+
- name: Stop the workflow if regression is detected
91+
if: steps.run-compare.outputs.regression-detected == 'true'
92+
uses: actions/github-script@v6
93+
with:
94+
github-token: ${{ secrets.GITHUB_TOKEN }}
95+
script: |
96+
const comment = `
97+
:warning: **Regression Detected** :warning:
6998
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-
`;
99+
The benchmark comparison indicates that there has been a performance regression.
100+
Please investigate and address the issue.
101+
To Investigate check logs of the previous job above.
102+
`;
74103
75-
core.setFailed(comment);
104+
core.setFailed(comment);

0 commit comments

Comments
 (0)