Skip to content

Commit cc5b031

Browse files
authored
ci: Automating scheduling benchmarking testing for PRs (#2048)
1 parent cfc3153 commit cc5b031

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

.github/dependabot.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,11 @@ updates:
6161
action-deps:
6262
patterns:
6363
- '*'
64+
- package-ecosystem: github-actions
65+
directory: .github/actions/run-bench-test
66+
schedule:
67+
interval: weekly
68+
groups:
69+
action-deps:
70+
patterns:
71+
- '*'

.github/workflows/run-bench-test.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "Run Bench Test"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
path:
7+
description: Path to the performance test
8+
required: true
9+
type: string
10+
runName:
11+
description: Name of the run, for the purpose of file naming and github comments
12+
required: true
13+
type: string
14+
githubSha:
15+
description: Sha of the github commit to check out
16+
required: true
17+
type: string
18+
jobs:
19+
run-test:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
ref: ${{ inputs.githubSha }}
25+
- name: Run Test
26+
id: test-run
27+
shell: bash
28+
run: |
29+
{
30+
cd ${{ inputs.path }}
31+
mkdir output
32+
go test -tags=test_performance -run=1 -bench=. -count=1 -cpuprofile output/cpu.out -memprofile output/mem.out > output/results.txt
33+
echo 'OUTPUT<<EOF'
34+
cat output/results.txt
35+
echo EOF
36+
} >> "$GITHUB_OUTPUT"
37+
- uses: actions/upload-artifact@v4
38+
id: artifact-upload
39+
with:
40+
name: ${{ inputs.runName }}
41+
path: ${{ inputs.path }}/output
42+
- uses: actions/github-script@v7
43+
env:
44+
RESULTS: ${{ steps.test-run.outputs.OUTPUT }}
45+
UPLOAD: ${{ steps.artifact-upload.outputs.artifact-url }}
46+
with:
47+
script: |
48+
github.rest.issues.createComment({
49+
issue_number: context.issue.number,
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
body: `# :mag: ${{ inputs.runName }} :mag:\nResults of benchmarking testing in \`${{ inputs.path }}\`: \n\`\`\`${process.env.RESULTS}\n\`\`\`\n${process.env.UPLOAD}`
53+
})
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "Scheduling Benchmarking"
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "**.go"
7+
branches:
8+
- main
9+
10+
jobs:
11+
before:
12+
name: Before PR
13+
permissions:
14+
pull-requests: write
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
path: ["pkg/controllers/provisioning/scheduling"]
19+
uses: ./.github/workflows/run-bench-test.yaml
20+
secrets: inherit
21+
with:
22+
path: ${{ matrix.path }}
23+
runName: before-${{ strategy.job-index }}
24+
githubSha: ${{ github.event.pull_request.base.sha }}
25+
after:
26+
name: After PR
27+
permissions:
28+
pull-requests: write
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
path: ["pkg/controllers/provisioning/scheduling"]
33+
uses: ./.github/workflows/run-bench-test.yaml
34+
secrets: inherit
35+
with:
36+
path: ${{ matrix.path }}
37+
runName: after-${{ strategy.job-index }}
38+
githubSha: ${{ github.sha }}

0 commit comments

Comments
 (0)