Skip to content

Commit

Permalink
ci: add coverage badge and report
Browse files Browse the repository at this point in the history
  • Loading branch information
afuetterer committed Jan 16, 2024
1 parent 708fe43 commit b9f9e9c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:

tests:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
Expand All @@ -84,9 +86,6 @@ jobs:
python -m pip install --upgrade hatch
- name: Run test suite with coverage
run: hatch run cov-ci
- name: Generate badges
if: always()
run: hatch run badges
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
Expand All @@ -101,6 +100,15 @@ jobs:
name: coverage-results
retention-days: 1
path: pytest-cobertura.xml
- run: rm ./reports/coverage/.gitignore
- name: Generate coverage badge
if: github.ref == 'refs/heads/master'
run: hatch run cov-badge
- name: Deploy reports to GitHub Pages
if: github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@65b5dfd4f5bcd3a7403bbc2959c144256167464e # v4.5.0
with:
folder: ./reports

event_file:
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ repos:
rev: v4.5.0
hooks:
- id: end-of-file-fixer
exclude_types: [svg]
- id: mixed-line-ending
types: [python]
- id: trailing-whitespace
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ Developers: [Robert Huber](mailto:[email protected]), [Anusuriya Devaraju](mailto:
Thanks to [Heinz-Alexander Fuetterer](https://github.com/afuetterer) for his contributions and his help in cleaning up the code.

[![CI](https://github.com/pangaea-data-publisher/fuji/actions/workflows/ci.yml/badge.svg)](https://github.com/pangaea-data-publisher/fuji/actions/workflows/ci.yml)
[![Coverage](https://pangaea-data-publisher.github.io/fuji/coverage/coveragebadge.svg)](https://pangaea-data-publisher.github.io/fuji/coverage/)

[![Publish Docker image](https://github.com/pangaea-data-publisher/fuji/actions/workflows/publish-docker.yml/badge.svg)](https://github.com/pangaea-data-publisher/fuji/actions/workflows/publish-docker.yml)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4063720.svg)](https://doi.org/10.5281/zenodo.4063720)


## Overview

F-UJI is a web service to programmatically assess FAIRness of research data objects based on [metrics](https://doi.org/10.5281/zenodo.3775793) developed by the [FAIRsFAIR](https://www.fairsfair.eu/) project.
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ report = [
"jupyter~=1.0"
]
testing = [
"genbadge[tests]~=1.1",
"genbadge[coverage]~=1.1",
"pytest~=7.4",
"pytest-cov~=4.1",
"pytest-randomly~=3.15",
Expand Down Expand Up @@ -122,10 +122,9 @@ features = [
]

[tool.hatch.envs.default.scripts]
badges = "genbadge tests --input-file=pytest-junit.xml"
cov = "pytest --cov {args}"
cov-ci = "pytest --cov --junitxml=pytest-junit.xml --cov-report=xml:pytest-cobertura.xml {args}"
cov-html = "pytest --cov --cov-report=html {args}"
cov-badge = "genbadge coverage --input-file=pytest-cobertura.xml --output-file=./reports/coverage/coveragebadge.svg"
cov-ci = "pytest --cov --junitxml=pytest-junit.xml --cov-report=xml:pytest-cobertura.xml --cov-report=html:./reports/coverage/ {args}"
lint = "pre-commit run --all-files --color=always {args}"
test = "pytest {args}"

Expand Down

0 comments on commit b9f9e9c

Please sign in to comment.