| 1 |
name: Run Tests |
| 2 |
|
| 3 |
on: |
| 4 |
# master - v2.x branch |
| 5 |
# apprise-v1-release - v1.x branch |
| 6 |
push: |
| 7 |
branches: [main, master, apprise-v1-release, 'release/**'] |
| 8 |
# Always test on pull requests targeting any of our long-lived branches |
| 9 |
pull_request: |
| 10 |
branches: [main, master, apprise-v1-release] |
| 11 |
# Allow manual triggering via GitHub UI |
| 12 |
workflow_dispatch: |
| 13 |
|
| 14 |
jobs: |
| 15 |
test: |
| 16 |
name: Python ${{ matrix.python-version }} – ${{ matrix.tox_env }} on ${{ matrix.os }} |
| 17 |
runs-on: ${{ matrix.os || 'ubuntu-latest' }} |
| 18 |
|
| 19 |
strategy: |
| 20 |
fail-fast: false # Let all jobs run, even if one fails |
| 21 |
matrix: |
| 22 |
include: |
| 23 |
- python-version: "3.9" |
| 24 |
tox_env: qa |
| 25 |
- python-version: "3.10" |
| 26 |
tox_env: qa |
| 27 |
- python-version: "3.11" |
| 28 |
tox_env: qa |
| 29 |
- python-version: "3.12" |
| 30 |
tox_env: qa |
| 31 |
|
| 32 |
# Pre-release testing (won't fail entire workflow if this fails) |
| 33 |
- python-version: "3.13-dev" |
| 34 |
tox_env: qa |
| 35 |
continue-on-error: true |
| 36 |
|
| 37 |
- python-version: "3.14-dev" |
| 38 |
tox_env: qa |
| 39 |
continue-on-error: true |
| 40 |
|
| 41 |
- python-version: "3.15-dev" |
| 42 |
tox_env: qa |
| 43 |
continue-on-error: true |
| 44 |
|
| 45 |
# Platform validation only (one version) |
| 46 |
- os: windows-latest |
| 47 |
python-version: "3.12" |
| 48 |
tox_env: qa |
| 49 |
|
| 50 |
- os: macos-latest |
| 51 |
python-version: "3.12" |
| 52 |
tox_env: qa |
| 53 |
|
| 54 |
# Minimal test run on latest Python only |
| 55 |
# this verifies Apprise still works when extra libraries are not available |
| 56 |
- python-version: "3.12" |
| 57 |
tox_env: minimal |
| 58 |
|
| 59 |
steps: |
| 60 |
- uses: actions/checkout@v7 |
| 61 |
|
| 62 |
# Install tox for isolated environment and plugin test orchestration |
| 63 |
- name: Install tox |
| 64 |
run: python -m pip install tox |
| 65 |
|
| 66 |
# Run tox with the specified environment (qa, minimal, etc.) |
| 67 |
- name: Run tox for ${{ matrix.tox_env }} |
| 68 |
run: tox -e ${{ matrix.tox_env }} |
| 69 |
|
| 70 |
- name: Upload coverage report |
| 71 |
if: always() |
| 72 |
uses: actions/upload-artifact@v7 |
| 73 |
with: |
| 74 |
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.tox_env }} |
| 75 |
path: .coverage |
| 76 |
include-hidden-files: true |
| 77 |
# The codecov job below consumes these in the same run, |
| 78 |
# Prevent them from lasting for the default of 90 days |
| 79 |
retention-days: 7 |
| 80 |
|
| 81 |
codecov: |
| 82 |
name: Upload merged coverage to Codecov |
| 83 |
runs-on: ubuntu-latest |
| 84 |
needs: test # Waits for all matrix jobs to complete |
| 85 |
if: always() # Even if a test fails, still attempt to upload what we have |
| 86 |
|
| 87 |
steps: |
| 88 |
- uses: actions/checkout@v7 |
| 89 |
|
| 90 |
- name: Download all coverage reports |
| 91 |
uses: actions/download-artifact@v8 |
| 92 |
with: |
| 93 |
path: coverage-artifacts |
| 94 |
|
| 95 |
- name: Combine and generate coverage |
| 96 |
run: | |
| 97 |
pip install coverage |
| 98 |
|
| 99 |
# Create a consistent temp dir |
| 100 |
mkdir -p coverage-inputs |
| 101 |
|
| 102 |
# Copy and rename each coverage file to .coverage.job_name |
| 103 |
i=0 |
| 104 |
for f in $(find coverage-artifacts -name .coverage); do |
| 105 |
cp "$f" "coverage-inputs/.coverage.$i" |
| 106 |
i=$((i+1)) |
| 107 |
done |
| 108 |
|
| 109 |
# Confirm files staged |
| 110 |
ls -alh coverage-inputs |
| 111 |
|
| 112 |
# Combine them all |
| 113 |
coverage combine coverage-inputs |
| 114 |
coverage report |
| 115 |
coverage xml -o coverage.xml |
| 116 |
|
| 117 |
# Upload merged coverage results to Codecov for visualization |
| 118 |
- name: Upload to Codecov |
| 119 |
uses: codecov/codecov-action@v7 |
| 120 |
with: |
| 121 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 122 |
files: coverage.xml |
| 123 |
verbose: false # Used for debugging only |
| 124 |
fail_ci_if_error: false # Avoid failing job if Codecov is down |
| 125 |
env: |
| 126 |
CODECOV_PR: ${{ github.event.pull_request.number }} |
| 127 |
CODECOV_SHA: ${{ github.sha }} |