From 46f8e875094970425a8392a9c94d175ec8cbc96b Mon Sep 17 00:00:00 2001 From: Cynopolis Date: Thu, 29 May 2025 11:19:25 -0400 Subject: [PATCH] Added a check to see if the timing results have signifigantly changed --- .gitea/workflows/Matrix-Timing.yaml | 38 ++++++++++++++++++++++++++++- .gitea/workflows/Merge-Checker.yaml | 2 -- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/Matrix-Timing.yaml b/.gitea/workflows/Matrix-Timing.yaml index 8e9ff40..88fa5bd 100644 --- a/.gitea/workflows/Matrix-Timing.yaml +++ b/.gitea/workflows/Matrix-Timing.yaml @@ -34,12 +34,48 @@ jobs: if [ -x build/unit-tests/matrix-timing-tests ]; then echo "Running matrix-timing-tests with timing" /usr/bin/time -v build/unit-tests/matrix-timing-tests -d yes &> unit-tests/timing-results/matrix-timing-tests.txt + cat unit-tests/timing-results/matrix-timing-tests.txt else echo "matrix-timing-tests executable not found or not executable" exit 1 fi + - name: Compare timing results + id: check_diff + 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 + cp unit-tests/timing-results/matrix-timing-tests.txt new.txt + + echo "Comparing timing results..." + + CHANGED=0 + awk ' + BEGIN { change_threshold=0.1 } + /^[0-9]+\.[0-9]+ s: / { + new_time = $1 + label = substr($0, index($0, ":") + 2) + if (label_times[label]) { + old_time = label_times[label] + delta = new_time - old_time + if (delta < 0) delta = -delta + if (delta >= change_threshold) { + changed = 1 + } + } else { + changed = 1 + } + } + FILENAME=="old.txt" && /^[0-9]+\.[0-9]+ s: / { + label = substr($0, index($0, ":") + 2) + label_times[label] = $1 + } + END { + exit changed == 1 ? 0 : 1 + } + ' old.txt new.txt + - name: Commit and push timing results - if: github.event.pull_request.head.repo.full_name == github.repository + if: steps.check_diff.outcome == 'success' && github.event.pull_request.head.repo.full_name == github.repository run: | git config --global user.name "ci-bot" git config --global user.email "ci-bot@local" diff --git a/.gitea/workflows/Merge-Checker.yaml b/.gitea/workflows/Merge-Checker.yaml index 4466954..e8d5237 100644 --- a/.gitea/workflows/Merge-Checker.yaml +++ b/.gitea/workflows/Merge-Checker.yaml @@ -3,8 +3,6 @@ name: Merge-Checker on: pull_request: branches: ["**"] - paths-ignore: - - 'unit-tests/timing-results/**' jobs: build_and_test: