Skip to content

Commit 1b53585

Browse files
Matthew HoroszowskiMatthew Horoszowski
authored andcommitted
ci: repair GitHub Actions and pin third-party deprecations
Repairs the ci.yml workflow and adjusts pyproject.toml's pytest filterwarnings so the test suite stays green on the CI matrix (Python 3.9-3.12 on Ubuntu). Workflow changes (.github/workflows/ci.yml) ------------------------------------------- - Run on push to master/develop AND release/**, feature/**, ci/** branches so feature branches get verified before PR open. - Run on PRs targeting master. - Add manual workflow_dispatch trigger. - Three jobs: 1. lint - ruff check on src + tests; ruff format check is advisory (continue-on-error) until a repo-wide format pass. 2. test - matrix on Python 3.9/3.10/3.11/3.12: install -e ., install requirements-test.txt, run pytest with coverage, run behave with --stop. 3. build-check - runs after test passes; python -m build then twine check; uploads dist/ as a 7-day artifact named after the commit SHA. Smoke-validates the publish.yml path on every push without actually publishing. - Drops contents:write permission (CI no longer needs to push). Test config (pyproject.toml) ---------------------------- The pytest config has filterwarnings = ['error', ...] which converts warnings to test failures. Two third-party deprecations need to be whitelisted because they fire on the CI Python versions and are outside our code: - pyparsing 2.x uses sre_constants which is deprecated on Python 3.11+. Whitelisted as 'ignore:module sre_constants is deprecated'. - pyparsing 3.x emits PyparsingDeprecationWarning when test code uses lowerCamelCase shims like delimitedList in tests/unitutil/cxml.py. Whitelisted via 'ignore::DeprecationWarning' scoped to the pyparsing and tests.unitutil.cxml modules. Verified locally: pytest tests -> 2986 passed behave --stop -> 54 features, 981 scenarios, 2932 steps, all passed Dependency pins (requirements*.txt) ----------------------------------- Pinned pyparsing>=2.0.1,<3 in both requirements.txt and requirements-test.txt. The library still works with pyparsing 3.x (filterwarnings catches the deprecations) but pyparsing 2.x is the known-good baseline the test fixtures were written against.
1 parent fdde8a4 commit 1b53585

4 files changed

Lines changed: 67 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,47 @@
11
name: ci
22

3+
# Runs on every push to a branch in this repo and on every pull request
4+
# targeting master. Tags push the same code through publish.yml separately.
5+
36
on:
4-
pull_request:
5-
branches: [ master ]
67
push:
78
branches:
89
- master
910
- develop
11+
- "release/**"
12+
- "feature/**"
13+
- "ci/**"
14+
pull_request:
15+
branches:
16+
- master
17+
workflow_dispatch:
1018

1119
permissions:
12-
contents: write
20+
contents: read
1321

1422
jobs:
23+
lint:
24+
name: Lint (ruff)
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.12"
32+
- name: Install ruff
33+
run: python -m pip install --upgrade ruff
34+
- name: ruff check
35+
run: ruff check src tests
36+
- name: ruff format check
37+
run: ruff format --check src tests
38+
continue-on-error: true # advisory until format pass is run repo-wide
1539

16-
build:
40+
test:
41+
name: Test (Python ${{ matrix.python-version }})
1742
runs-on: ubuntu-latest
1843
strategy:
44+
fail-fast: false
1945
matrix:
2046
python-version: ["3.9", "3.10", "3.11", "3.12"]
2147
steps:
@@ -26,11 +52,35 @@ jobs:
2652
python-version: ${{ matrix.python-version }}
2753
- name: Display Python version
2854
run: python -c "import sys; print(sys.version)"
29-
- name: Install test dependencies
55+
- name: Install package and test deps
3056
run: |
31-
pip install .
32-
pip install -r requirements-test.txt
33-
- name: Test with pytest
34-
run: pytest --cov=pptx --cov-report term-missing tests
35-
- name: Acceptance tests with behave
57+
python -m pip install --upgrade pip
58+
python -m pip install -e .
59+
python -m pip install -r requirements-test.txt
60+
- name: Unit + integration tests (pytest)
61+
run: pytest --cov=pptx --cov-report=term-missing tests
62+
- name: Acceptance tests (behave)
3663
run: behave --stop
64+
65+
build-check:
66+
name: Build sdist and wheel (smoke)
67+
runs-on: ubuntu-latest
68+
needs: test
69+
steps:
70+
- uses: actions/checkout@v4
71+
- name: Set up Python
72+
uses: actions/setup-python@v5
73+
with:
74+
python-version: "3.12"
75+
- name: Install build tooling
76+
run: python -m pip install --upgrade build twine
77+
- name: Build distributions
78+
run: python -m build
79+
- name: Verify metadata renders
80+
run: python -m twine check dist/*
81+
- name: Upload build artifacts
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: dist-${{ github.sha }}
85+
path: dist/
86+
retention-days: 7

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ filterwarnings = [
7272
"ignore::DeprecationWarning:xdist",
7373
# -- pytest complains when pytest-xdist is not installed --
7474
"ignore:Unknown config option. looponfailroots:pytest.PytestConfigWarning",
75+
# -- pyparsing 2.x triggers sre_constants deprecation on Python 3.11+ --
76+
"ignore:module 'sre_constants' is deprecated:DeprecationWarning",
77+
# -- pyparsing 3.x deprecates lowerCamelCase shims (delimitedList etc.) used by tests/unitutil/cxml.py --
78+
"ignore::DeprecationWarning:pyparsing",
79+
"ignore::DeprecationWarning:tests.unitutil.cxml",
7580
]
7681

7782
looponfailroots = [

requirements-test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-r requirements.txt
22
behave>=1.2.3
3-
pyparsing>=2.0.1
3+
pyparsing>=2.0.1,<3
44
pytest>=2.5
55
pytest-coverage
66
pytest-xdist

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ flake8>=2.0
33
lxml>=3.1.0
44
mock>=1.0.1
55
Pillow>=3.3.2
6-
pyparsing>=2.0.1
6+
pyparsing>=2.0.1,<3
77
pytest>=2.5
88
XlsxWriter>=0.5.7

0 commit comments

Comments
 (0)