diff --git a/.github/workflows/regression-test.yaml b/.github/workflows/regression-test.yaml index f555dcf10..3a8db2082 100644 --- a/.github/workflows/regression-test.yaml +++ b/.github/workflows/regression-test.yaml @@ -18,6 +18,9 @@ on: - reopened - synchronize +env: + REGRESSION_TEST_OUTPUT_FILE: output.txt + jobs: regression-tests: if: github.event.pull_request.draft == false @@ -52,10 +55,30 @@ jobs: run: uv sync --only-dev - name: Run regression test + continue-on-error: true run: >- uv run nox -s regression_tests-${{ matrix.python-version }} -- - "$BASE_REF" "$HEAD_REF" + "${BASE_REF}" "${HEAD_REF}" | tee ${REGRESSION_TEST_OUTPUT_FILE} env: BASE_REF: ${{ github.event.pull_request.base.ref }} HEAD_REF: ${{ github.event.pull_request.head.ref }} FORCE_COLOR: 1 + + - name: Extract regression information for PR comment + id: extract_comment + if: failure() + run: >- + f=${REGRESSION_TEST_OUTPUT_FILE}; start=$(grep -n -m1 'Performance has + regressed:' "${f}" | cut -d: -f1) + || { echo "No match"; exit 1; }; + s_dash=$(awk -v n=${start} 'NR<=n && /^-+$/ {l=NR} END{print l}' + "${f}"); e_dash=$(awk -v n=${start} 'NR>=n && /^-+$/ {print NR; exit}' + "${f}"); PR_COMMENT_MSG=$(sed -n "${s_dash},${e_dash}p" "${f}"); echo + "PR_COMMENT_MSG=${PR_COMMENT_MSG}" >> ${GITHUB_OUTPUT}; + + - name: Write PR comment + if: failure() + uses: mshick/add-pr-comment@v2 + with: + message: >- + ${{ steps.extract_comment.outputs.PR_COMMENT_MSG }}