name: Merge-Checker on: pull_request: branches: ["**"] push: branches: ["**"] # Avoid triggering on timing results auto-commits paths-ignore: - 'unit-tests/timing-results/**' jobs: build_and_test: runs-on: ubuntu-latest steps: - name: Checkout source code uses: actions/checkout@v3 with: persist-credentials: true fetch-depth: 0 - name: Install dependencies (CMake + Ninja + build tools) run: | sudo apt-get update sudo apt-get install -y cmake ninja-build build-essential time git - name: Configure project with CMake run: cmake -G Ninja -S . -B build/ - name: Build with Ninja run: ninja -C build/ - name: Run all unit tests except matrix-timing-tests run: | for test_exec in build/unit-tests/matrix-tests build/unit-tests/quaternion-tests build/unit-tests/vector-3d-tests; do if [ -x "$test_exec" ]; then echo "Running $test_exec" "$test_exec" else echo "Warning: $test_exec not found or not executable" fi done - name: Run matrix-timing-tests with per-test timing output and save results run: | mkdir -p unit-tests/timing-results 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 else echo "matrix-timing-tests executable not found or not executable" exit 1 fi - name: Commit and push timing results run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" # Save current branch name BRANCH_NAME=$(echo "${GITHUB_REF##refs/heads/}") git add unit-tests/timing-results/matrix-timing-tests.txt if git diff --quiet --cached; then echo "No changes to commit" else git commit -m "Update matrix-timing-tests timings [skip ci]" git push origin HEAD:$BRANCH_NAME fi