Task-Tracker-Systems / Task-Tracker-Device

Sources for a task time recording device.
https://task-tracker-systems.github.io/Task-Tracker-Device/
MIT License
2 stars 0 forks source link

publish code coverage for unit tests #55

Open dhebbeker opened 11 months ago

dhebbeker commented 11 months ago

See WIP.

Acceptance criteria:

Depends on:

dhebbeker commented 11 months ago

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