PlatformIO Community

Travis CI Integration with Codecov.io for Platform.Io Library

Hello,
As part of development and maintaining Arduino Compatible Libraries for Infineon Sensors, we wanted to integrate code coverage with our travis ci.
We are using python 3.7 and platformio ci for the build but could not integrate codecov.io.
As a test, I created a branch “test” in repository “DPS310-Pressure-Sensor” DPS310-Pressure-Sensor: branch-test.
The current travis.yml file is attached below:

    language: python
    python:
    - 3.7

    sudo: required

    cache: pip
        
    branches:
      - master
      - dps310
      - test

    env:
       
       
    matrix:
        - PLATFORMIO_CI_SRC=examples/i2c_background
        - PLATFORMIO_CI_SRC=examples/i2c_command
        - PLATFORMIO_CI_SRC=examples/i2c_interrupt
        - PLATFORMIO_CI_SRC=examples/spi_background
        - PLATFORMIO_CI_SRC=examples/spi_command
        - PLATFORMIO_CI_SRC=examples/spi_interrupt

    before_install:
      - python3 -m pip install -U coverage codecov mypy

    install:
    # build with stable core    
    - pip install -U platformio
    - platformio platform install -f infineonxmc

    script:
    -  platformio ci --lib="."  --board=xmc1100_xmc2go --board=xmc1100_boot_kit --board=xmc4700_relax_kit --board=uno --board nodemcuv2

    #after_success:
    #  - codecov

I tried finding any availbale resource but unfortunately it is just not working.
Any help or guide to point me to the right direction would be highly appreciated.
Thanks & Regards,
Arka

  • What resource are you refering to?
  • What exactly is not working? Any particular error message?

Hello @maxgerhardt,
I referred to travis documentation for codecov.io and codecov.io documentation for python too.
I already attached the .travis.yml file and this time I am attaching the error message:

after_success

10790.13s$ codecov

1080

1081 _____ _

1082 / ____| | |

1083 | | ___ __| | ___ ___ _____ __

1084 | | / _ \ / _ |/ _ \/ __/ _ \ \ / /

1085 | |___| (_) | (_| | __/ (_| (_) \ V /

1086 \_____\___/ \____|\___|\___\___/ \_/

1087 v2.0.15

1088

1089==> Detecting CI provider

1090 Travis Detected

1091==> Preparing upload

1092==> Processing gcov (disable by -X gcov)

1093 Executing gcov (find /home/travis/build/Infineon/DPS310-Pressure-Sensor -not -path './bower_components/**' -not -path './node_modules/**' -not -path './vendor/**' -type f -name '*.gcno' -exec gcov -pb {} +)

1094==> Collecting reports

1095Error: No coverage report found

1096

1097Tip: See an example python repo: https://github.com/codecov/example-python

1098Support channels:

1099 Email: hello@codecov.io

1100 IRC: #codecov

1101 Gitter: https://gitter.im/codecov/support

1102 Twitter: @codecov

As you can see , after the build is success codecov is telling me that coverage is not found. So I changed my .travis.yml to the following:
script:
- platformio ci coverage run --lib="." --board=xmc1100_xmc2go --board=xmc1100_boot_kit --board=xmc4700_relax_kit --board=uno --board nodemcuv2

When I change as above , I get the same error message.

Thanks ,
Arka

Well, that isn’t going to work because firstly that’s (coverage run) not a supported option for the ci command.

Do you really want the codecov.io documentation for python when your code is C++? Skimming this stack overflow question, it sounds like you might want to use --project-option to add something like --project-option="build_flag=--coverage" which would add the --coverage flag to the gcc compiler, and then use the after_success config provided by the asker of the question.

Or everything I just said could be complete nonsense, as I don’t use codecov.io!! :open_mouth: