Skip to content

publish code coverage for unit tests #55

Open

Description

@dhebbeker

See WIP.

Acceptance criteria:

  • for all executed unit tests the code coverage shall be published as HTML
  • the code coverage shall be prominently visible in each pull request
  • the intention is to motivate a high code coverage before requesting a merge

Depends on:

Activity

  1. added
    CI infrastructureAnything related to automatic builds and checks.
    testingRelated to creating tests and its infrastructure.
    help wantedExtra attention is needed
    blockedRequires another issue to be resolved first.
    and removed
    blockedRequires another issue to be resolved first.
    on Nov 1, 2023
  2. dhebbeker commented on Nov 15, 2023

    @dhebbeker
    MemberAuthor

    The code coverage (GCDA and GCNO files) is already generated. The HTML report is missing.

    This may be helpful (generated via ChatGPT):

    name: Unit Test with Coverage
    
    on: [push]
    
    jobs:
      test:
        runs-on: ubuntu-latest
    
        steps:
        - name: Checkout Repository
          uses: actions/checkout@v2
    
        - name: Install PlatformIO
          run: sudo apt-get install -y python3-pip && pip3 install -U platformio
    
        - name: Install lcov
          run: sudo apt-get install lcov
    
        - name: Run Unit Tests with Coverage
          run: |
            platformio test --environment <your_environment> --project-option="build_flags=-ftest-coverage -fprofile-arcs"
    
        - name: Generate Coverage HTML Report
          run: |
            lcov --capture --directory . --output-file coverage.info
            lcov --remove coverage.info '/usr/*' --output-file coverage.info
            genhtml coverage.info --output-directory coverage-html
    
        - name: Upload Coverage HTML Report
          uses: actions/upload-artifact@v2
          with:
            name: coverage-report
            path: coverage-html
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CI infrastructureAnything related to automatic builds and checks.help wantedExtra attention is neededtestingRelated to creating tests and its infrastructure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions