Skip to content

fix(scripts): dont fail on empty benchamrk #3573

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

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,10 @@ jobs:
- name: Read benchmark results
id: benchmark
run: |
if [[ $(find tests/output -name benchmarkResult.json | wc -l) -eq 0 ]]; then
echo "No benchmark results found"
exit 0
fi
# merge all benchmark results into a single json, and remove the files
results=$(jq -s 'add' -c tests/output/**/benchmarkResult.json)
{
Expand All @@ -501,8 +505,8 @@ jobs:
echo "" # empty line is required to make the table work
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 "| Language | Req/s |"
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'
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/githubActions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export const DEPENDENCIES = LANGUAGES.reduce(
finalDependencies[key] = [
':!**node_modules',
`templates/${lang}`,
`templates/issue.yml`,
`templates/LICENSE`,
// language related files
langFolder,
getVersionFileForLanguage(lang),
Expand Down
Loading