📖
Eclipse PASS Documentation
PASS Documentation - DEV
PASS Documentation - DEV
  • Welcome to the Public Access Submission System (PASS) Documentation
  • PASS Welcome Guide
    • Research Submission Overview
    • PASS at JHU
    • PASS Demonstrations at Conferences
    • Technology Stack
    • PASS Architecture
    • Latest Release
    • Setup and Run PASS Locally
    • Collaboration with Other Institutions
    • Contributing to PASS
  • Community
    • Developer Guidelines
    • PASS Roadmap
    • Release Notes
  • Developer Documentation
    • Use Cases
    • PASS Core
      • Authentication & Authorization
      • API
        • DOI API
        • File API
        • Metadata Schema API
        • Policy API
        • User API
      • Model
        • Deposit
        • File
        • Funder
        • Grant
        • Journal
        • Policy
        • Publication
        • Repository
        • RepositoryCopy
        • Submission
        • SubmissionEvent
        • User
    • PASS UI
    • Data Loaders
      • Grant Loader
      • Journal Loader
      • NIHMS Loader
    • Deposit Services
      • Knowledge Needed / Skills Inventory
      • Technologies Utilized
      • Model
      • Statuses
      • Business Logic
      • Assemblers
      • Configuration
      • Next Steps / Institution Configuration
    • Notification Services
      • Knowledge Needed / Skills Inventory
      • Technologies Utilized
      • Model
      • Business Logic
      • Template
      • Dispatch
      • Configuration
      • Next Steps / Institution Configuration
    • PASS Acceptance Testing
    • PASS Docker
      • Testing InvenioRDM
    • Release
      • Automated Release
  • PASS Infrastructure
    • CI/CD
    • Code Quality Analysis
      • Code Coverage
    • Deployment
      • GitHub CI/CD
    • Operations/Production
      • Knowledge Needed / Skills Inventory
      • Technologies Utilized
      • PASS Design & AWS Architecture
      • AWS Cost Estimates
      • PASS Versioning
      • How to Deploy
      • Monitoring
      • Data Loaders
      • Data & Backups
      • Eclipse Operations
      • Next Steps / Institution Configuration
Powered by GitBook
On this page
  • Summary
  • Knowledge Needed / Skills Inventory
  • Technologies Utilized
  • Technical Deep Dive
  • Setting up the POM
  • GitHub Actions
  • Other Configurations to Note
  • Related Information
  1. PASS Infrastructure
  2. Code Quality Analysis

Code Coverage

PreviousCode Quality AnalysisNextDeployment

Last updated 28 days ago

This section details how PASS utilizes JaCoCo for measuring Java code coverage in and . Unit and Integration tests exist in PASS UI as well, but at the moment do not have any code coverage analysis being performed. We anticipate adding code coverage reports to PASS UI in the future.

Summary

PASS employs to measure the extent to which the project's Java code is exercised by unit and integration tests.

This process typically runs as part of the standard build cycle managed by our build tool (Maven) within the CI/CD pipeline (GitHub Actions). JaCoCo generates reports, which are then consumed by SonarQube Cloud to display coverage metrics on the project dashboard and pull request analyses. Tracking code coverage helps ensure that critical parts of the application are adequately tested, increasing confidence in code quality and reducing the risk of regressions.

Knowledge Needed / Skills Inventory

  • Understanding Code Coverage Concepts

  • Java 17+

  • Maven build tool

Technologies Utilized

  • Build Tool

Technical Deep Dive

The PASS project integrates JaCoCo within the CI/CD pipeline. Achieving this involves two main steps: configuring JaCoCo reports in Maven and integrating the analysis within GitHub Actions.

Setting up the POM

Both PASS Core and PASS Support are multi-module projects which require a specific setup

  • Agent Preparation: The JaCoCo Java agent is configured to run before the test execution phase. This is done using theprepare-agent goal in the parent pom.xml.

  • Aggregate Report Module: A module is designated as the aggregate report module, which collects all the reports from the individual modules in the project. This module's pom.xml runs the report-aggregate goal during the verify stage. This module is named:

    • for PASS Core: jacoco-aggregate-report-pass-core

    • for PASS Support: jacoco-aggregate-report-pass-support

  • Individual modules must declare the prepare-agent goal in their pom.xml

  • SonarQube

    • The SonarQube Scanner is added to the parent pom.xml

    • The following properties are added to the parent pom.xml:

      • sonar.projectName

      • sonar.projectKey

      • sonar.coverage.jacoco.xmlReportPaths

  • Report Generation: The report is saved in jacoco-aggregate-report-[project-name]/target/site/jacoco.xml

GitHub Actions

The integration with SonarQube also occurs during the CI/CD phase of the build process. To accomplish this integration the following steps were implemented in GitHub Actions:

  • A SONAR_TOKEN secret, obtained from SonarQube Cloud, must be configured in the eclipse-pass GitHub organization secrets.

  • In the snapshot.yml and ci.yml of eclipse-pass-parent the SonarQube Scanner is invoked during the mvn deploy and verify.

  • The fetch-depth must have a value of 0, so that the entire Git history is fetched. If this isn't set then incomplete analysis will be performed.

Other Configurations to Note

  • Using GitHub Actions requires the Automatic Analysis to be turned off on the project in SonarQube so that GitHub Actions can trigger analysis.

  • A SonarQube project was created for eclipse-pass-parent. With 'Automatic Analysis' disabled in SonarCloud, all scans rely on GitHub Actions triggers. Since the primary workflows may focus only on pull request analysis, linkingeclipse-pass-parent is a necessary part of the configuration that enables analysis results for the main branch (of Core/Support) to be processed and displayed in SonarQube. Additionally, this allows the eclipse-pass-parent project itself to be analyzed for code quality and dependency vulnerabilities.

Related Information

PASS Core
PASS Support
JaCoCo (Java Code Coverage Library)
JaCoCo
Maven
GitHub Actions
SonarQube Cloud
SonarScanner for Maven
SonarScanner for Maven GitHub
JaCoCo Official Website
JaCoCo Maven Plugin Documentation
PASS SonarQube Documentation
SonarQube Cloud Code Coverage Integration