-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cicd: benchmarking via GH actions (#21)
cicd: benchmarking via GH actions Benchmark the current HEAD as well as the master branch and compare performance. Store the results as an artifact into the action. The repository does not allow commenting on issues using the Github token so we cannot comment the outcome on the PR this might be tackled in the future.
- Loading branch information
Showing
3 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# As inspired by https://dev.to/vearutop/continuous-benchmarking-with-go-and-github-actions-41ok | ||
name: bench | ||
on: | ||
pull_request: | ||
env: | ||
GO111MODULE: "on" | ||
jobs: | ||
bench: | ||
permissions: | ||
pull-requests: write | ||
issues: write | ||
strategy: | ||
matrix: | ||
go-version: [ 1.22.x ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/pkg | ||
key: ${{ runner.os }}-go-pkg-${{ hashFiles('**/go.mod') }} | ||
- uses: actions/cache@v4 | ||
with: | ||
path: testing/venv | ||
key: ${{ runner.os }}-py-venv-${{ hashFiles('**/requirements.txt') }} | ||
- uses: actions/cache@v4 | ||
with: | ||
path: cmd/bench-main.txt | ||
key: ${{ runner.os }}-bench10-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }} | ||
- name: Benchmark | ||
run: | | ||
make setup-test-dependencies | ||
make start-test-s3-servers | ||
make bench-main | ||
REF_NAME=${GITHUB_REF##*/} make bench-current | ||
echo "\n\n\n" | ||
SCRIPT_OUTPUT="$(make bench-report)" | ||
echo "SCRIPT_OUTPUT<<EOF" >> $GITHUB_ENV | ||
echo "$SCRIPT_OUTPUT" >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
# Requires enablement at organization level | ||
# - name: Add benchmark report to PR | ||
# uses: actions/github-script@v7 | ||
# with: | ||
# github-token: ${{secrets.GITHUB_TOKEN}} | ||
# script: | | ||
# github.rest.issues.createComment({ | ||
# issue_number: context.issue.number, | ||
# owner: context.repo.owner, | ||
# repo: context.repo.repo, | ||
# body: `${{env.SCRIPT_OUTPUT}}` | ||
# }) | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: benchmark-report-pr-${{ github.event.number }} | ||
path: cmd/bench-*.txt | ||
overwrite: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ | |
|
||
testing/venv/** | ||
testing/**.err | ||
testing/**.log | ||
testing/**.log | ||
|
||
cmd/bench-*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters