Skip to content

Latest commit

 

History

History
79 lines (57 loc) · 3.19 KB

documentation_cpp-cmake.md

File metadata and controls

79 lines (57 loc) · 3.19 KB

How to

How to use GitHub, Travis CI, CodeCov, SonarQube, Doxygen, and CMake using c++ with example cpp-cmake repository

GitHub

How to set up GitHub account, create SSH key for GitHub, and clone repository to local computer

The Shell and Terminal

Shell/Terminal description and Terminal commands

Markdown

Markdown formatting description

Travis CI

Continuous Integration description, Travis CI setup, build passing badge

Example of a .travis.yml file

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 a Personal Access Token OR Create a Deploy Key for the Repo

Create personal access token OR Create an SSH deploy key -- SSH deploy key is more secure

Cache

Cache description, additions to .travis.yml file

Code Coverage

CodeCov, .codecov.yml file, and code coverage badge

Additions to .travis.yml file needed for Code Coverage

#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

SonarQube

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

Doxygen

How to set up Doxygen, generateDocumentationAndDeploy.sh file, additions to .travis.yml file

CMake

How to set up CMakeLists.txt file and .travis.yml file