jacoco-reporter icon indicating copy to clipboard operation
jacoco-reporter copied to clipboard

Execution hangs without any visible error

Open cristiammercado opened this issue 2 years ago • 14 comments

Describe the bug I have added this action today to see JaCoCo's coverage reports. Right now I'm using it for feature/** project branches, but the execution of the entire GitHub workflow hangs, especially in the part shown in the screenshot below.

The configuration of my action is very basic, it is a Maven project, I share it below:

name: Feature CI

on:
  push:
    branches:
      - feature/**

env:
  MAVEN_OPTS: '-Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true'
  MAVEN_CLI_OPTS: '--batch-mode --errors --fail-at-end --show-version'

jobs:
  deploy:
    name: Feature branch
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v2
        with:
          distribution: 'zulu'
          java-version: '17'
          cache: 'maven'
      - name: Test and compile project
        run: |
          chmod +x ./mvnw
          ./mvnw $MAVEN_CLI_OPTS clean compile test package
      - name: Publish test coverage results
        uses: PavanMudigonda/[email protected]
        with:
          coverage_results_path: 'target/site/jacoco/jacoco.xml'
          coverage_report_title: 'Test coverage results'
          coverage_report_name: 'Test coverage results'
          github_token: ${{ secrets.GITHUB_TOKEN }}

To Reproduce Steps to reproduce the behavior:

  1. Create branch feature/any-test-here
  2. Push to GitHub
  3. Start workflow execution
  4. Workflow never stops and does not finish executing the action

Expected behavior It is expected to run normally, or if there is an error it will show it and end the workflow.

Screenshots Screenshot_6

Desktop (please complete the following information): Not apply

Smartphone (please complete the following information): Not apply

Additional context Add any other context about the problem here.

cristiammercado avatar Jul 19 '22 15:07 cristiammercado

@cristiammercado Hi, thanks for trying to use my reporter. I tested it using Gradle only and haven't received any issues so far. I will test using Maven and see whats causing this. Ideally error should not come but if it comes it should be valid and meaningful one. I will get back to you in a day!

PavanMudigondaTR avatar Jul 19 '22 15:07 PavanMudigondaTR

@cristiammercado I just forked one of the Java Maven Repo from opensource and my reporter worked right out of the box with out errors. https://github.com/PavanMudigonda/java-maven-playground/actions/runs/2698921071

I am not sure whats causing your repo to hang. Could you tell me if the JaCoCo Coverage XML was generated and if location was correct ? usually this is where issues happen.

PavanMudigonda avatar Jul 19 '22 16:07 PavanMudigonda

I am using the Maven plugin dependency jacoco-maven-plugin version 0.8.8. I already confirmed that the location of the file is correct (target/site/jacoco/jacoco.xml). I attached the file for you to download and do the test, I don't know if the structure suddenly changed or something similar.

jacoco.zip

Thanks in advance!

cristiammercado avatar Jul 19 '22 16:07 cristiammercado

I'm attaching some screenshots of the folder structure where the JaCoCo file is located.

image

image

cristiammercado avatar Jul 19 '22 16:07 cristiammercado

Ok. This info is helpful. Let me get back!

PavanMudigondaTR avatar Jul 19 '22 16:07 PavanMudigondaTR

@cristiammercado Could you let me know if you got this error ? I got this error with the jacoco.xml file you provided yesterday. image

PavanMudigonda avatar Jul 20 '22 19:07 PavanMudigonda

@cristiammercado please try again with v4.8

PavanMudigonda avatar Dec 21 '22 09:12 PavanMudigonda

I get exactly the same error as you posted above using jacoco-maven-plugin. Even with v4.8

benediktarnold avatar Jan 25 '23 13:01 benediktarnold

It seems this could be case when you have no missing lines and 100% coverage is achieved. I will try to fix it this week !

@benediktarnold @cristiammercado

PavanMudigondaTR avatar Jan 25 '23 14:01 PavanMudigondaTR

Even if I'd love this to be the reason, I can assure you that this is not the case for my codebase ;-) For some packages, we have 100% line coverage and no missed lines, but not overall.

benediktarnold avatar Jan 25 '23 14:01 benediktarnold

Even if I'd love this to be the reason, I can assure you that this is not the case for my codebase ;-) For some packages, we have 100% line coverage and no missed lines, but not overall.

would you be able to give me a screenshot of your error ? is it exact same issue from above.

PavanMudigondaTR avatar Jan 25 '23 15:01 PavanMudigondaTR

Sure thing. This is my step configuration:

      - name: JaCoCo Code Coverage Report
        id: jacoco_reporter
        uses: PavanMudigonda/[email protected]
        with:
          coverage_results_path: jacoco.xml
          coverage_report_name: Coverage
          coverage_report_title: JaCoCo
          github_token: ${{ secrets.GITHUB_TOKEN }}
          skip_check_run: false
          minimum_coverage: 50
          fail_below_threshold: true
          publish_only_summary: false

I added a debug step before the reporter, to show that the jacoco.xml is there. Bildschirm­foto 2023-01-25 um 17 03 43

benediktarnold avatar Jan 25 '23 16:01 benediktarnold

@benediktarnold if is possible for you to put shell script “cat jacoco.xml” and check if its empty or code coverage is present in that xml ?

If you see below screenshot, this is how it’s supposed to work. it should convert the jacoco xml, to markdown file, and publish report. I suspect if your xml is empty. I just need this to be confirmed. if xml is valid then I am doing something wrong.

image

https://github.com/PavanMudigonda/java-maven-playground/actions/runs/4010791833/jobs/6887686029

I use jacoco-maven-plugin 0.8.8

image

PavanMudigondaTR avatar Jan 25 '23 23:01 PavanMudigondaTR

@benediktarnold @cristiammercado It seems issue is happening when there are 61,000 plus lines in your Coverage Report !

PavanMudigondaTR avatar Jan 29 '23 01:01 PavanMudigondaTR