This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD GitHub Actions | |
on: [push] | |
jobs: | |
gtest-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- run: git submodule init | |
- run: git submodule update | |
- run: pip install --user cpp-coveralls | |
- run: sudo apt-get update -y && sudo apt-get install -y qt5-qmake qtbase5-dev qtchooser qtbase5-dev-tools | |
- run: qmake | |
- run: make | |
- run: ./tests/tests | |
- name: Coveralls | |
run: coveralls -t ${{ secrets.coveralls_token }} --root . -E ".*external.*" -E ".*tests.*" | |
sonarcloud-check: | |
needs: gtest-tests | |
runs-on: ubuntu-latest | |
env: | |
SONAR_SCANNER_VERSION: 4.6.1.2450 # Find the latest version in the "Linux" link on this page: | |
# https://sonarcloud.io/documentation/analysis/scan/sonarscanner/ | |
SONAR_SERVER_URL: "https://sonarcloud.io" | |
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- run: git submodule init | |
- run: git submodule update | |
- run: sudo apt-get update -y && sudo apt-get install -y qt5-qmake qtbase5-dev qtchooser qtbase5-dev-tools | |
- run: qmake | |
- name: Set up Python 3.8 for gcovr | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: install gcovr 5.0 | |
run: | | |
pip install gcovr==5.0 # 5.1 is not supported | |
- name: Install sonar-scanner and build-wrapper | |
uses: SonarSource/sonarcloud-github-c-cpp@v1 | |
- name: Run build-wrapper | |
run: | | |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make | |
- name: Run tests to generate coverage statistics | |
run: | | |
./tests/tests | |
- name: Collect coverage into one XML report | |
run: | | |
gcovr --sonarqube > coverage.xml | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here | |
run: | | |
sonar-scanner \ | |
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ | |
--define sonar.coverageReportPaths=coverage.xml |