0

I have added the coverage.yml file in the .github/workflows folder of my project. Here is the file:

name: Measure coverage

on:
  push:
    branches: [ develop ]
  pull_request:

jobs:
  build:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 11
        uses: actions/setup-java@v1
        with:
          java-version: '11'

      - name: Grant execute permission for gradlew
        run: chmod +x gradlew

      - name: Run Coverage
        run: ./gradlew test

      - name: Upload Report
        uses: 'actions/upload-artifact@v2'
        with:
          name: report.xml
          path: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml

      - name: Jacoco Report to PR
        id: jacoco
        uses: madrapps/jacoco-report@v1.1
        with:
          path: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
          min-coverage-overall: 90
          min-coverage-changed-files: 60
          debug-mode: false

      - name: Get the Coverage info
        run: |
          echo "Total coverage ${{ steps.jacoco.outputs.coverage-overall }}"
          echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}"

On creating a pull request on GitHub after adding this file I am getting this error on GitHub.

Run ./gradlew test
Downloading https://services.gradle.org/distributions/gradle-6.7.1-all.zip
.............10%..............20%..............30%..............40%..............50%..............60%..............70%..............80%..............90%..............100%

Welcome to Gradle 6.7.1!

Here are the highlights of this release:
 - File system watching is ready for production use
 - Declare the version of Java your build requires
 - Java 15 support

For more details see https://docs.gradle.org/6.7.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
> Task :bootBuildInfo
> Task :checkApolloVersions
> Task :generateMainServiceApolloSources
> Task :checkMainServiceApolloDuplicates
> Task :compileJava FAILED

FAILURE: Build failed with an exception.


* What went wrong:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Execution failed for task ':compileJava'.
Use '--warning-mode all' to show the individual deprecation warnings.

Can someone help me to solve this issue, I am not able to figure out why it is happening. Is it happening because I have multiple JDKs installed in my mac?

  • Does this answer your question? [Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0](https://stackoverflow.com/questions/51610420/deprecated-gradle-features-were-used-in-this-build-making-it-incompatible-with) – Azeem Mar 20 '23 at 06:22
  • Looks like you need to run with `--warning-mode all` flag to figure out the deprecated features. Also, your workflow is downloading Gradle 6.7.1 but there's also [Gradle 8.0.2](https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#project-management) preinstalled on the `macos-latest` runner. – Azeem Mar 20 '23 at 06:27
  • How can I run this on Github Actions? – Sheetal Jain Mar 20 '23 at 12:09
  • You need to figure out the deprecated features and remove those. Run `./gradlew test --warning-mode all` to identify those on GitHub Actions. – Azeem Mar 20 '23 at 12:15
  • Can I run this command on my IDE? or do I have to run it on GitHub? – Sheetal Jain Mar 20 '23 at 12:43
  • Run this as part of your GHA workflow. – Azeem Mar 20 '23 at 12:52
  • Can you please help me to solve this question also https://stackoverflow.com/questions/75790563/how-to-integrate-github-pull-request-coverage-status-in-jenkinsfile. I am integrating jacoco code coverage results now in JenkinsFile only. – Sheetal Jain Mar 20 '23 at 13:10

0 Answers0