Files
parsedmarc/.github/workflows/python-tests.yml
T
Sean WhalenandClaude Sonnet 5.5 3311db4e16 Drop Python 3.10 and add Python 3.15 to the supported versions and CI (#953)
Python 3.10 reaches end of life in October 2026. requires-python is now
>=3.11, the unused requires_python key under [build-system] (not read by
hatchling, and its <3.15 bound read as excluding 3.15) is removed, and
Python 3.15 joins the CI matrix, classifiers, and support tables. Docs,
AGENTS.md, and comments that named 3.10 as the floor are updated.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 12:51:04 -05:00

116 lines
3.5 KiB
YAML

name: Python tests
permissions:
contents: read
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_call:
jobs:
lint-docs-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
# all and postgresql extras included so pyright can resolve every
# optional import (parsedmarc/cli.py's guarded output modules, the
# psycopg import in parsedmarc/postgres.py) and so the docs build
# step below can autodoc parsedmarc.elastic and
# parsedmarc.opensearch, which import their SDKs at module level
pip install .[build,all,postgresql]
- name: Check code style
run: |
ruff check .
ruff format --check .
- name: Check types
run: |
pyright
- name: Test building documentation
run: |
cd docs
make html
- name: Test building packages
run: |
hatch build
test:
needs: lint-docs-build
runs-on: ubuntu-latest
services:
elasticsearch:
image: elasticsearch:8.19.7
env:
discovery.type: single-node
cluster.name: parsedmarc-cluster
discovery.seed_hosts: elasticsearch
bootstrap.memory_lock: true
xpack.security.enabled: false
xpack.license.self_generated.type: basic
ports:
- 9200:9200
- 9300:9300
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get -q update
sudo apt-get -qy install libemail-outlook-message-perl
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
# all extra included because the output-module tests import their
# SDKs at module level. postgresql is deliberately left out so
# tests/test_postgres.py's absent-psycopg arm stays exercised.
pip install .[build,all]
- name: Run unit tests
run: |
python -m pytest --cov --cov-report=xml --junitxml=junit.xml -o junit_family=legacy tests/
- name: Test sample DMARC reports
run: |
# [all] because ci.ini configures an [elasticsearch] output
pip install -e .[all]
parsedmarc --debug -c ci.ini samples/aggregate/*
parsedmarc --debug -c ci.ini samples/failure/*
- name: Test building packages
run: |
hatch build
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Upload test results to Codecov
# Feeds Codecov Test Analytics (flaky-test detection, per-test
# history). Runs even on test failure so failed cases still get
# reported. Uses the same CODECOV_TOKEN as the coverage upload.
# codecov/test-results-action is deprecated in favor of running
# codecov-action a second time with report_type: test_results.
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
files: ./junit.xml