codecov / codecov-circleci-orb

MIT License
20 stars 42 forks source link

Multiple coverage files - Wildcard only selects one file #163

Closed JonWillis-Tote closed 1 year ago

JonWillis-Tote commented 1 year ago

Hi,

I believe the uploader, including the Orb, supports both a CSV upload, as well as wildcards using the *.

I read the docs, and previous issues - #6 and #138 But I still cannot seem to get multiple uploads working.

I run the following command

dotnet test --filter "Unit" --test-adapter-path:. --logger:"junit;LogFileName=xunit/results.xml" --results-directory:test-results --collect:"XPlat Code Coverage"

This generates the following 2 files, one for each test assembly in the solution.

  /home/circleci/project/test-results/e59140de-d31f-48a3-801a-2d0224f9e84c/coverage.cobertura.xml
  /home/circleci/project/test-results/c0301c42-49e5-41cf-862c-45ea7a8b3a15/coverage.cobertura.xml

I've tried running codecov/uploadwith the file parameter set to

    steps:
      - codecov/upload:
          file: './test-results/*/coverage.cobertura.xml'

And in all cases, it only uploads one file.

Codecov report uploader 0.6.1
[2023-06-25T14:05:13.406Z] ['info'] => Project root located at: /home/circleci/project
[2023-06-25T14:05:13.407Z] ['info'] ->  Token found by arguments
[2023-06-25T14:05:13.415Z] ['info'] Searching for coverage files...
[2023-06-25T14:05:13.473Z] ['info'] => Found 1 possible coverage files:
  ./test-results/c0301c42-49e5-41cf-862c-45ea7a8b3a15/coverage.cobertura.xml
[2023-06-25T14:05:13.473Z] ['info'] Processing ./test-results/c0301c42-49e5-41cf-862c-45ea7a8b3a15/coverage.cobertura.xml...
[2023-06-25T14:05:13.476Z] ['info'] Detected CircleCI as the CI provider.

I even tried just using *, and it uploaded 1 file from the current directory within the container.

Have I misunderstood the wildcarding features of the uploader/orb ?

Edit -

JonWillis-Tote commented 1 year ago

As an update

 steps:
      - codecov/upload:
          file: '*'

The above, uploaded, just one file.

 steps:
      - codecov/upload:
          file: '*,./test-results/*/coverage.cobertura.xml'

This uploaded every file in the current directory.

JonWillis-Tote commented 1 year ago

This looks to be user error after all. Just needed to remove the dot, from the front of the path.

 steps:
      - codecov/upload:
          file: '/test-results/*/coverage.cobertura.xml'

This command will upload all files, rather than just the first one.

thomasrockhu-codecov commented 1 year ago

@JonWillis-Tote sorry for getting back to you so late here. Looks like the issue is resolved. If not, please feel free to reopen.