Skip to content

Commit

Permalink
feat(performance): add benchmark step to CI workflow
Browse files Browse the repository at this point in the history
Add a new 'Benchmark' job in the GitHub Actions workflow to run
performance tests and generate graphs. Save the test report as
an artifact in the Earthfile. The job runs on 'github-001' and
triggers on PRs labeled 'benchmarks' or on the main branch.
  • Loading branch information
flemzord committed Oct 9, 2024
1 parent 4ed537f commit 719986b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,30 @@ jobs:
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
Benchmark:
runs-on: "github-001"
if: contains(github.event.pull_request.labels.*.name, 'benchmarks') || github.ref == 'refs/heads/main'
needs:
- Dirty
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- run: >
earthly
--allow-privileged
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
./test/performance+run --args="-benchtime 10s"
- run: >
earthly
--allow-privileged
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
./test/performance+generate-graphs
- uses: actions/upload-artifact@v3
with:
name: graphs
path: test/performance/report

Deploy:
runs-on: "ubuntu-latest"
if: github.ref == 'refs/heads/main'
Expand Down
1 change: 1 addition & 0 deletions test/performance/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ run:
LOCALLY
ARG args=""
RUN go test -bench="Write" -run ^$ -tags it -report.file ./report/report.json -timeout 60m $args
SAVE ARTIFACT ./report/report.json AS LOCAL ./report/report.json

generate-graphs:
FROM core+base-image
Expand Down

0 comments on commit 719986b

Please sign in to comment.