Skip to content

Github action to run serverless benchmarks. #35

Github action to run serverless benchmarks.

Github action to run serverless benchmarks. #35

name: "Serverless Benchmarks"
on:
push:
paths:
- 'cmd/serverless/**'
- 'pkg/serverless/**'
- '.github/workflows/serverless-benchmarks.yml'
env:
DD_API_KEY: must-be-set
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Install benchstat
run: |
go install golang.org/x/perf/cmd/benchstat@latest
- 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
go get ./...
- name: Previous benchmark results
run: |
cd go/src/github.com/DataDog/datadog-agent
go test -tags=test -run='^$' -bench=StartEndInvocation -count=4 -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
go get ./...
- name: Current benchmark results
run: |
cd go/src/github.com/DataDog/datadog-agent
go test -tags=test -run='^$' -bench=StartEndInvocation -count=4 -benchtime=10x -timeout=60m \
./pkg/serverless/... | tee current.txt
- name: Analyze results
id: analyze
run: |
cd go/src/github.com/DataDog/datadog-agent
benchstat -row /event previous.txt current.txt | tee analyze.txt
echo "analyze<<EOF" >> $GITHUB_OUTPUT
cat analyze.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- uses: jwalton/gh-find-current-pr@v1
id: finder
- name: Post comment
uses: marocchino/[email protected]
with:
number: ${{ steps.finder.outputs.pr }}
hide_and_recreate: true
hide_classify: "RESOLVED"
message: |
## Serverless Benchmark Results
<details>
<summary>Output</summary>
```
${{ steps.analyze.outputs.analyze }}
```
</details>