Skip to content

Commit

Permalink
CI: implement codecov (#2685)
Browse files Browse the repository at this point in the history
  • Loading branch information
da-Kai authored Jun 26, 2024
1 parent e0bbfcd commit 679fe0f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 82 deletions.
34 changes: 3 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,13 @@ jobs:
- name: Validate EdgeApp.bndrun
run: git diff --exit-code io.openems.edge.application/EdgeApp.bndrun

#
# Generate Code-coverage-report
#
- name: Generate JaCoCo Code-coverage-report
run: ./gradlew jacocoTestReport

- name: Summarize JaCoCo Report
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: 'io.openems.*/generated/reports/jacoco/**/*.csv'
generate-coverage-badge: false

- name: Create JaCoCo Badge
env:
PR_NUMBER: ${{ github.event.number }}
run: |
coverage=$(echo "scale=2; ${{ steps.jacoco.outputs.coverage }} * 100" | bc | cut -c1-4);
color=red;
if (( $(echo "$coverage > 90" | bc -l) )); then
color=success;
elif (( $(echo "$coverage > 80" | bc -l) )); then
color=green;
elif (( $(echo "$coverage > 60" | bc -l) )); then
color=yellow;
fi;

mkdir -p ./jacoco
echo $PR_NUMBER > ./jacoco/jacoco_report_number
echo '![Code Coverage]'"(https://img.shields.io/badge/Code%20Coverage-${coverage}%25-${color}?style=flat)" > ./jacoco/jacoco_report_badge
- uses: actions/upload-artifact@v4
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
name: jacoco_report
path: jacoco/
token: ${{ secrets.CODECOV_TOKEN }}

build-ui:
runs-on: ubuntu-latest
Expand Down
50 changes: 0 additions & 50 deletions .github/workflows/comment.yml

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![Build Status](https://github.com/OpenEMS/openems/actions/workflows/build.yml/badge.svg)](https://github.com/OpenEMS/openems/actions/workflows/build.yml)
[![Gitpod live-demo](https://img.shields.io/badge/Gitpod-live--demo-blue?logo=gitpod)](https://gitpod.io/#https://github.com/OpenEMS/openems/tree/main)
[![Cite via Zenodo](https://zenodo.org/badge/DOI/10.5281/zenodo.4440884.svg)](https://doi.org/10.5281/zenodo.4440883)
[![codecov](https://codecov.io/gh/openems/openems/graph/badge.svg?token=xliIughqt1)](https://codecov.io/gh/openems/openems)

<h1 align="center">
<img src="./doc/modules/ROOT/assets/images/OpenEMS-Logo.png" alt="the Feneco - OpenEMS Logo" width="200"></a>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ subprojects {
jacocoTestReport {
reports {
xml.required = true
csv.required = true
csv.required = false
html.required = false
}
// Exclude com.dalsemi.onewire
Expand Down
15 changes: 15 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
coverage:
round: up
precision: 2
status:
project:
default:
target: '60%'

comment:
layout: "condensed_header, diff"
behavior: default
require_changes: false
require_base: false
require_head: true
hide_project_coverage: true

0 comments on commit 679fe0f

Please sign in to comment.