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
90 changes: 36 additions & 54 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: ["master"]
tags:
- "*"
- "v*"
pull_request:
branches: ["master"]
workflow_dispatch:
Expand All @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Event File
path: ${{ github.event_path }}
Expand All @@ -25,85 +25,61 @@ jobs:
uses: "./.github/workflows/test-os.yml"
with:
os: '["ubuntu-24.04"]'
python-version: '["3.10", "3.11", "3.12", "3.13"]'
python-version: '["3.10", "3.11", "3.12", "3.13", "3.14"]'

test-win:
name: "Test Windows"
uses: "./.github/workflows/test-os.yml"
with:
os: '["windows-2025"]'
python-version: '["3.10", "3.11", "3.12", "3.13"]'
python-version: '["3.14"]'
pytest-args: 'tests/test_cli.py tests/test_fromfile.py'
lxml: '["", "lxml"]'

test-mac:
name: "Test macOS"
uses: "./.github/workflows/test-os.yml"
with:
os: '["macos-15"]'
python-version: '["3.10", "3.11", "3.12", "3.13"]'
python-version: '["3.14"]'
pytest-args: 'tests/test_cli.py tests/test_fromfile.py'

coverage-lint:
name: "Coverage & Lint"
needs: ["test-linux", "test-win", "test-mac"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
- name: Setup locales
run: |
sudo locale-gen en_US.UTF-8
sudo locale-gen de_DE.UTF-8
sudo update-locale
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install lxml flake8 pytest coverage
- name: Lint with flake8
run: |
# The GitHub editor is 127 chars wide
flake8 . --count --max-complexity=10 --max-line-length=127 --show-source --statistics
run: uv sync --group dev
- name: Lint with ruff
run: uv run ruff check .
- name: Test and coverage
run: |
coverage run -m pytest
uv run pytest --cov=src/junitparser --cov-report=xml
bash <(curl -s https://codecov.io/bash)

package-build:
name: "Build Package"
needs: coverage-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
- name: Build packages
run: |
# Build packages
echo "::group::build"
pip install build
python -m build
echo "::endgroup::"

echo "::group::dist/"
uv build
ls -lah dist/
echo "::endgroup::"

echo "::group::tar.gz"
tar -tzvf dist/junitparser-*.tar.gz
echo "::endgroup::"

echo "::group::wheel"
unzip -l dist/junitparser-*.whl
echo "::endgroup::"

echo "::group::wheel metadata"
unzip -p dist/junitparser-*.whl junitparser-*.dist-info/METADATA
echo "::endgroup::"
- name: Upload
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Binaries
path: dist/*
Expand All @@ -114,25 +90,31 @@ jobs:
uses: "./.github/workflows/test-whl.yml"
with:
os: '["ubuntu-24.04"]'
python-version: '["3.10", "3.11", "3.12", "3.13"]'
python-version: '["3.10"]'

package-publish:
name: "Publish Package"
needs: test-whl
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
- name: Download Binaries
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8.0.1
with:
name: Binaries
path: dist/
- name: Inspect binaries
run: ls -lah dist/
- name: Verify tag matches package version
run: |
ls -lah dist/
- name: Publish to pypi
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
tag="${GITHUB_REF#refs/tags/v}"
version=$(python -c "from pathlib import Path; import tomllib; data = tomllib.loads(Path('pyproject.toml').read_text(encoding='utf-8')); print(data['project']['version'])")
test "$tag" = "$version"
- name: Publish to PyPI
run: uv publish --trusted-publishing always
38 changes: 22 additions & 16 deletions .github/workflows/test-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,35 @@ on:
python-version:
required: true
type: string
pytest-args:
required: false
type: string
default: ''
lxml:
required: false
type: string
default: '[""]'
include:
required: false
type: string
default: '[]'

jobs:
test:
name: Test (python-${{ matrix.python-version }}, ${{ matrix.os }})
name: Test (python-${{ matrix.python-version }}, ${{ matrix.os }}, ${{ matrix.lxml != '' && 'lxml' || 'no-lxml' }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(inputs.os) }}
python-version: ${{ fromJson(inputs.python-version) }}
lxml: ${{ fromJson(inputs.lxml) }}
include: ${{ fromJson(inputs.include) }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Setup locales
Expand All @@ -38,20 +47,17 @@ jobs:
sudo locale-gen de_DE.UTF-8
sudo update-locale
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
shell: bash
run: uv sync --group dev
- name: Test
run: |
pytest --junit-xml=test-results-py${{ matrix.python-version }}-xml.xml
- name: Test with lxml
run: |
pip install lxml
pytest --junit-xml=test-results-py${{ matrix.python-version }}-lxml.xml
run: >
uv run
${{ matrix.lxml != '' && '--with lxml' || '' }}
pytest
${{ inputs.pytest-args }}
--junit-xml=test-results-py${{ matrix.python-version }}-${{ matrix.lxml != '' && 'lxml' || 'xml' }}.xml
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Test Results (Python ${{ matrix.python-version }}, ${{ matrix.os }})
name: Test Results (Python ${{ matrix.python-version }}, ${{ matrix.os }}, ${{ matrix.lxml != '' && 'lxml' || 'no-lxml' }})
path: test-results-py*-*.xml
2 changes: 1 addition & 1 deletion .github/workflows/test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
uses: dawidd6/action-download-artifact@v20
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/test-whl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,39 @@ on:
python-version:
required: true
type: string
lxml:
required: false
type: string
default: '[""]'
include:
required: false
type: string
default: '[]'

jobs:
test:
name: Test whl (python-${{ matrix.python-version }}, ${{ matrix.os }})
name: Test whl (python-${{ matrix.python-version }}, ${{ matrix.os }}, ${{ matrix.lxml != '' && 'lxml' || 'no-lxml' }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(inputs.os) }}
python-version: ${{ fromJson(inputs.python-version) }}
lxml: ${{ fromJson(inputs.lxml) }}
include: ${{ fromJson(inputs.include) }}

steps:
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Download Binaries
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8.0.1
with:
name: Binaries
path: dist/
- name: Run junitparser CLI
run: |
pip install dist/junitparser-*.whl
tar -xzf dist/junitparser-*.tar.gz --to-stdout --wildcards "junitparser-*/tests/data/no_fails.xml" > no_fails.xml
junitparser verify no_fails.xml
pip install lxml
junitparser verify no_fails.xml
wheel=$(echo dist/junitparser-*.whl)
uv run --with "$wheel" ${{ matrix.lxml != '' && '--with lxml' || '' }} junitparser verify tests/data/no_fails.xml
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.12
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
17 changes: 10 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"
requires = ["uv_build>=0.11.7,<0.12.0"]
build-backend = "uv_build"

[project]
name = "junitparser"
dynamic = ["version"]
version = "5.0.1a1"
authors = [
{ name="Weiwei Wang", email="gastlygem@gmail.com" },
]
Expand All @@ -30,8 +30,11 @@ Documentation = "https://junitparser.readthedocs.io/"
[project.scripts]
junitparser = "junitparser.cli:main"

[tool.setuptools]
packages = ["junitparser"]
[dependency-groups]
dev = [
"pre-commit>=4.6.0",
"pytest>=9.0.3",
"pytest-cov>=7.1.0",
"ruff>=0.15.12",
]

[tool.setuptools.dynamic]
version = {attr = "junitparser.version"}
6 changes: 4 additions & 2 deletions junitparser/__init__.py → src/junitparser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from importlib.metadata import version as _dist_version

from .junitparser import (
Attr,
Element,
Expand All @@ -16,7 +18,7 @@
TestSuite,
)

version = "5.0.0"
version = _dist_version("junitparser")

__all__ = [
"Attr",
Expand All @@ -34,5 +36,5 @@
"SystemErr",
"TestCase",
"TestSuite",
"version"
"version",
]
File renamed without changes.
File renamed without changes.
Loading
Loading