Codecov on github: why is Codecov failing?

101 views Asked by At

Context:

I'm dipping my toe into GitHub's lovely CI/CD facility and having a bit of difficulty.

https://github.com/rdpoor/basic-cicd is a super-simple repo designed to run unit tests and coverage tests whenever the developer branch is pushed to github.

Summary:

The unit tests pass, but Codecov fails with the error:

['error'] None of the following appear to exist as files: ./build/gcov/*.gcov

However, when I run the same makefile in my local Ubuntu environment, it does create files in ./build/gcov/.... What am I missing?

Details:

You can clone the repo and try it yourself, but here are the important bits:

The .github/workflows/ci.yml file

name: C/C++ CI

on:
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop ]

jobs:
  build_and_test:
    runs-on: ubuntu-latest
    
    steps:
    - name: Check out repository code
      uses: actions/checkout@v2
    
    - name: Install dependencies
      run: sudo apt-get install -y gcc make lcov
    
    - name: Build and Test
      run: |
        make all
        make coverage

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v2
      with:
        files: ./build/gcov/*.gcov
        flags: unittests
        name: codecov-umbrella
        fail_ci_if_error: true

What Codecov reports:

Run codecov/codecov-action@v2
==> linux OS detected
https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
==> SHASUM file signed by key id 806bb28aed779869
==> Uploader SHASUM verified (e6aa8429d6ff91eddc7eced927e6ec936364a88fe755eed28b1f627a6499980d  codecov)
==> Running version latest
==> Running version v0.6.3
/home/runner/work/_actions/codecov/codecov-action/v2/dist/codecov -n codecov-umbrella -Q github-action-2.1.0 -Z -f ./build/gcov/*.gcov -F unittests
[2023-10-13T23:28:12.760Z] ['info'] 
     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/

  Codecov report uploader 0.6.3
[2023-10-13T23:28:12.768Z] ['info'] => Project root located at: /home/runner/work/basic-cicd/basic-cicd
[2023-10-13T23:28:12.769Z] ['info'] -> No token specified or token is empty
[2023-10-13T23:28:12.777Z] ['info'] Searching for coverage files...
[2023-10-13T23:28:12.831Z] ['error'] None of the following appear to exist as files: ./build/gcov/*.gcov
[2023-10-13T23:28:12.831Z] ['error'] There was an error running the uploader: Error while cleaning paths. No paths matched existing files!
Error: Codecov: Failed to properly upload: The process '/home/runner/work/_actions/codecov/codecov-action/v2/dist/codecov' failed with exit code 255

When I run make coverage locally

Here's a transcript of what happens when I run make all ; make coverage locally:

./basic-cicd$ make all ; make coverage
mkdir -p build/obj build/bin build/gcov
gcc -Isrc -Itest -fprofile-arcs -ftest-coverage -c src/a.c -o build/obj/a.o
gcc -Isrc -Itest -fprofile-arcs -ftest-coverage -c src/b.c -o build/obj/b.o
gcc -Isrc -Itest -fprofile-arcs -ftest-coverage test/test_a.c build/obj/a.o test/unity.c -o build/bin/test_runner_a -fprofile-arcs -ftest-coverage
gcc -Isrc -Itest -fprofile-arcs -ftest-coverage test/test_b.c build/obj/b.o test/unity.c -o build/bin/test_runner_b -fprofile-arcs -ftest-coverage
^[[Abuild/bin/test_runner_a
test/test_a.c:38:test_a_init_sets_count_to_zero:PASS
test/test_a.c:39:test_a_set_count_sets_count_correctly:PASS
test/test_a.c:40:test_a_get_count_gets_count_correctly:PASS

-----------------------
3 Tests 0 Failures 0 Ignored
OK
build/bin/test_runner_b
test/test_b.c:53:test_b_init:PASS
test/test_b.c:54:test_b_increment_count:PASS
test/test_b.c:55:test_b_get_count:PASS

-----------------------
3 Tests 0 Failures 0 Ignored
OK
mkdir -p build/obj build/bin build/gcov
build/bin/test_runner_a
test/test_a.c:38:test_a_init_sets_count_to_zero:PASS
test/test_a.c:39:test_a_set_count_sets_count_correctly:PASS
test/test_a.c:40:test_a_get_count_gets_count_correctly:PASS

-----------------------
3 Tests 0 Failures 0 Ignored
OK
build/bin/test_runner_b
test/test_b.c:53:test_b_init:PASS
test/test_b.c:54:test_b_increment_count:PASS
test/test_b.c:55:test_b_get_count:PASS

-----------------------
3 Tests 0 Failures 0 Ignored
OK
mv build/obj/*.gcno build/gcov || true
mv build/obj/*.gcda build/gcov || true
gcov -o build/gcov -r build/obj/*.o || true
File 'src/a.c'
Lines executed:100.00% of 8
Creating 'a.c.gcov'

File 'src/b.c'
Lines executed:100.00% of 8
Creating 'b.c.gcov'

Lines executed:100.00% of 16
mv *.gcov build/gcov || true
./basic-cicd$ ls ./build/gcov/*.gcov
./build/gcov/a.c.gcov  ./build/gcov/b.c.gcov

As you can see, a.c.gcov and 'b.c.gcovare both present in the./build/gcov/` directory.

(Side note: admittedly my Makefile needs some work: it runs the unit tests twice, once to check for errors, a second time to generate the coverage data. If you have a fix for that, generate a pull request and I'll happily update it!)

0

There are 0 answers