Documenter.jl: Add code coverage from deployed docs?

Created on 11 Aug 2020  路  3Comments  路  Source: JuliaDocs/Documenter.jl

I use GitHub actions to deploy documentation (using Literate) separately from test/runtests.jl. The code bits are run and the output shows nicely in the docs and the notebooks, which is great (thanks Documenter 脳 Literate!). But I would also like to get code coverage data from the code in the docs (using codecov). Is this possible? If yes, how?

I was assuming this required adding these last three lines (see below) to my docs.yml file (the top part comes from Documenter's GitHub-Actions docs):

name: Documentation

on:
  push:
    branches:
      - master
    tags: '*'
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@latest
        with:
          version: '1.4'
      - name: Install dependencies
        run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
      - name: Build and deploy
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
          DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
        run: julia --project=docs/ docs/make.jl
      # I added these 3 lines below
      - uses: julia-actions/julia-uploadcodecov@latest
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

but I don't think it works. Maybe there's something else to do? Or maybe something entirely different? Or maybe it can't be done at all? Any pointers appreciated!

Documentation Question

All 3 comments

That should work. What you are missing is probably just to start Julia with --code-coverage=user, i.e.

run: julia --project=docs/ --code-coverage=user docs/make.jl

Great! Thanks for your help @fredrikekre! I think this worked! @mortenpi do you think this should be added to Documenter's docs?

Yeah, I think it could be a useful thing to mention.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

denizyuret picture denizyuret  路  6Comments

BioTurboNick picture BioTurboNick  路  5Comments

halirutan picture halirutan  路  4Comments

jonathan-laurent picture jonathan-laurent  路  3Comments

asinghvi17 picture asinghvi17  路  3Comments