Can't upload coverage report generated with game-ci/unity-test-runner

I’m using game-ci GitHub action to test and cover a Unity project and codecov-action@v3 to upload the results. It’s been working fine for about a year, but then, probably due to some ci action update, the coverage reports are no longer detected by codecov.

Here is the failing job: debug cover · Elringus/SpriteDicing@28a1600 · GitHub

I’ve found where unity-test-runner appears to be writing coverage report:

2022-12-25T19:35:49.5043090Z [Code Coverage] Code Coverage Results were saved in /github/workspace/CodeCoverage/workspace-opencov/EditMode/TestCoverageResults_0000.xml

— and tried specifying the path with codecov:

- name: Upload coverage report
  uses: codecov/codecov-action@v3
  with:
    root_dir: /github/workspace/CodeCoverage/workspace-opencov/EditMode
    files: '*.xml'
    fail_ci_if_error: true
    verbose: true

But it still fails to find the files with the following log:

/home/runner/work/_actions/codecov/codecov-action/v3/dist/codecov -n  -Q github-action-3.1.1 -Z -f *.xml -R /github/workspace/CodeCoverage/workspace-opencov/EditMode -v
[2022-12-25T19:35:52.108Z] ['verbose'] Start of uploader: 1671996952108...
[2022-12-25T19:35:52.110Z] ['info'] 
     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/

  Codecov report uploader 0.3.2
[2022-12-25T19:35:52.110Z] ['info'] => Project root located at: /github/workspace/CodeCoverage/workspace-opencov/EditMode
[2022-12-25T19:35:52.111Z] ['info'] -> No token specified or token is empty
[2022-12-25T19:35:52.111Z] ['verbose'] Start of network processing...
[2022-12-25T19:35:52.112Z] ['verbose'] Searching for files in /github/workspace/CodeCoverage/workspace-opencov/EditMode
[2022-12-25T19:35:52.124Z] ['verbose'] coveragepy is not installed
[2022-12-25T19:35:52.125Z] ['info'] Searching for coverage files...
[2022-12-25T19:35:52.173Z] ['verbose'] Preparing to clean the following coverage paths: *.xml
[2022-12-25T19:35:52.174Z] ['error'] None of the following appear to exist as files: *.xml
[2022-12-25T19:35:52.175Z] ['error'] There was an error running the uploader: Error while cleaning paths. No paths matched existing files!
[2022-12-25T19:35:52.175Z] ['verbose'] The error stack is: Error: Error while cleaning paths. No paths matched existing files!
    at cleanCoverageFilePaths (/snapshot/repo/dist/src/helpers/files.js)
    at main (/snapshot/repo/dist/src/index.js)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-12-25T19:35:52.176Z] ['verbose'] End of uploader: 68 milliseconds
Error: Codecov: Failed to properly upload: The process '/home/runner/work/_actions/codecov/codecov-action/v3/dist/codecov' failed with exit code 255

Nevermind, codecov had nothing to do with the issue; game-ci was reporting incorrect paths of the generated reports. Fixed with the following:

- name: Run tests and generate coverage report
  uses: game-ci/unity-test-runner@v2
  id: tests
  env:
    UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
  with:
    githubToken: ${{ secrets.GITHUB_TOKEN }}
    testMode: editmode
    coverageOptions: useProjectSettings;generateAdditionalMetrics
    customParameters: -debugCodeOptimization -enableCodeCoverage

- name: Upload coverage report
  uses: codecov/codecov-action@v3
  with:
    files: ${{ steps.tests.outputs.coveragePath }}/**/*.xml
    fail_ci_if_error: true
1 Like