Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ jobs:
steps:
- uses: actions/checkout@v7

# One interpreter, not a matrix. Unit Tests and Python Compatibility sweep
# 3.10-3.15 because they check that the package *runs* everywhere; these
# tools read the source, and running them five times over would produce
# five copies of the same findings for five times the runner cost.
# One interpreter, not a matrix. Unit Tests sweeps 3.10-3.14 and Python
# Compatibility sweeps the same plus a schedule-only 3.15 leg, because
# they check that the package *runs* everywhere; these tools read the
# source, and running them several times over would produce several
# copies of the same findings for several times the runner cost.
#
# 3.14 specifically, matching cron-vendor.yml, because it is the newest
# non-experimental version in the test matrix and the version the recorded
Expand Down
39 changes: 32 additions & 7 deletions .github/workflows/python-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,53 @@ jobs:
# and one a three-minute test run, with nothing to tell them apart.
name: Compat Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
python-version:
# 3.15 deliberately excluded: ruleset 23497679's required checks
# only cover 3.10-3.14, so it cannot block a merge here either. Its
# replacement is the `compatibility-nightly` job below, which runs
# only on this workflow's existing weekly schedule.
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
experimental:
- false
include:
- python-version: "3.15"
experimental: true
steps:
- uses: actions/checkout@v7

- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: ${{ matrix.experimental }}

- name: Install package
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -e .
- name: Verify package
run: |
python -m compileall -q pcapkit
python -c 'import pcapkit; print(pcapkit.__version__)'
# 3.15 is not in ruleset 23497679's required-checks list, so running it on
# every push/PR was queue contention with no gating signal (it was already
# `continue-on-error`). This job keeps early warning of a 3.15-only
# regression -- import and compileall only, ~14s -- without paying for it on
# every push: it fires solely on the schedule trigger above (line 9).
compatibility-nightly:
name: Compat Python 3.15 (scheduled)
if: ${{ github.event_name == 'schedule' }}
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v7

- uses: actions/setup-python@v7
with:
python-version: "3.15"
allow-prereleases: true

- name: Install package
run: |
Expand Down
55 changes: 36 additions & 19 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,40 +50,49 @@ jobs:
name: Python ${{ matrix.python-version }}
if: ${{ inputs.gate-only != true }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
python-version:
# 3.15 deliberately excluded: ruleset 23497679's required checks
# only cover 3.10-3.14, so a 3.15 leg here cannot block a merge and
# was pure queue contention -- see python-compatibility.yml for its
# (non-blocking, schedule-only) replacement.
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
experimental:
- false
include:
- python-version: "3.15"
experimental: true

steps:
- uses: actions/checkout@v7

- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: ${{ matrix.experimental }}
cache: pip

- name: Install package and test dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -e '.[test]'

# `-n auto` resolves to whatever this runner reports, and nothing else in
# the log says what that was -- print it so the number `-n auto` picked
# is a measured fact instead of an assumption about runner size.
- name: Report available parallelism
run: |
nproc
python -c "import os; print('cpu_count', os.cpu_count())"

- name: Run unit tests
# `--dist load` is pinned explicitly rather than left to default: a
# future change to xdist's own default, or someone "optimising" to
# `loadfile`/`loadscope`, cannot silently change how this suite is
# distributed.
run: >-
python -m pytest -q
python -m pytest -q -n auto --dist load
--ignore=tests/integration
--ignore-glob='*_runtime.py'
--ignore-glob='*_regression.py'
Expand All @@ -92,30 +101,24 @@ jobs:
name: Integration Python ${{ matrix.python-version }}
if: ${{ inputs.gate-only != true }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
python-version:
# See the `test` job above for why 3.15 is excluded here.
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
experimental:
- false
include:
- python-version: "3.15"
experimental: true

steps:
- uses: actions/checkout@v7

- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: ${{ matrix.experimental }}
cache: pip

# The Scapy extra is there for examples/generators/pcap.py and legacy.py,
Expand Down Expand Up @@ -152,6 +155,12 @@ jobs:
echo "Upstream Wireshark captures were used, matching their pinned SHA-256 digests."
fi

# See the `test` job above for why this step exists.
- name: Report available parallelism
run: |
nproc
python -c "import os; print('cpu_count', os.cpu_count())"

# The ``test`` job above already ran every unit-tier test for real, on this
# same commit. Re-running them here (a bare ``pytest -q`` used to) bought
# no signal and cost ~21.75 minutes per Python version -- ~130 minutes per
Expand All @@ -167,7 +176,8 @@ jobs:
# A failure to compute the selection intentionally does not fall back to
# a bare `pytest -q` -- that would silently re-introduce the whole-suite
# duplication this change exists to remove, with nothing in the log to
# say so.
# say so. `--dist load` is pinned explicitly; see the `test` job above
# for why.
- name: Run full test suite
shell: bash
run: |
Expand All @@ -180,7 +190,7 @@ jobs:
exit 1
fi
echo "Fixture-dependent selection: $selection"
python -m pytest -q $selection
python -m pytest -q -n auto --dist load $selection

# ``CHANGELOG.md`` is generated from the newest entry under
# ``docs/source/changelog/`` by ``util/changelog_md.py``, so it falls out of step
Expand Down Expand Up @@ -262,6 +272,12 @@ jobs:
echo "Upstream Wireshark captures were used, matching their pinned SHA-256 digests."
fi

# See the `test` job above for why this step exists.
- name: Report available parallelism
run: |
nproc
python -c "import os; print('cpu_count', os.cpu_count())"

# Deliberately still the whole suite, unlike the `integration` job above:
# this is the shipping gate's own independent re-verification (see the
# job comment above), not the same accidental duplication #715 measured
Expand All @@ -272,6 +288,7 @@ jobs:
# Whether `gate` should run at all on a commit the matrix already
# covered is #715's separate item 2 ("stop the gate re-running on main
# pushes"), a trigger-frequency question, not a selection one -- out of
# scope here.
# scope here. `--dist load` is pinned explicitly; see the `test` job
# above for why.
- name: Run full test suite
run: python -m pytest -q
run: python -m pytest -q -n auto --dist load
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ docs = [
]
test = [
"pytest>=8",
# >=3.6.1, not >=3: the `shouldfail` forwarding tests/conftest.py's xdist fix
# depends on (xdist/remote.py:146-147) lands in 3.6.0, which PyPI has yanked,
# so 3.6.1 is the actual floor. Below it the fix silently reverts and
# test_xdist_run_reports_the_diagnostic_and_fails goes red rather than
# skipped, since `importlib.util.find_spec('xdist')` still succeeds.
"pytest-xdist>=3.6.1",
"typing-extensions",
# Enough of the ``vendor`` extra for a test to import a vendor crawler.
# Without these, ``tests/vendor/test_ipx_socket_unit.py`` reports "9 skipped"
Expand Down
Loading
Loading