For that example, I'll use one of my GitHub project arduino-toolbox, Travis-CI and Coveralls but the commands lines will be exactly the same for any other setup.
Since the project is using Cmake, the following commands could go inside an add_custom_target rule in CMakeLists.txt