diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..5a785c2 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -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/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d9a4e2..f5862cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index b78dc98..1b6362f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ __pycache__ .DS_Store .venv +venv .python-version -/dist/* +dist .coverage lcov.info diff --git a/README.md b/README.md index fcda535..faaae8b 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/coverage_lcov/__init__.py b/coverage_lcov/__init__.py new file mode 100644 index 0000000..ddee119 --- /dev/null +++ b/coverage_lcov/__init__.py @@ -0,0 +1,5 @@ +import os + +import toml + +__version__ = toml.load(os.path.join(os.path.dirname(__file__), "..", "pyproject.toml"))["tool"]["poetry"]["version"] diff --git a/coveragepy_lcov/__main__.py b/coverage_lcov/__main__.py similarity index 100% rename from coveragepy_lcov/__main__.py rename to coverage_lcov/__main__.py diff --git a/coveragepy_lcov/cli.py b/coverage_lcov/cli.py similarity index 100% rename from coveragepy_lcov/cli.py rename to coverage_lcov/cli.py diff --git a/coveragepy_lcov/converter.py b/coverage_lcov/converter.py similarity index 98% rename from coveragepy_lcov/converter.py rename to coverage_lcov/converter.py index 377f50d..bb68e38 100644 --- a/coveragepy_lcov/converter.py +++ b/coverage_lcov/converter.py @@ -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: diff --git a/coveragepy_lcov/__init__.py b/coveragepy_lcov/__init__.py deleted file mode 100644 index 485f44a..0000000 --- a/coveragepy_lcov/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.1.1" diff --git a/pyproject.toml b/pyproject.toml index c3c1ca3..e021c1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] -repository = "https://github.com/chaychoong/coveragepy-lcov" +authors = ["Adam Weeden ", "Chay Choong "] +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" diff --git a/tests/test_coverage_lcov.py b/tests/test_coverage_lcov.py new file mode 100644 index 0000000..b827ea7 --- /dev/null +++ b/tests/test_coverage_lcov.py @@ -0,0 +1,5 @@ +from coverage_lcov import __version__ + + +def test_version(): + assert __version__ == "0.2.0" diff --git a/tests/test_coveragepy_lcov.py b/tests/test_coveragepy_lcov.py deleted file mode 100644 index b41bd85..0000000 --- a/tests/test_coveragepy_lcov.py +++ /dev/null @@ -1,5 +0,0 @@ -from coveragepy_lcov import __version__ - - -def test_version(): - assert __version__ == "0.1.1"