mirror of https://github.com/gofiber/fiber.git
fix duplicated benchmark name problem
parent
77622700d7
commit
689537a0d2
|
@ -35,6 +35,35 @@ jobs:
|
||||||
|
|
||||||
- name: Run Benchmark
|
- name: Run Benchmark
|
||||||
run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt
|
run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt
|
||||||
|
### hack because of the problem with duplicated benchmark names - https://github.com/benchmark-action/github-action-benchmark/issues/264
|
||||||
|
- name: Extract Module Name
|
||||||
|
id: extract-module
|
||||||
|
run: |
|
||||||
|
MODULE_NAME=$(awk '/^module / {print $2}' go.mod)
|
||||||
|
echo "MODULE_NAME=$MODULE_NAME" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Identify Duplicate Benchmark Names
|
||||||
|
run: |
|
||||||
|
awk '/^Benchmark/ {print $1}' output.txt | sort | uniq -d > duplicate_benchmarks.txt
|
||||||
|
|
||||||
|
- name: Add Normalized Package Prefix to Duplicate Benchmark Names
|
||||||
|
run: |
|
||||||
|
awk -v MODULE_NAME="$MODULE_NAME" '
|
||||||
|
FNR==NR {duplicates[$1]; next}
|
||||||
|
/^pkg: / { package=$2 }
|
||||||
|
/^Benchmark/ {
|
||||||
|
if ($1 in duplicates) {
|
||||||
|
sub("^" MODULE_NAME "/?", "", package)
|
||||||
|
gsub("/", "_", package)
|
||||||
|
print $1 "_" package substr($0, length($1) + 1)
|
||||||
|
} else {
|
||||||
|
print $0
|
||||||
|
}
|
||||||
|
next
|
||||||
|
}
|
||||||
|
{ print }
|
||||||
|
' duplicate_benchmarks.txt output.txt > output.txt
|
||||||
|
### end
|
||||||
|
|
||||||
# NOTE: Benchmarks could change with different CPU types
|
# NOTE: Benchmarks could change with different CPU types
|
||||||
- name: Get GitHub Runner System Information
|
- name: Get GitHub Runner System Information
|
||||||
|
|
Loading…
Reference in New Issue