Skip to content

[Serverless] Run benchmarks on PR. #18

[Serverless] Run benchmarks on PR.

[Serverless] Run benchmarks on PR. #18

name: "Serverless Benchmarks"
on:
pull_request:
paths:
- 'cmd/serverless/**'
- 'pkg/serverless/**'
- 'test/integration/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 }}
```