GitHub actions CI using CodeCov code coverage

I am currently trying to shift my Julia CI from Travis to GitHub actions (and am pretty new to the topic of CI). Any working workflow for implementing codecov.io usage for GitHub actions in a julia project is highly appreciated, I couldn’t find any.
Below you can find my current workflow. My main problems come from the interplay of

 julia --code-coverage test/runtests.jl

and

bash <(curl -s https://codecov.io/bash) 

The current --code-coverage option produces .cov files in the src directory. However the bash version of the codecov upload does not seem to find these files:

==> GitHub Actions detected.
    project root: .
    Yaml found at: .codecov.yml
--> token set from yaml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
    + .
--> No coverage report found.
    Please visit http://docs.codecov.io/docs/supported-languages

I already tried to do this with the Coverage.jl package, which seemed to give a faulty upload url for some reason. I am aware of different out of the box actions for codecov or julia testing, but none worked in my combined use case.

Thanks in advance for your help!

name: CI
on:
  - push
  - pull_request

jobs:
  test:
    name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        version:
          - '1.5'
        os:
          - ubuntu-latest
        arch:
          - x64
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@v1
        with:
          version: ${{ matrix.version }}
          arch: ${{ matrix.arch }}
      - uses: actions/cache@v1
        env:
          cache-name: cache-artifacts
        with:
          path: ~/.julia/artifacts
          key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
          restore-keys: |
            ${{ runner.os }}-test-${{ env.cache-name }}-
            ${{ runner.os }}-test-
            ${{ runner.os }}-
      - uses: julia-actions/julia-buildpkg@v1
      - run: julia --code-coverage test/runtests.jl
      - uses: codecov/codecov-action@v1
      - run: bash <(curl -s https://codecov.io/bash) 
        shell: bash
  docs:
    name: Documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@v1
        with:
          version: '1'
      - run: |
          julia --project=docs -e '
            using Pkg
            Pkg.develop(PackageSpec(path=pwd()))
            Pkg.instantiate()'
      - run: julia --project=docs docs/make.jl
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

I managed to get the config suggested here to work pretty much otb: Easy workflow file for setting up GitHub Actions CI for your Julia package

I didnt compare your config to the one in there so sorry if this is what you already tried.

That worked, thank you very much!
It seems I did not include julia-actions/julia-processcoverage@v1 in my code previously, which is why it did not work. Don’t know why I didn’t find this blog post earlier. Sorry!

1 Like