-
Notifications
You must be signed in to change notification settings - Fork 239
248 lines (215 loc) · 9.28 KB
/
perf.yml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
name: 'Performance test'
on:
repository_dispatch:
types: [trigger-perf]
workflow_dispatch:
inputs:
sha:
description: 'the commit SHA to benchmark'
required: true
env:
GH_PAGES_BRANCH: gh-pages
MAX_BENCHMARKS_TO_KEEP: 100
COMMIT_USER: Github Actions
COMMIT_EMAIL: [email protected]
TESTING_FRAMEWORK_REPO: aws-observability/aws-otel-test-framework
GO_VERSION: ~1.20.8
permissions:
id-token: write
contents: write
jobs:
create-test-ref:
runs-on: ubuntu-latest
outputs:
testRef: ${{ steps.setRef.outputs.ref }}
steps:
- name: Set testRef output
id: setRef
run: |
if [[ ${{ github.ref_name }} == release/v* ]]; then
echo "ref=${{github.ref_name}}" >> $GITHUB_OUTPUT
else
echo "ref=terraform" >> $GITHUB_OUTPUT
fi
get-testing-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-testing-version.outputs.version }}
testing_version: ${{ steps.get-testing-version.outputs.testing_version }}
commit_id: ${{ steps.get-testing-version.outputs.commit_id }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.COLLECTOR_ASSUMABLE_ROLE_ARN }}
aws-region: us-west-2
- name: Download candidate based on dispatch payload
if: github.event_name == 'repository_dispatch'
run: aws s3 cp "s3://aws-otel-collector-release-candidate/${{ github.event.client_payload.sha }}.tar.gz" ./candidate.tar.gz
- name: Download candidate based on workflow dispatch input
if: github.event_name == 'workflow_dispatch'
run: aws s3 cp "s3://aws-otel-collector-release-candidate/${{ github.event.inputs.sha }}.tar.gz" ./candidate.tar.gz
- name: Uncompress the candidate package
run: tar -zxf ./candidate.tar.gz
- name: Get testing version
id: get-testing-version
run: |
version=$(cat build/packages/VERSION)
testing_version=$(cat build/packages/TESTING_VERSION)
commit_id=$(cat build/packages/GITHUB_SHA)
echo "version=$version" >> $GITHUB_OUTPUT
echo "testing_version=$testing_version" >> $GITHUB_OUTPUT
echo "commit_id=$commit_id" >> $GITHUB_OUTPUT
- name: Check benchmarks for commit SHA
id: benchmark-check
run: COMMIT_SHA=${{ steps.get-testing-version.outputs.commit_id }} bash tools/workflow/is-commit-benchmarked.sh
- name: Validate benchmark
run: |
if [[ ${{ steps.benchmark-check.outputs.has-commit }} == true ]]; then
echo "::error::Benchmark already exists for ${{ steps.get-testing-version.outputs.commit_id }}. Skipping."
exit 1
fi
get-perf-test-cases:
runs-on: ubuntu-latest
outputs:
perf_matrix: ${{ steps.get-test-cases.outputs.perf_matrix }}
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Get all the perf test cases (all the soaking test cases are perf test cases)
id: get-test-cases
run: |
perf_matrix=$(python e2etest/get-testcases.py perf_matrix)
echo "perf_matrix=$perf_matrix" >> $GITHUB_OUTPUT
build-aotutil:
runs-on: ubuntu-latest
needs: create-test-ref
steps:
- name: Check out testing framework
uses: actions/checkout@v3
with:
repository: ${{ env.TESTING_FRAMEWORK_REPO }}
path: testing-framework
ref: ${{ needs.create-test-ref.outputs.testRef }}
- name: Cache aotutil
uses: actions/cache@v3
id: cache
with:
key: "aotutil_${{ hashFiles('testing-framework/cmd/aotutil/*.go') }}_${{ hashFiles('testing-framework/cmd/aotutil/go.sum') }}"
path: testing-framework/cmd/aotutil/aotutil
- name: Set up Go 1.x
uses: actions/setup-go@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: testing-framework/cmd/aotutil/go.sum
- name: Build aotutil
if: steps.cache.outputs.cache-hit != 'true'
run: cd testing-framework/cmd/aotutil && make build
run-perf-test:
runs-on: ubuntu-latest
needs: [get-perf-test-cases, get-testing-version, create-test-ref, build-aotutil]
strategy:
matrix: ${{ fromJson(needs.get-perf-test-cases.outputs.perf_matrix) }}
max-parallel: 10
steps:
- uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.COLLECTOR_ASSUMABLE_ROLE_ARN }}
aws-region: us-west-2
# 3 hours
role-duration-seconds: 10800
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Set up terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: "~1.5"
- name: Check out testing framework
uses: actions/checkout@v3
with:
repository: ${{ env.TESTING_FRAMEWORK_REPO}}
path: testing-framework
ref: ${{ needs.create-test-ref.outputs.testRef }}
- name: Restore aotutil
uses: actions/cache@v3
with:
key: "aotutil_${{ hashFiles('testing-framework/cmd/aotutil/*.go') }}_${{ hashFiles('testing-framework/cmd/aotutil/go.sum') }}"
path: testing-framework/cmd/aotutil/aotutil
fail-on-cache-miss: true
- name: Run Performance test
run: |
if [[ -f testing-framework/terraform/testcases/${{ matrix.testcase }}/parameters.tfvars ]] ; then opts="-var-file=../testcases/${{ matrix.testcase }}/parameters.tfvars" ; else opts="" ; fi
cd testing-framework/terraform/performance && terraform init && terraform apply -auto-approve -lock=false -var="data_rate=${{ matrix.data_rate }}" -var="commit_id=${{ needs.get-testing-version.outputs.commit_id }}" $opts -var="aoc_version=${{ needs.get-testing-version.outputs.testing_version }}" -var="testcase=../testcases/${{ matrix.testcase }}" -var="testing_ami=${{ matrix.testing_ami }}" -var="ssh_key_name=aoc-ssh-key-2022-09-13" -var="sshkey_s3_bucket=aoc-ssh-key" -var="sshkey_s3_private_key=aoc-ssh-key-2022-09-13.txt"
- name: Upload the performance model as an artifact
uses: actions/upload-artifact@v3
with:
name: "performance-model-${{ matrix.testcase }}-${{ matrix.data_rate }}-${{ matrix.testing_ami }}"
path: testing-framework/terraform/performance/output/performance.json
retention-days: 1
- name: Destroy terraform resources
if: ${{ always() }}
run: |
cd testing-framework/terraform/performance && terraform destroy -auto-approve
upload-performance-model:
runs-on: ubuntu-latest
needs: [get-testing-version, run-perf-test]
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Jinja2
run: pip install Jinja2
- name: get all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Produce performance report
run: python e2etest/get-performance-model-table.py -v ${{ needs.get-testing-version.outputs.version }}
# Uses github-action-benchmark to update historic benchmark data
- name: Store benchmark result
uses: benchmark-action/[email protected]
with:
tool: "customSmallerIsBetter"
output-file-path: performance-data.json
benchmark-data-dir-path: benchmark/trend
max-items-in-chart: ${{ env.MAX_BENCHMARKS_TO_KEEP }}
gh-pages-branch: ${{ env.GH_PAGES_BRANCH }}
github-token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ needs.get-testing-version.outputs.commit_id }}
auto-push: false
- name: Commit to gh-pages branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git switch ${{ env.GH_PAGES_BRANCH }}
rsync -avv performance-report.md benchmark/report.md
rsync -avv performance-data.json benchmark/data/
git add benchmark/data/* benchmark/report.md
git -c user.name="${{ env.COMMIT_USER }}" -c user.email="${{ env.COMMIT_EMAIL }}" commit --amend --reset-author -m "Update benchmarking for ${{ needs.get-testing-version.outputs.commit_id }}"
git push origin ${{ env.GH_PAGES_BRANCH }}:${{ env.GH_PAGES_BRANCH }}