Skip to content

Commit

Permalink
Merge pull request #2 from TheCleric/Fork-to-new-project
Browse files Browse the repository at this point in the history
Fork to new pip project
  • Loading branch information
TheCleric authored Aug 22, 2021
2 parents db454b0 + 87183b3 commit d322ea8
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 25 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This workflow will run tests on PRs

name: PyTest On PR

on:
pull_request:
branches:
- master

jobs:
test:
name: ${{ matrix.platform }} / ${{ matrix.python-version }}
strategy:
matrix:
python-version:
- 3.6
- 3.7
- 3.8
- 3.9
platform:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: "${{ matrix.platform }}"
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "${{ matrix.python-version }}"

- name: Bootstrap poetry
shell: bash
run: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
- name: Update PATH
if: ${{ matrix.platorm != 'windows-latest' }}
shell: bash
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Update Path for Windows
if: ${{ matrix.platform == 'windows-latest' }}
shell: bash
run: echo "$APPDATA\\Python\\Scripts" >> $GITHUB_PATH

- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true

- name: Sanity check poetry config
shell: bash
run: poetry check

- name: Run poetry bui
shell: bash
run: poetry build

- name: Install dependencies
shell: bash
run: poetry install

- name: Run pytest
shell: bash
run: poetry run python -m pytest -p no:sugar -q tests/
21 changes: 18 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,24 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: "3.6"

- name: Install Poetry
run: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -

- name: Bootstrap poetry
shell: bash
run: |
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \
| python -
- name: Update PATH
shell: bash
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Build project for distribution
shell: bash
run: poetry build

- name: Check Version
id: check-version
shell: bash
run: |
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|| echo ::set-output name=prerelease::true
Expand All @@ -45,7 +51,16 @@ jobs:
draft: false
prerelease: steps.check-version.outputs.prerelease == 'true'

- name: Install dependencies
shell: bash
run: poetry install

- name: Run pytest
shell: bash
run: poetry run python -m pytest -p no:sugar -q tests/

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
shell: bash
run: poetry publish
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
__pycache__
.DS_Store
.venv
venv
.python-version
/dist/*
dist
.coverage
lcov.info
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
# coveragepy-lcov
# coverage-lcov

`coveragepy-lcov` is a simple CLI for converting `.coverage` files generated by [Coverage.py](https://github.com/nedbat/coveragepy) to the `LCOV` format.
`coverage-lcov` is a simple CLI for converting `.coverage` files generated by [Coverage.py](https://github.com/nedbat/coveragepy) to the `LCOV` format.

## Credits

This tools is based on code from [Coverage.py](https://github.com/nedbat/coveragepy/blob/master/coverage/report.py).
- This tools is based on code from [Coverage.py](https://github.com/nedbat/coveragepy/blob/master/coverage/report.py)
- This tool is forked from [coveragepy-lcov](https://github.com/chaychoong/coveragepy-lcov) by [Chay Choong](https://github.com/chaychoong) to add support for older python versions.

## Installation

Using pip:

```bash
pip install coveragepy-lcov
pip install coverage-lcov
```

## Usage

```bash
# If the .coverage file is in your current working directory
coveragepy-lcov
coverage-lcov

# Point to a different .coverage file path
coveragepy-lcov --data_file_path example/.coverage
coverage-lcov --data_file_path example/.coverage

# Write the output to a different file path
coveragepy-lcov --output_file_path build/lcov.info
coverage-lcov --output_file_path build/lcov.info

# Use relative paths in the LCOV output
coveragepy-lcov --relative_path
coverage-lcov --relative_path
```

## Options

```text
Usage: coveragepy-lcov [OPTIONS]
Usage: coverage-lcov [OPTIONS]
Options:
--data_file_path TEXT Path to .coverage file
Expand All @@ -48,3 +49,4 @@ Options:

- [LCOV format](http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php)
- https://github.com/nedbat/coveragepy/issues/587
- https://github.com/chaychoong/coveragepy-lcov
5 changes: 5 additions & 0 deletions coverage_lcov/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os

import toml

__version__ = toml.load(os.path.join(os.path.dirname(__file__), "..", "pyproject.toml"))["tool"]["poetry"]["version"]
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from coverage.files import FnmatchMatcher, prep_patterns
from coverage.misc import CoverageException, NoSource, NotPython

log = logging.getLogger("coveragepy_lcov.converter")
log = logging.getLogger("coverage_lcov.converter")


class Converter:
Expand Down
1 change: 0 additions & 1 deletion coveragepy_lcov/__init__.py

This file was deleted.

11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[tool.poetry]
name = "coveragepy-lcov"
version = "0.1.1"
name = "coverage-lcov"
version = "0.2.0"
description = "A simple .coverage to LCOV converter"
authors = ["Chay Choong <chaychoong@gmail.com>"]
repository = "https://github.com/chaychoong/coveragepy-lcov"
authors = ["Adam Weeden <adamweeden@gmail.com>", "Chay Choong <chaychoong@gmail.com>"]
repository = "https://github.com/TheCleric/coverage-lcov"
readme = "README.md"
keywords = ["coverage"]

[tool.poetry.scripts]
coveragepy-lcov = "coveragepy_lcov.cli:main"
coverage-lcov = "coverage_lcov.cli:main"
test = "pytest:main"

[tool.poetry.dependencies]
python = "^3.6.3"
Expand Down
5 changes: 5 additions & 0 deletions tests/test_coverage_lcov.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from coverage_lcov import __version__


def test_version():
assert __version__ == "0.2.0"
5 changes: 0 additions & 5 deletions tests/test_coveragepy_lcov.py

This file was deleted.

0 comments on commit d322ea8

Please sign in to comment.