From db021680d75845a723c55c1c60a9d6e096018661 Mon Sep 17 00:00:00 2001 From: shiffiH Date: Sun, 30 Nov 2025 10:43:44 +0200 Subject: [PATCH] Update daily_pytest_slack.yml --- .github/workflows/daily_pytest_slack.yml | 82 ------------------------ 1 file changed, 82 deletions(-) diff --git a/.github/workflows/daily_pytest_slack.yml b/.github/workflows/daily_pytest_slack.yml index d8285bf6b..8b1378917 100644 --- a/.github/workflows/daily_pytest_slack.yml +++ b/.github/workflows/daily_pytest_slack.yml @@ -1,83 +1 @@ -name: Daily Pytest + Slack (IL 01:00) -on: - schedule: - # 01:00 Israel time — 22:00 UTC (summer), 23:00 UTC (winter) - - cron: "0 22 * * *" - - cron: "0 23 * * *" - workflow_dispatch: - -jobs: - run_pytests_and_notify: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - - name: Run pytest (and keep log) - run: | - pytest -q --maxfail=50 --disable-warnings -rA \ - --junitxml=pytest-report.xml > pytest.log 2>&1 || true - - - name: Parse results - id: results - run: | - python - <<'PY' - import xml.etree.ElementTree as ET - import os - counts = dict(tests=0, failures=0, errors=0, skipped=0) - try: - tree = ET.parse("pytest-report.xml") - root = tree.getroot() - for suite in root.findall(".//testsuite"): - counts["tests"] += int(suite.attrib.get("tests", 0)) - counts["failures"] += int(suite.attrib.get("failures", 0)) - counts["errors"] += int(suite.attrib.get("errors", 0)) - counts["skipped"] += int(suite.attrib.get("skipped", 0)) - except Exception as e: - print("Parse error:", e) - counts["passed"] = counts["tests"] - counts["failures"] - counts["errors"] - counts["skipped"] - with open(os.environ["GITHUB_OUTPUT"], "a") as f: - for k,v in counts.items(): - f.write(f"{k}={v}\n") - f.write(f"has_failures={'true' if (counts['failures']>0 or counts['errors']>0) else 'false'}\n") - PY - - - name: Send Slack notification (if failures) - if: steps.results.outputs.has_failures == 'true' - uses: slackapi/slack-github-action@v1.25.0 - with: - payload: | - { - "channel": "#vast", - "username": "GitHub Actions", - "icon_emoji": ":rotating_light:", - "text": "🚨 *Pytest Failures Detected!*\n\nRepository: ${{ github.repository }}\nRun: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>\n\n*Passed:* ${{ steps.results.outputs.passed }} / ${{ steps.results.outputs.tests }}\n*Failed:* ${{ steps.results.outputs.failures }}\n*Errors:* ${{ steps.results.outputs.errors }}\n*Skipped:* ${{ steps.results.outputs.skipped }}" - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - - - name: Send Slack success notification - if: steps.results.outputs.has_failures == 'false' - uses: slackapi/slack-github-action@v1.25.0 - with: - payload: | - { - "channel": "#vast", - "username": "GitHub Actions", - "icon_emoji": ":white_check_mark:", - "text": "✅ All tests passed successfully!\n\nRepository: ${{ github.repository }}\nRun: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>\n\nTotal tests: ${{ steps.results.outputs.tests }}" - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}