Skip to content

Commit 7ef3acf

Browse files
authored
Move coveralls to GitHub Actions (#1877)
This is so coverage is reported for python version and OS specific behavior, and also adds back coveralls PR commenting so it is easier to see changes in coverage before merging.
1 parent 39e0d4b commit 7ef3acf

File tree

5 files changed

+55
-33
lines changed

5 files changed

+55
-33
lines changed

.drone.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,17 @@ platform:
99
steps:
1010
- name: test
1111
image: python:3.7
12-
environment:
13-
COVERALLS_SERVICE_NAME: RDFLib-Drone
14-
COVERALLS_REPO_TOKEN:
15-
from_secret: coveralls_token
1612
commands:
17-
- export COVERALLS_SERVICE_NUMBER="$DRONE_BUILD_NUMBER"
18-
- export COVERALLS_SERVICE_JOB_ID="$DRONE_STAGE_NAME"
19-
- export COVERALLS_SERVICE_JOB_NUMBER="$DRONE_BUILD_NUMBER"
20-
- export COVERALLS_FLAG_NAME="$DRONE_STAGE_KIND"
21-
- export COVERALLS_GIT_REPO="$DRONE_REPO_NAME"
22-
- export COVERALLS_GIT_BRANCH="$DRONE_SOURCE_BRANCH"
2313
- export CI_BRANCH="$DRONE_SOURCE_BRANCH"
2414
- apt-get update && apt-get install -y openjdk-11-jdk-headless
2515
- pip install --default-timeout 60 -r requirements.txt
2616
- pip install --default-timeout 60 -r requirements.dev.txt
2717
- pip install --default-timeout 60 -r requirements.dev-extra.txt
28-
- pip install --default-timeout 60 coveralls && export HAS_COVERALLS=1
2918
- python setup.py install
3019
- black --config black.toml --check ./rdflib || true
3120
- flake8 --exit-zero rdflib
3221
- mypy --show-error-context --show-error-codes
3322
- ./with-fuseki.sh pytest -ra --cov
34-
- coveralls
3523

3624
---
3725
kind: pipeline

.github/workflows/validate.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,22 @@ jobs:
7373
- name: Run validation
7474
shell: bash
7575
run: |
76-
export TOX_EXTRA_COMMAND="${{ matrix.TOX_EXTRA_COMMAND }}"
7776
task \
77+
TOX_EXTRA_COMMAND="${{ matrix.TOX_EXTRA_COMMAND }}" \
78+
OS=${{ matrix.os }} \
7879
EXTENSIVE=${{ matrix.extensive-tests }} \
7980
TOX_PYTHON_VERSION=${{ matrix.python-version }} \
80-
WITH_GITHUB_ACTIONS=1 \
81-
install:system-deps \
82-
install:tox \
83-
tox
81+
gha:validate
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
finish:
85+
permissions:
86+
contents: read
87+
needs: validate
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Coveralls Finished
91+
uses: coverallsapp/github-action@master
92+
with:
93+
github-token: ${{ secrets.GITHUB_TOKEN }}
94+
parallel-finished: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
RDFLib
44
======
5-
[![Build Status](https://drone.rdflib.ashs.dev/api/badges/RDFLib/rdflib/status.svg?ref=refs/heads/master)](https://drone.rdflib.ashs.dev/RDFLib/rdflib/branches)
5+
[![Build Status](https://github.com/RDFLib/rdflib/actions/workflows/validate.yaml/badge.svg?branch=master)](https://github.com/RDFLib/rdflib/actions?query=branch%3Amaster)
66
[![Coveralls branch](https://img.shields.io/coveralls/RDFLib/rdflib/master.svg)](https://coveralls.io/r/RDFLib/rdflib?branch=master)
77
[![GitHub stars](https://img.shields.io/github/stars/RDFLib/rdflib.svg)](https://github.com/RDFLib/rdflib/stargazers)
88
[![PyPI](https://img.shields.io/pypi/v/rdflib.svg)](https://pypi.python.org/pypi/rdflib)

Taskfile.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ tasks:
5050
install:tox:
5151
desc: Install tox
5252
cmds:
53-
- "{{._PYTHON}} -m pip install tox {{if .WITH_GITHUB_ACTIONS}}tox-gh-actions{{end}}"
53+
- "{{._PYTHON}} -m pip install tox {{if .WITH_GITHUB_ACTIONS}}tox-gh-actions{{end}}"
5454

5555
install:pip-deps:
5656
desc: Install pip dependencies
@@ -74,17 +74,23 @@ tasks:
7474
venv:clean:
7575
desc: Remove the venv at VENV_PATH(={{.VENV_PATH}})
7676
cmds:
77-
- task: _rimraf
78-
vars: { _PYTHON: "{{.PYTHON}}", RIMRAF_TARGET: "{{.VENV_PATH}}" }
77+
- task: _rimraf
78+
vars: { _PYTHON: "{{.PYTHON}}", RIMRAF_TARGET: "{{.VENV_PATH}}" }
7979

8080
tox:
8181
desc: Run tox
8282
cmds:
8383
- echo "TOXENV=${TOXENV}"
84-
- "{{.TEST_HARNESS}}{{._PYTHON}} -m tox {{.CLI_ARGS}}"
84+
- |
85+
{{if .TOX_PYTEST_ARGS}}TOX_PYTEST_ARGS={{shellQuote .TOX_PYTEST_ARGS}}{{end}} \
86+
{{if .TOX_EXTRA_COMMAND}}TOX_EXTRA_COMMAND={{shellQuote .TOX_EXTRA_COMMAND}}{{end}} \
87+
{{if .COVERAGE_FILE}}COVERAGE_FILE={{shellQuote .COVERAGE_FILE}}{{end}} \
88+
{{.TEST_HARNESS}} \
89+
{{._PYTHON}} \
90+
-m tox \
91+
{{.CLI_ARGS}}
8592
env:
8693
TOXENV: '{{if .TOX_PYTHON_VERSION}}py{{replace "." "" .TOX_PYTHON_VERSION}}{{if .EXTENSIVE}}-extensive{{end}}{{end}}'
87-
8894
test:
8995
desc: Run tests
9096
cmds:
@@ -145,21 +151,21 @@ tasks:
145151
clean:mypy:
146152
desc: Clean mypy cache
147153
cmds:
148-
- task: _rimraf
149-
vars: { RIMRAF_TARGET: ".mypy_cache" }
150-
- task: clean:tox:mypy
154+
- task: _rimraf
155+
vars: { RIMRAF_TARGET: ".mypy_cache" }
156+
- task: clean:tox:mypy
151157

152158
clean:tox:
153159
desc: Clean tox environments
154160
cmds:
155-
- task: _rimraf
156-
vars: { RIMRAF_TARGET: ".tox" }
161+
- task: _rimraf
162+
vars: { RIMRAF_TARGET: ".tox" }
157163

158164
clean:tox:mypy:
159165
desc: Clean mypy cache inside tox environments
160166
cmds:
161-
- task: _rimraf
162-
vars: { RIMRAF_TARGET: ".tox/*/.mypy_cache/" }
167+
- task: _rimraf
168+
vars: { RIMRAF_TARGET: ".tox/*/.mypy_cache/" }
163169

164170
clean:
165171
desc: Clean everything
@@ -189,6 +195,23 @@ tasks:
189195
cmds:
190196
- pre-commit run --all-files {{.CLI_ARGS}}
191197

198+
gha:validate:
199+
desc: GitHub Actions Validation Workflow
200+
env:
201+
COVERALLS_PARALLEL: true
202+
COVERALLS_FLAG_NAME: "{{.OS}}-{{.TOX_PYTHON_VERSION}}"
203+
COVERALLS_SERVICE_NAME: '{{.COVERALLS_SERVICE_NAME | default (env "COVERALLS_SERVICE_NAME") | default "github"}}'
204+
cmds:
205+
- task: install:system-deps
206+
- task: install:tox
207+
vars:
208+
WITH_GITHUB_ACTIONS: 1
209+
- cmd: "{{._PYTHON}} -m pip install coveralls"
210+
- task: tox
211+
vars:
212+
COVERAGE_FILE: ".coverage"
213+
- cmd: coveralls
214+
192215
_rimraf:
193216
# This task is a utility task for recursively removing directories, it is
194217
# similar to rm -rf but not identical and it should work wherever there is

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ envlist =
55
[testenv]
66
setenv =
77
extensive: BERKELEYDB_DIR = /usr
8-
COVERAGE_FILE={toxinidir}/.coverage.{envname}
9-
MYPY_CACHE_DIR={envdir}/.mypy_cache
8+
COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage.{envname}}
9+
MYPY_CACHE_DIR = {envdir}/.mypy_cache
1010
extras =
1111
tests
1212
dev
@@ -15,7 +15,7 @@ extras =
1515
commands =
1616
{env:TOX_EXTRA_COMMAND:}
1717
{env:TOX_MYPY_COMMAND:{envpython} -m mypy --show-error-context --show-error-codes}
18-
{posargs:{envpython} -m pytest --cov --cov-report=}
18+
{posargs:{envpython} -m pytest {env:TOX_PYTEST_ARGS:--cov --cov-report=}}
1919

2020
[testenv:covreport]
2121
deps = coverage

0 commit comments

Comments
 (0)