Skip to content

Commit

Permalink
Merge pull request #134 from c-dilks/coverage
Browse files Browse the repository at this point in the history
feat: use `jacoco` for coverage testing
  • Loading branch information
baltzell authored Dec 7, 2023
2 parents 5149081 + 9ed434d commit 41d31ae
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 26 deletions.
12 changes: 0 additions & 12 deletions .codecov.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ concurrency:

jobs:

# build
#############################################################################

build:
strategy:
fail-fast: true
Expand All @@ -44,6 +47,18 @@ jobs:
name: build_${{ matrix.runner }}
retention-days: 1
path: coatjava.tar.gz
- name: collect jacoco report
if: ${{ matrix.runner == 'ubuntu-latest' }}
run: validation/jacoco-aggregate.sh
- name: publish jacoco report
if: ${{ matrix.runner == 'ubuntu-latest' }}
uses: actions/upload-pages-artifact@v2
with:
path: publish/
retention-days: 1

# tests
#############################################################################

test_coatjava:
needs: [ build ]
Expand Down Expand Up @@ -119,3 +134,21 @@ jobs:
steps:
- name: pass
run: exit 0

# deploy web pages
#############################################################################

deploy_web_pages:
if: ${{ github.event_name == 'push' }}
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: deployment
id: deployment
uses: actions/deploy-pages@v2
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/coatjava
/myLocalMvnRepo
target
/publish

*.class
*lundfiles*.dat
Expand Down Expand Up @@ -36,4 +37,4 @@ hs_err_pid*
*.evio

bin/evio2hipotest
export.sh
export.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# COATJAVA
[![Build Status](https://github.com/jeffersonlab/coatjava/workflows/Coatjava-CI/badge.svg)](https://github.com/jeffersonlab/coatjava/actions)
[![Validation Status](https://github.com/JeffersonLab/coatjava/actions/workflows/validation.yml/badge.svg)](https://github.com/JeffersonLab/coatjava/actions/workflows/validation.yml)
[![codecov](https://codecov.io/gh/JeffersonLab/coatjava/branch/development/graph/badge.svg?precision=2)](https://codecov.io/gh/JeffersonLab/coatjava/branch/development)
[![Coverage](https://badgen.net/static/JaCoCo/coverage/purple)](https://jeffersonlab.github.io/coatjava)

The original repository for COATJAVA was named "clas12-offline-software" and is [now archived and read-only](https://github.com/JeffersonLab/clas12-offline-software). On May 17, 2023, this new repository was created by running BFG Repo Cleaner to get rid of old, large data files and things that should never have been in the repository, giving 10x reduction in repository size, clone time, etc, and renamed `coatjava`. The most critical, GitHub-specific aspects have been transferred to this new repository:

Expand Down
39 changes: 27 additions & 12 deletions parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
<version>4.0.5</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.jacoco/jacoco-maven-plugin -->
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
</dependency>

</dependencies>

<build>
Expand All @@ -59,18 +66,6 @@
</extensions>

<plugins>
<plugin> <!-- for codecov -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<check />
</configuration>
</plugin>

<plugin>
<groupId>com.github.spotbugs</groupId>
Expand Down Expand Up @@ -134,6 +129,26 @@
</configuration>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>

</build>
Expand Down
43 changes: 43 additions & 0 deletions validation/jacoco-aggregate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# simple script to aggregate jacoco results, until we figure out a better way

mkdir -p publish
rm -r publish
mkdir -p publish
for d in $(find -type d -name 'jacoco'); do
target=publish/$(echo $d | sed 's;^\./;;')
mkdir -p $target
cp -r $d/* $target/
done

pushd publish

cat << EOF > index.html
<html>
<head>
<title>JaCoCo Coverage Summary</title>
</head>
<body>
<h1>JaCoCo Coverage Summary</h1>
<ul>
EOF

indexPages=$(find . -name "index.html" | grep 'jacoco/index')
[ -z "$indexPages" ] && echo "ERROR: no jacoco HTML pages found" >&2 && exit 1
for indexPage in $indexPages; do
link=$(echo $indexPage | sed 's;^./;;')
name=$(echo $link | sed 's;/target/site/.*;;')
cat << EOF >> index.html
<li><a href="$link">$name</a></li>
EOF
done

cat << EOF >> index.html
</body>
</html>
EOF

echo "==============="
cat index.html
echo "==============="
popd

0 comments on commit 41d31ae

Please sign in to comment.