-
Notifications
You must be signed in to change notification settings - Fork 21
chore(cts): report benchmark results #3406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -254,6 +254,9 @@ jobs: | |
if: ${{ !github.event.pull_request.head.repo.fork && steps.cts-e2e.outcome == 'failure' }} | ||
run: yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests | ||
|
||
- name: Run benchmarks | ||
run: yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --benchmark --no-client --no-requests --no-e2e | ||
|
||
- name: Generate code snippets for documentation | ||
run: yarn cli snippets javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} | ||
|
||
|
@@ -348,6 +351,9 @@ jobs: | |
if: ${{ !github.event.pull_request.head.repo.fork && steps.cts-e2e.outcome == 'failure' }} | ||
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests | ||
|
||
- name: Run benchmarks | ||
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --benchmark --no-client --no-requests --no-e2e | ||
|
||
- name: Generate code snippets for documentation | ||
run: yarn cli snippets ${{ matrix.client.language }} ${{ matrix.client.toRun }} | ||
|
||
|
@@ -474,6 +480,26 @@ jobs: | |
- name: Generate documentation specs with code snippets | ||
run: yarn cli build specs ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).toRun }} --docs | ||
|
||
- name: Read benchmark results | ||
id: benchmark | ||
run: | | ||
# merge all benchmark results into a single json, and remove the files | ||
results=$(jq -s 'add' -c tests/output/**/benchmarkResult.json) | ||
{ | ||
echo 'BENCHMARK_SECTION<<EOF' | ||
echo "<details>" | ||
echo "<summary>📊 Benchmark results</summary>" | ||
echo "" # empty line is required to make the table work | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we still need it now that we have a comment? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need what ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this specific line 492 which add an empty line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahhh ok make sense |
||
echo "Benchmarks performed on the `search` method using a mock server, the results might not reflect the real-world performance." | ||
# format the json to a markdown table with column "Language" and "rate" | ||
echo "| Language | Rate |" | ||
echo "| :------- | ---: |" | ||
echo "$results" | jq -r 'to_entries | map([.key, .value.rate]) | sort_by(.[1]) | reverse | .[] | @tsv' | awk -F'\t' '{printf "| %-10s | %10d |\n", $1, $2}' | ||
echo "</details>" | ||
echo 'EOF' | ||
} >> "$GITHUB_OUTPUT" | ||
rm -rf tests/output/**/benchmarkResult.json | ||
|
||
- name: Push generated code | ||
id: pushGeneratedCode | ||
run: yarn workspace scripts pushGeneratedCode | ||
|
@@ -491,6 +517,8 @@ jobs: | |
|
||
_If you believe code should've been generated, please, [report the issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=Bug_report.yml&title=%5Bbug%5D%3A+)._ | ||
|
||
${{ steps.benchmark.outputs.BENCHMARK_SECTION }} | ||
|
||
- name: update generation comment | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
if: ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT != '' }} | ||
|
@@ -505,6 +533,8 @@ jobs: | |
| 🍃 Generated commit | [`${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT }}`](${{ github.event.pull_request.base.repo.html_url }}/commit/${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT }}) | | ||
| 🌲 Generated branch | [`generated/${{ github.head_ref }}`](${{ github.event.pull_request.base.repo.html_url }}/tree/generated/${{ github.head_ref }}) | | ||
|
||
${{ steps.benchmark.outputs.BENCHMARK_SECTION }} | ||
|
||
- name: Build website | ||
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' }} | ||
run: yarn website:build | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a small disclaimer like
take those results with a grain of salt, best effort benchmarking solution, in order to highlight general performances of our Search API
or something like that? just so people don't expect those to be a source of truth or things like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also we should mention that it's only tested on search?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a small disclaimer, I would like to add more benchmark in the future so I'm not very specific.