[Serverless] Run benchmarks on PR. #19
Workflow file for this run
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
name: "Serverless Benchmarks" | |
on: | |
pull_request: | |
paths: | |
- 'cmd/serverless/**' | |
- 'pkg/serverless/**' | |
- '.github/workflows/serverless-benchmarks.yml' | |
env: | |
DD_API_KEY: must-be-set | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout datadog-agent repository | |
uses: actions/checkout@v3 | |
with: | |
path: go/src/github.com/DataDog/datadog-agent | |
- name: Checkout datadog-agent base branch | |
run: | | |
cd go/src/github.com/DataDog/datadog-agent | |
git fetch origin $GITHUB_BASE_REF --depth 1 | |
git checkout $GITHUB_BASE_REF | |
- name: Previous benchmark results | |
run: | | |
cd go/src/github.com/DataDog/datadog-agent | |
go test -tags=test -run='^$' -bench=StartEndInvocation -count=10 -benchtime=10x -timeout=60m \ | |
./pkg/serverless/... | tee previous.txt | |
- name: Checkout datadog-agent pr branch | |
run: | | |
cd go/src/github.com/DataDog/datadog-agent | |
git fetch origin $GITHUB_SHA --depth 1 | |
git checkout $GITHUB_SHA | |
- name: Current benchmark results | |
run: | | |
cd go/src/github.com/DataDog/datadog-agent | |
go test -tags=test -run='^$' -bench=StartEndInvocation -count=10 -benchtime=10x -timeout=60m \ | |
./pkg/serverless/... | tee current.txt | |
- name: Analyze results | |
id: analyze | |
run: | | |
go install golang.org/x/perf/cmd/benchstat@latest | |
benchstat -row /event \ | |
go/src/github.com/DataDog/datadog-agent/previous.txt \ | |
go/src/github.com/DataDog/datadog-agent/current.txt | tee output.txt | |
OUTPUT=$(cat output.txt) | |
echo "analyze=$OUTPUT" >> $GITHUB_OUTPUT | |
- name: Post comment | |
uses: marocchino/[email protected] | |
with: | |
hide_and_recreate: true | |
hide_classify: "RESOLVED" | |
message: | | |
\#\# Serverless Benchmark Results | |
``` | |
${{ steps.analyze.outputs.analyze }} | |
``` |