Skip to content

pre-release refurb #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 22, 2025
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
17 changes: 11 additions & 6 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: Security check - Bandit

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
branches: [ "*" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
permissions:
checks: write # for bandit-report-artifacts to publish the checks
contents: read # for actions/checkout to fetch code
security-events: write # for bandit-report-artifacts to upload results
actions: read # only on private (maybe?) required to get the Action run status

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Run bandit
uses: VCTLabs/bandit-report-artifacts@master
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI
on:
workflow_dispatch:
push:
branches: [ master ]
branches: [ master, release ]
pull_request:
branches: [ master ]
branches: [ "*" ]

jobs:
build:
Expand All @@ -22,18 +22,20 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: [3.6, 3.7, 3.8, 3.9]
os: [ubuntu-22.04]
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Set git crlf/eol
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -51,8 +53,3 @@ jobs:
- name: Check pkg builds
run: |
tox -e deploy,check

- name: Check docs
if: runner.os == 'Linux'
run: |
tox -e docs
72 changes: 58 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,39 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ubuntu-20.04]
python-version: [3.9]
os: [ubuntu-22.04]
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- name: Set git crlf/eol
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install tox tox-gh-actions
pip install tox

- name: Build dist pkgs
run: |
tox -e deploy

- name: Upload artifacts
uses: actions/upload-artifact@v2
if: matrix.python-version == 3.9 && runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/
name: packages
path: dist

create_release:
name: Create Release
Expand All @@ -62,18 +65,21 @@ jobs:
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo ${{ env.VERSION }}

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

# download all artifacts to project dir
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4

- name: check artifacts
run: |
ls -l packages/

- name: Generate changes file
uses: sarnold/gitchangelog-action@master
uses: sarnold/gitchangelog-action@v1
with:
config_file: .gitchangelog.rc
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN}}

- name: Create release
id: create_release
Expand All @@ -87,11 +93,49 @@ jobs:
draft: false
prerelease: false
files: |
dist/*.whl
packages/*

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist/

docs:
name: Release docs
needs: [create_release]
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Add python requirements
run: |
python -m pip install --upgrade pip
pip install tox

- name: Build docs
run: |
tox -e docs

- uses: actions/upload-artifact@v4
with:
name: ApiDocsHTML
path: "docs/_build/html/"

- name: set nojekyll for github
run: |
sudo touch docs/_build/html/.nojekyll

- name: Deploy docs to gh-pages
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/_build/html/
31 changes: 19 additions & 12 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,28 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

# Builds docs using sphinx
- uses: ammaraskar/sphinx-action@master
- uses: actions/setup-python@v5
with:
pre-build-command: "pip install .[doc]"
docs-folder: "docs/"
python-version: '3.11'

- name: Add python requirements
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions

- name: Build docs
run: |
# tox -e docs-lint
tox -e docs

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ApiDocsHTML
path: "docs/_build/html/"
Expand All @@ -30,9 +40,6 @@ jobs:

- name: Deploy docs to gh-pages
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@3.7.1
uses: JamesIves/github-pages-deploy-action@v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/_build/html/
SINGLE_COMMIT: true
folder: docs/_build/html/
13 changes: 6 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
import os
import sys

import pkg_resources

if sys.version_info < (3, 8):
from importlib_metadata import version
else:
from importlib.metadata import version

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
# needs an extra path here for namespace module-not-a-package
# otherwise apidoc generates empty stub pages
sys.path.insert(0, os.path.abspath('../../lcov_cobertura'))

__version__ = pkg_resources.get_distribution('lcov_cobertura').version
__version__ = version('lcov_cobertura')

# -- Project information -----------------------------------------------------

Expand Down Expand Up @@ -86,7 +85,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = ['_static']

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
html_show_copyright = False
Expand Down
7 changes: 7 additions & 0 deletions lcov_cobertura/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
"""
Coverage conversion tool to make lcov output compatible with tools that
expect Cobertura/coverage.py format.
"""
from lcov_cobertura.lcov_cobertura import LcovCobertura


__all__ = ["LcovCobertura"]
9 changes: 7 additions & 2 deletions lcov_cobertura/lcov_cobertura.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@

from shutil import which

__version__ = '2.0.2'
if sys.version_info < (3, 8):
from importlib_metadata import version
else:
from importlib.metadata import version

__version__ = version('lcov_cobertura')

CPPFILT = "c++filt"
HAVE_CPPFILT = False
Expand Down Expand Up @@ -255,7 +260,7 @@ def generate_cobertura_xml(self, coverage_data, **kwargs):
'lines-covered': str(summary['lines-covered']),
'lines-valid': str(summary['lines-total']),
'timestamp': coverage_data['timestamp'],
'version': '2.0.3'
'version': '2.0.3',
})

sources = self._el(document, 'sources', {})
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[build-system]
requires = [
"setuptools >= 42", # At least v42 of setuptools required!
"wheel"
"setuptools>=45",
"setuptools_scm[toml]>=6.2",
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

[tool.pytest.ini_options]
minversion = "6.0"
testpaths = ["test",]
Expand All @@ -25,7 +27,7 @@ omit = [
source = ["lcov_cobertura"]

[tool.coverage.report]
fail_under = 80
fail_under = 70
show_missing = true

[tool.black]
Expand Down
20 changes: 13 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
[metadata]
name = lcov_cobertura
version = attr: lcov_cobertura.lcov_cobertura.__version__
version = attr: setuptools_scm.get_version
description = LCOV to Cobertura XML converter
url = https://eriwen.github.io/lcov-to-cobertura-xml/
author = Eric Wendelin
author_email = me@eriwen.com
maintainer = Steve Arnold
maintainer_email = nerdboy@gentoo.org
description = LCOV to Cobertura XML converter
long_description = file: README.md
long_description_content_type = text/markdown
url = https://eriwen.github.io/lcov-to-cobertura-xml/
download_url = https://raw.githubusercontent.com/eriwen/lcov-to-cobertura-xml/master/lcov_cobertura/lcov_cobertura.py
license = Apache License, Version 2.0
license_expression = Apache-2.0
license_files = LICENSE
classifiers =
Programming Language :: Python
Intended Audience :: Developers
Expand All @@ -21,8 +23,6 @@ classifiers =
Topic :: Software Development :: Quality Assurance
Development Status :: 5 - Production/Stable
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9

Expand All @@ -31,10 +31,16 @@ keywords =
cobertura

[options]
python_requires = >=3.6
python_requires = >=3.8

setup_requires =
setuptools_scm[toml]

install_requires =
importlib-metadata; python_version < '3.8'

py_modules = lcov_cobertura/lcov_cobertura
packages =
lcov_cobertura

[options.entry_points]
console_scripts =
Expand Down
Loading