From b44643ce938031f7e70cc84b1403b9a3f97598f0 Mon Sep 17 00:00:00 2001 From: George Panchuk Date: Tue, 6 Oct 2026 03:32:55 +0700 Subject: [PATCH 1/3] new: create an issue when weekly ci fails --- .github/workflows/weekly-tests.yml | 72 +++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/.github/workflows/weekly-tests.yml b/.github/workflows/weekly-tests.yml index f84900b4..1575c1a5 100644 --- a/.github/workflows/weekly-tests.yml +++ b/.github/workflows/weekly-tests.yml @@ -20,6 +20,9 @@ jobs: name: Python 3.14 weekly test + outputs: + report: ${{ steps.report.outputs.report }} + steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -35,7 +38,74 @@ jobs: poetry install --no-interaction --no-ansi --without dev,docs - name: Run pytest + # explicit bash runs with pipefail, so tee keeps pytest's exit code + shell: bash env: HF_TOKEN: ${{ secrets.HF_TOKEN }} + PYTHONUNBUFFERED: '1' + run: | + poetry run pytest --durations=20 2>&1 | tee pytest.log + + - name: Collect failure report + id: report + if: failure() || cancelled() + shell: bash + run: | + { + if grep -q 'short test summary info' pytest.log 2>/dev/null; then + sed -n '/short test summary info/,$p' pytest.log + elif [ -s pytest.log ]; then + echo "No pytest test summary, last lines of its output:" + tail -n 50 pytest.log + fi + } | head -c 60000 > report.txt # issue bodies are limited to 65536 characters + if [ -s report.txt ]; then + delimiter="EOF_$(openssl rand -hex 16)" + { + echo "report<<$delimiter" + sed '$a\' report.txt # appends a newline only if the cut left the last line without one + echo "$delimiter" + } >> "$GITHUB_OUTPUT" + fi + + report: + # a timed out job is cancelled rather than failed, so check the result instead of failure() + needs: test + if: always() && github.event_name == 'schedule' && needs.test.result != 'success' + runs-on: ubuntu-latest + permissions: + issues: write # open the failure issue or comment on it + + name: Report weekly test failure + + steps: + - name: Open an issue or comment on the open one + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + RESULT: ${{ needs.test.result }} + REPORT: ${{ needs.test.outputs.report }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + SHA: ${{ github.sha }} run: | - poetry run pytest --durations=20 + title="Weekly tests failed" + { + echo "Run: $RUN_URL" + echo "Result: $RESULT" + echo "Commit: $SHA" + echo + if [ -n "$REPORT" ]; then + echo '```text' + printf '%s\n' "$REPORT" + echo '```' + else + echo "No pytest summary: tests failed to start or the job timed out, see the run log." + fi + } > body.md + issue=$(gh issue list --state open --search "in:title \"$title\"" --json number,title \ + --jq "map(select(.title == \"$title\")) | first | .number // empty") + if [ -n "$issue" ]; then + gh issue comment "$issue" --body-file body.md + else + gh issue create --title "$title" --body-file body.md + fi From 78c3950c85f9d3d78016975083b288a6c577f4c6 Mon Sep 17 00:00:00 2001 From: George Panchuk Date: Tue, 6 Oct 2026 14:07:21 +0700 Subject: [PATCH 2/3] fix: write weekly test summary to a file before truncating it --- .github/workflows/weekly-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/weekly-tests.yml b/.github/workflows/weekly-tests.yml index 1575c1a5..0074850b 100644 --- a/.github/workflows/weekly-tests.yml +++ b/.github/workflows/weekly-tests.yml @@ -58,7 +58,8 @@ jobs: echo "No pytest test summary, last lines of its output:" tail -n 50 pytest.log fi - } | head -c 60000 > report.txt # issue bodies are limited to 65536 characters + } > summary.txt + head -c 60000 summary.txt > report.txt # issue bodies are limited to 65536 characters if [ -s report.txt ]; then delimiter="EOF_$(openssl rand -hex 16)" { From c7279a8616d75d534eed4e0420d7fb2abb6713a4 Mon Sep 17 00:00:00 2001 From: George Panchuk Date: Tue, 6 Oct 2026 14:14:26 +0700 Subject: [PATCH 3/3] chore: assign weekly test failure issues to joein --- .github/workflows/weekly-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/weekly-tests.yml b/.github/workflows/weekly-tests.yml index 0074850b..6d554ad8 100644 --- a/.github/workflows/weekly-tests.yml +++ b/.github/workflows/weekly-tests.yml @@ -108,5 +108,5 @@ jobs: if [ -n "$issue" ]; then gh issue comment "$issue" --body-file body.md else - gh issue create --title "$title" --body-file body.md + gh issue create --title "$title" --body-file body.md --assignee joein fi