-
Notifications
You must be signed in to change notification settings - Fork 1.6k
97 lines (90 loc) · 3.06 KB
/
pr-perf-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Build and run performance tests for PR
on:
# We want to run on forks as we protect with a label.
# Without this we have no secrets to pass.
pull_request_target:
branches:
- master
types:
- labeled
jobs:
pr-perf-test-run:
# We only need to test this once as the rest are chained from it.
if: contains(github.event.pull_request.labels.*.name, 'ok-to-performance-test')
uses: fluent/fluent-bit-ci/.github/workflows/call-run-performance-test.yaml@main
with:
vm-name: fb-perf-test-pr-${{ github.event.number }}
git-branch: ${{ github.head_ref }}
test-directory: examples/perf_test
duration: 30
service: fb-delta
secrets:
service-account: ${{ secrets.GCP_SA_KEY }}
pr-perf-test-upload:
name: PR - performance test upload
# Label check from previous
runs-on: ubuntu-latest
needs:
- pr-perf-test-run
permissions:
pull-requests: write
steps:
- uses: actions/download-artifact@v3
- name: Upload plots to CML
run: |
docker pull -q dvcorg/cml-py3:latest
for FILE in *.png; do
echo "Handling $FILE"
docker run --rm -t \
-v $PWD:/output:rw \
dvcorg/cml-py3:latest \
/bin/sh -c "cml-publish /output/$FILE --driver=github --repo=${{ github.repository }} --md --title=$FILE >> /output/report.md"
done
shell: bash
working-directory: output
- name: Dump markdown to variable
id: report
run: |
file_test_newlines=""
while read line
do
file_test_newlines+=" $line"
done < report.md
echo "report=$file_test_newlines" >> $GITHUB_OUTPUT
shell: bash
working-directory: output
- uses: actions/github-script@v7
if: github.event_name == 'pull_request'
env:
REPORT: "Plots\n${{ steps.report.outputs.report }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `#### Performance Test
Run URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
<details><summary>Show Performance Results</summary>
${process.env.REPORT}
</details>
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
pr-perf-test-complete:
# Only runs on success
name: PR - performance test complete
# Label check from previous
runs-on: ubuntu-latest
needs:
- pr-perf-test-run
permissions:
pull-requests: write
steps:
- uses: actions-ecosystem/action-add-labels@v1
name: Label the PR
with:
labels: ci/performance-test-ok
github_token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}