How to use GitHub, Travis CI, CodeCov, SonarQube, Doxygen, and CMake using c++ with example cpp-cmake repository
How to set up GitHub account, create SSH key for GitHub, and clone repository to local computer
Shell/Terminal description and Terminal commands
Markdown formatting description
Continuous Integration description, Travis CI setup, build passing badge
Link to example cpp-cmake repository
-
language: cpp
means that the project is written in c++ -
script: ${CC} <file-name>.c -o <file-name>
runs the compiler on a file -
Specify the compiler which the script runs on
compiler: - g++
Create personal access token OR Create an SSH deploy key -- SSH deploy key is more secure
Cache description, additions to .travis.yml file
CodeCov, .codecov.yml file, and code coverage badge
#sudo:required and dist:trusty both specify a trusty build environment
sudo: required
dist: trusty
#${CC} is replaced by gcc and clang cmpilers
#runs coverage on files
script:
- ${CC} --coverage -c <file_name>.c -o <file_name>.o
- ${CC} --coverage <file_name>.o -o <file_name>
- ./<file_name>
#runs if the build passes
#if the compiler is clang, it needs llvm-cov instead of gcov
after_success:
- if [ ${CC} = clang ]; then
bash <(curl -s https://codecov.io/bash) -F ${CC} --gcov-exec "llvm-cov gcov";
else
bash <(curl -s https://codecov.io/bash) -F ${CC};
fi
SonarCloud, sonar-project.properties file, quality gate badge
You will need to add these lines to your .travis.yml file:
addons:
sonarcloud:
organization: "<username>-github"
script:
- sonar-scanner
cache:
ccache: true
directories:
- $HOME/.sonar
How to set up Doxygen, generateDocumentationAndDeploy.sh file, additions to .travis.yml file