Skip to content

Commit 09a6f0b

Browse files
authored
Fix coveralls reporting (#399)
Fixes unit test coverage upload to coveralls.io Results: https://coveralls.io/github/jorisroovers/gitlint
1 parent d463132 commit 09a6f0b

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

.github/workflows/checks.yml

+21-17
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,31 @@ jobs:
8888
run: hatch run dev:gitlint --debug
8989
continue-on-error: ${{ github.event_name == 'pull_request' }} # Don't enforce gitlint in PRs
9090

91-
# Coveralls integration doesn't properly work at this point, also see below
92-
# - name: Coveralls
93-
# env:
94-
# COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
95-
# run: coveralls
96-
97-
# Patch the commit-msg hook to make it work in GH CI
98-
# Specifically, within the commit-msg hook, wrap the invocation of gitlint with `script`
99-
100-
# Coveralls GH Action currently doesn't support current non-LCOV reporting format
101-
# For now, still using Travis for unit test coverage reporting
102-
# https://github.com/coverallsapp/github-action/issues/30
103-
# - name: Coveralls
104-
# uses: coverallsapp/github-action@master
105-
# with:
106-
# github-token: ${{ secrets.GITHUB_TOKEN }}
107-
91+
- name: Code Coverage (coveralls)
92+
uses: coverallsapp/github-action@master
93+
with:
94+
path-to-lcov: ".coverage.lcov"
95+
github-token: ${{ secrets.GITHUB_TOKEN }}
96+
git-commit: ${{ github.event.pull_request.head.sha }}
97+
flag-name: gitlint-${{ matrix.os }}-${{ matrix.python-version }}
98+
parallel: true
99+
100+
upload_coveralls:
101+
needs: checks
102+
runs-on: ubuntu-latest
103+
steps:
104+
- name: Upload coverage to coveralls
105+
uses: coverallsapp/github-action@master
106+
with:
107+
path-to-lcov: ".coverage.lcov"
108+
github-token: ${{ secrets.GITHUB_TOKEN }}
109+
parallel-finished: true
110+
108111
check: # This job does nothing and is only used for the branch protection
109112
if: always() # Ref: https://github.com/marketplace/actions/alls-green#why
110113

111114
needs:
115+
- upload_coveralls
112116
- checks
113117

114118
runs-on: ubuntu-latest

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# gitlint: [jorisroovers.github.io/gitlint](http://jorisroovers.github.io/gitlint/) #
22

33
[![Tests](https://github.com/jorisroovers/gitlint/workflows/Tests%20and%20Checks/badge.svg)](https://github.com/jorisroovers/gitlint/actions?query=workflow%3A%22Tests+and+Checks%22)
4+
[![Coverage Status](https://coveralls.io/repos/github/jorisroovers/gitlint/badge.svg?branch=fix-coveralls)](https://coveralls.io/github/jorisroovers/gitlint?branch=fix-coveralls)
45
[![PyPi Package](https://img.shields.io/pypi/v/gitlint.png)](https://pypi.python.org/pypi/gitlint)
56
![Supported Python Versions](https://img.shields.io/pypi/pyversions/gitlint.svg)
67

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ dependencies = [
9393

9494
[tool.hatch.envs.test.scripts]
9595
unit-tests = [
96-
"pytest --cov=gitlint-core -rw -s {args:gitlint-core}", #
96+
"pytest --cov=gitlint-core --cov-report=term --cov-report=lcov:.coverage.lcov -rw -s {args:gitlint-core}",
9797
]
9898
u = "unit-tests"
9999
unit-tests-no-cov = "pytest -rw -s {args:gitlint-core}"

0 commit comments

Comments
 (0)