codecov-action icon indicating copy to clipboard operation
codecov-action copied to clipboard

Not picking up code coverage report with NET 6 project

Open CalvinWilkinson opened this issue 3 years ago • 1 comments
trafficstars

Description:

I am currently having issues sending coverage reports due to the action not picking up the report even though it exists. I am the owner and maintainer of the OS projects Velaptor and CASL and I use your service for publishing code coverage. Which the service is awesome btw!! 😉

Here is a breakdown.

Originally I was using codecov-actionv1.5.2 and nothing was being uploaded. My instinct kicked in so I checked out the action in the market place and noticed that the version was greatly different than what I was using, which at the time of creating this issue is v2.1.0. I noticed that the uploader is being deprecated and that was probably the reason why my code coverage results were not being published.

I updated the action to v2.1.0 and reran the workflow to see if I could get it to work and it continues to not work. So of course went to check out the action logs to see what I could find.

I got this: image

So I created a self hosted runner so I could debug and verify that the coverage.cobertura.xml file is being generated and it indeed is being generated. I am using the default test results locations when running dotnet test

Report Location: K:\actions-runner_work\Velaptor\Velaptor\Testing\VelaptorTests\TestResults\e4e61be5-7029-44e8-820a-7eb90a68fc23\coverage.cobertura.xml

Report Location Used By codecov action: K:\actions-runner_work\Velaptor\Velaptor/TestResults/**/coverage.cobertura.xml

If you need me to try some things out or need additional information, don't hesitate to ask.

Steps To Reproduce:

The only think I can think of for you to try and reproduce the issue is to fork the repository and setup either a GitHub or Self Hosted runner with your own workflow and see what happens. 🤷🏼

Other Info:

NET Version: 6.0 Lang Version: 10.0

Workflow Used For Testing:

name: 🚀QA Preview Release


env:
  PROJECT_NAME: Velaptor
  NET_SDK_VERSION: 6.0.101 # Changing this means changing ARTIFACT_FOLDER_NAME
  ARTIFACT_FOLDER_NAME: '6.0.101' # Changing this means changing NET_SDK_VERSION


on:
  workflow_dispatch:

jobs:
  Build_And_Test_Library:
    name: Build & Test (Library)
    runs-on: self-hosted #windows-latest
    steps:
      - uses: actions/checkout@v2

      - name: Setup .NET SDK
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: ${{ env.NET_SDK_VERSION }}

      - name: Get Version From Project File
        id: proj-file-version
        uses: KinsonDigital/[email protected]
        with:
          repo-owner-and-name: '${{ github.repository }}'
          branch: '${{ github.ref }}'
          relative-file-path: '${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj'
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Display Workflow Info
        run: |
          echo "Build Config: Debug"
          echo "Current Branch: ${{ github.ref }}"
          echo "Project File Version: ${{ steps.proj-file-version.outputs.version }}"

      - name: Restore Dependencies
        run: dotnet restore "${{ github.workspace }}/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj"

      - name: Build
        run: dotnet build "${{ github.workspace }}/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj" `
          -c Debug `
          --no-restore

      - name: Execute Unit Tests
        run: dotnet test "${{ github.workspace }}/Testing/${{ env.PROJECT_NAME }}Tests/${{ env.PROJECT_NAME }}Tests.csproj" `
          -c Debug `
          --collect:"XPlat Code Coverage"

      - name: Publish Code Coverage Results
        uses: codecov/codecov-action@v2
        with:
          file: ${{ github.workspace }}/Testing/${{ env.PROJECT_NAME }}Tests/TestResults/**/coverage.cobertura.xml

CalvinWilkinson avatar Feb 17 '22 12:02 CalvinWilkinson

Here is an issue that I have created on my side of things for reference.

  • KinsonDigital/Velaptor#152

CalvinWilkinson avatar Feb 17 '22 14:02 CalvinWilkinson

@CalvinWilkinson it's been awhile, but I made some changes to how we handle ** on our backend. If this is still an issue, please open a topic on our community boards and I'll try to help out as best I can

thomasrockhu-codecov avatar Mar 23 '23 02:03 thomasrockhu-codecov