|
| 1 | +# =============================================================== |
| 2 | +# 🧪 PyTest & Coverage - Quality Gate |
| 3 | +# =============================================================== |
| 4 | +# |
| 5 | +# - runs the full test-suite across three Python versions |
| 6 | +# - measures branch + line coverage (fails < 40 %) |
| 7 | +# - uploads the XML/HTML coverage reports as build artifacts |
| 8 | +# - (optionally) generates / commits an SVG badge - kept disabled |
| 9 | +# - posts a concise per-file coverage table to the job summary |
| 10 | +# - executes on every push / PR to *main* ➕ a weekly cron |
| 11 | +# --------------------------------------------------------------- |
| 12 | + |
| 13 | +name: Tests & Coverage |
| 14 | + |
| 15 | +on: |
| 16 | + push: |
| 17 | + branches: ["main"] |
| 18 | + pull_request: |
| 19 | + branches: ["main"] |
| 20 | + # schedule: |
| 21 | + # - cron: '42 3 * * 1' # Monday 03:42 UTC |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: write # needed *only* if the badge-commit step is enabled |
| 25 | + checks: write |
| 26 | + actions: read |
| 27 | + |
| 28 | +jobs: |
| 29 | + async-testing: |
| 30 | + name: 🔄 Async Safety & Performance Testing |
| 31 | + runs-on: ubuntu-latest |
| 32 | + needs: [test] |
| 33 | + |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + python: ["3.11", "3.12"] |
| 38 | + |
| 39 | + steps: |
| 40 | + - name: ⬇️ Checkout source |
| 41 | + uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + fetch-depth: 1 |
| 44 | + |
| 45 | + - name: 🐍 Setup Python ${{ matrix.python }} |
| 46 | + uses: actions/setup-python@v5 |
| 47 | + with: |
| 48 | + python-version: ${{ matrix.python }} |
| 49 | + cache: pip |
| 50 | + |
| 51 | + - name: 📦 Install dependencies |
| 52 | + run: | |
| 53 | + python -m pip install --upgrade pip |
| 54 | + pip install -e .[dev] |
| 55 | + pip install flake8-async flake8-bugbear pytest-asyncio snakeviz aiomonitor |
| 56 | + |
| 57 | + - name: 🔍 Run async linting |
| 58 | + run: | |
| 59 | + make async-lint |
| 60 | + |
| 61 | + - name: 🐛 Run async debug tests |
| 62 | + run: | |
| 63 | + make async-debug |
| 64 | + |
| 65 | + - name: 📊 Generate performance profiles |
| 66 | + run: | |
| 67 | + make profile |
| 68 | + |
| 69 | + - name: ⚡ Run async benchmarks |
| 70 | + run: | |
| 71 | + make async-benchmark |
| 72 | + |
| 73 | + - name: ✅ Validate async patterns |
| 74 | + run: | |
| 75 | + make async-validate |
| 76 | + |
| 77 | + - name: 📎 Upload async test artifacts |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: async-test-results |
| 81 | + path: | |
| 82 | + async_testing/reports/ |
| 83 | + async_testing/profiles/ |
| 84 | + retention-days: 30 |
| 85 | + |
| 86 | + - name: 📈 Performance regression check |
| 87 | + run: | |
| 88 | + python async_testing/check_regression.py \ |
| 89 | + --current async_testing/profiles/latest.prof \ |
| 90 | + --baseline async_testing/profiles/baseline.prof \ |
| 91 | + --threshold 20 # 20% regression threshold |
| 92 | +
|
0 commit comments