Fixing timing test runner
All checks were successful
Benchmarking / benchmarking (pull_request) Successful in 22s
All checks were successful
Benchmarking / benchmarking (pull_request) Successful in 22s
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: Merge-Checker
|
name: Benchmarking
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -7,7 +7,7 @@ on:
|
|||||||
- 'unit-tests/timing-results/**'
|
- 'unit-tests/timing-results/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_test:
|
benchmarking:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -39,43 +39,62 @@ jobs:
|
|||||||
echo "matrix-timing-tests executable not found or not executable"
|
echo "matrix-timing-tests executable not found or not executable"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Compare timing results
|
- name: Compare timing results
|
||||||
id: check_diff
|
id: check_diff
|
||||||
run: |
|
run: |
|
||||||
# Ensure the previous version exists (from git)
|
|
||||||
git show origin/${{ github.event.pull_request.head.ref }}:unit-tests/timing-results/matrix-timing-tests.txt > old.txt || echo "" > old.txt
|
git show origin/${{ github.event.pull_request.head.ref }}:unit-tests/timing-results/matrix-timing-tests.txt > old.txt || echo "" > old.txt
|
||||||
cp unit-tests/timing-results/matrix-timing-tests.txt new.txt
|
cp unit-tests/timing-results/matrix-timing-tests.txt new.txt
|
||||||
|
|
||||||
echo "Comparing timing results..."
|
echo "Comparing timing results for changes ≥ 0.1s (ignoring 'Timing Tests' lines)..."
|
||||||
|
|
||||||
CHANGED=0
|
changed=0
|
||||||
awk '
|
|
||||||
BEGIN { change_threshold=0.1 }
|
awk -v changed_ref=/tmp/timings_changed.flag '
|
||||||
/^[0-9]+\.[0-9]+ s: / {
|
BEGIN {
|
||||||
|
change_threshold = 0.1
|
||||||
|
}
|
||||||
|
FILENAME == "old.txt" && /^[0-9]+\.[0-9]+ s: / {
|
||||||
|
label = substr($0, index($0, ":") + 2)
|
||||||
|
if (label != "Timing Tests") {
|
||||||
|
label_times[label] = $1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FILENAME == "new.txt" && /^[0-9]+\.[0-9]+ s: / {
|
||||||
new_time = $1
|
new_time = $1
|
||||||
label = substr($0, index($0, ":") + 2)
|
label = substr($0, index($0, ":") + 2)
|
||||||
if (label_times[label]) {
|
if (label == "Timing Tests") next
|
||||||
|
|
||||||
old_time = label_times[label]
|
old_time = label_times[label]
|
||||||
delta = new_time - old_time
|
delta = new_time - old_time
|
||||||
if (delta < 0) delta = -delta
|
if (delta < 0) delta = -delta
|
||||||
if (delta >= change_threshold) {
|
|
||||||
changed = 1
|
if (old_time != "" && delta >= change_threshold) {
|
||||||
|
printf "⚠️ %.3f s → %.3f s: %s (Δ=%.3f s)\n", old_time, new_time, label, delta
|
||||||
|
system("touch " changed_ref)
|
||||||
|
} else if (old_time == "") {
|
||||||
|
printf "🆕 New timing entry: %.3f s: %s\n", new_time, label
|
||||||
|
system("touch " changed_ref)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
changed = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FILENAME=="old.txt" && /^[0-9]+\.[0-9]+ s: / {
|
|
||||||
label = substr($0, index($0, ":") + 2)
|
|
||||||
label_times[label] = $1
|
|
||||||
}
|
}
|
||||||
END {
|
END {
|
||||||
exit changed == 1 ? 0 : 1
|
if (!system("test -f " changed_ref)) {
|
||||||
|
exit 0
|
||||||
|
} else {
|
||||||
|
print "✅ Timings haven’t changed significantly (Δ < 0.1s)."
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
' old.txt new.txt
|
' old.txt new.txt
|
||||||
|
|
||||||
|
if [ -f /tmp/timings_changed.flag ]; then
|
||||||
|
echo "timings_changed=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "timings_changed=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Commit and push timing results
|
- name: Commit and push timing results
|
||||||
if: steps.check_diff.outcome == 'success' && github.event.pull_request.head.repo.full_name == github.repository
|
if: steps.check_diff.outputs.timings_changed == 'true' && github.event.pull_request.head.repo.full_name == github.repository
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "ci-bot"
|
git config --global user.name "ci-bot"
|
||||||
git config --global user.email "ci-bot@local"
|
git config --global user.email "ci-bot@local"
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
name: Merge-Checker
|
name: Merge-Checker
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_run:
|
||||||
branches: ["**"]
|
workflows: ["Benchmarking"]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_test:
|
build_and_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user