Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/badge/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ runs:
uses: actions/upload-artifact@v4
with:
name: badges_${{ inputs.run_id }}_${{ steps.vars.outputs.safe_file }}
path: badges/**/*.svg
overwrite: true
path: badges/**/${{inputs.file}}
overwrite: true
46 changes: 34 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
schema:
- env: latest
image: "ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:latest-dev"
- env: release
image: "ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:25.07.01"
- env: next-release
image: "ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:26.02.17-RC01"
# - env: release
# image: "ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:25.07.01"
# - env: next-release
# image: "ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:26.02.17-RC01"
# - env: previous
# image: "ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:25.07.01"
name: build and test (jdk ${{matrix.jdk}}, schema ${{matrix.schema.env}})
Expand Down Expand Up @@ -57,13 +57,35 @@ jobs:
status: ${{ job.status == 'success' && 'Pass' || 'Fail' }}
file: ${{ matrix.jdk }}/${{ matrix.schema.env }}.svg
run_id: ${{ github.run_id }}
# - name: Publish Test Report
# uses: mikepenz/action-junit-report@v5
# if: success() || failure() # always run even if the previous step fails
# with:
# annotate_only: true
# include_passed: true
# report_paths: '**/TEST-*.xml'
- name: Install xmllint
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
- name: coverage
id: coverage
run: |
# combine the test and integration test reports.
./gradlew codeCoverageReport --info --init-script init.gradle -PCDA.oracle.database.image=${{matrix.schema.image}}
# calculate coverage percentage
MISSED_LINES=`xmllint --xpath "string(/report/counter[@type='COMPLEXITY']/@missed)" cwms-data-api/build/reports/jacoco-composite.xml`
COVERED_LINES=`xmllint --xpath "string(/report/counter[@type='COMPLEXITY']/@covered)" cwms-data-api/build/reports/jacoco-composite.xml`
PERCENT=`echo "scale=1; (${COVERED_LINES} / (${COVERED_LINES} + ${MISSED_LINES})) * 100" | bc`
echo "Coverage from missed $MISSED_LINES and covered $COVERED_LINES is $PRECENT"
echo "coverage=$PERCENT %" >> $GITHUB_OUTPUT
- name: Create matrix coverage badge
if: success() || failure() # always run even if the previous step fails
uses: ./.github/actions/badge
with:
label: 'Coverage'
status: ${{ steps.coverage.outputs.coverage }}
file: ${{ matrix.jdk }}/${{ matrix.schema.env }}-coverage.svg
run_id: ${{ github.run_id }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v6.4.1
if: always()
with:
annotate_only: true
include_passed: true
report_paths: '**/TEST-*.xml'
detailed_summary: true
open-api-static-analysis:
name: OpenApi Static Analysis Tests
runs-on: ubuntu-latest
Expand All @@ -82,7 +104,7 @@ jobs:
id: thebuild
run: ./gradlew clean :cwms-data-api:test --tests "cwms.cda.api.OpenApiDocTest" --info --init-script init.gradle
- name: Publish Test Report
uses: mikepenz/action-junit-report@v5
uses: mikepenz/action-junit-report@v6.4.1
if: always()
with:
annotate_only: true
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,29 @@
<tr>
<th>CWMS Database Schema target</th>
<th>Status</th>
<th>Coverage</th>
</tr>
</thead>
<tbody>
<tr>
<td>Latest</td>
<td><img alt="Latest Status, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/latest.svg">
<td><img alt="Latest Status, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/latest.svg"></td>
<td><img alt="Latest Coverage, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/latest-coverage.svg"></td>
</tr>
<tr>
<td>Current Release</td>
<td><img alt="Current Status, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/release.svg">
<td><img alt="Current Status, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/release.svg"></td>
<td><img alt="Current Coverage, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/release-coverage.svg"></td>
</tr>
<tr>
<td>Next Release</td>
<td><img alt="Next Status, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/next-release.svg">
<td><img alt="Next Status, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/next-release.svg"></td>
<td><img alt="Next Coverage, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/next-release-coverage.svg"></td>
</tr>
<tr>
<td>Previous Release - NOTE: Not applicable yet</td>
<td><img alt="Previous Status, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/previous.svg">
<td><img alt="Previous Status, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/previous.svg"></td>
<td><img alt="Previous Status, Svg" src="https://raw.githubusercontent.com/USACE/cwms-data-api/refs/heads/badges/build/11/previous-coverage.svg"></td>
</tr>
</tbody>
</table>
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
}
}

Expand All @@ -9,6 +10,7 @@ plugins {
id 'eclipse'
id 'idea'
id "com.palantir.git-version" version "3.1.0"
// id 'jacoco'
}

def static versionLabel(gitInfo) {
Expand All @@ -24,3 +26,5 @@ allprojects {
group = 'mil.army.usace.hec.cwms'
version = project.findProperty("versionOverride") ?: versionLabel(versionDetails())
}


2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/cda.deps-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repositories {
maven {
url = uri('https://repo.maven.apache.org/maven2')
}

gradlePluginPortal()
}


Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/cda.java-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ checkstyle {
}

jacoco {
toolVersion = "0.8.9"
toolVersion = "0.8.14"
}

jacocoTestReport {
Expand Down
26 changes: 26 additions & 0 deletions cwms-data-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,29 @@ tasks.register('shadeCodegenLatest', com.github.jengelman.gradle.plugins.shadow.
}
tasks.compileJava.dependsOn(tasks.shadeCodegenLegacy)
tasks.compileJava.dependsOn(tasks.shadeCodegenLatest)



tasks.register("codeCoverageReport", JacocoReport) { jr ->
tasks.matching({t -> t.extensions.findByType(JacocoTaskExtension)}).each { testTask ->
if(testTask.extensions.getByType(JacocoTaskExtension).isEnabled()) {
System.out.print(testTask.getName())
//jr.sourceSets subproject.sourceSets.main
//jr.sourceDirectories.setFrom(subproject.sourceSets.main.allSource.srcDirs)
//jr.classDirectories.setFrom(subproject.sourceSets.main.output)
jr.executionData(testTask)
}
}


// enable the different report types (html, xml, csv)
reports {
xml.required = true
html.required = true
xml.outputLocation = layout.buildDirectory.file('reports/jacoco-composite.xml')
html.outputLocation = layout.buildDirectory.dir('jacocoHtmlComposite')
}

jr.sourceDirectories.setFrom(fileTree(dir: "${rootDir}", include: "**/src/**/main/java/**", exclude: "build/**/codeCoverageReport.xml"))
jr.classDirectories.setFrom(fileTree(dir: "${rootDir}", include: "**/build/**/classes/**"))
}
2 changes: 1 addition & 1 deletion cwms-data-api/src/main/resources/psw4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ hash.argon2.memory=19456
hash.argon2.iterations=2
hash.argon2.parallelism=1
hash.argon2.length=32
global.salt.length=16
global.salt.length=16
Loading