61 lines
1.8 KiB
YAML
61 lines
1.8 KiB
YAML
name: sonarcloud scan
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- dev
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
jobs:
|
|
build:
|
|
name: sonarcloud scan
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CONAN_SYSREQUIRES_MODE: "enabled"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install sonar-scanner and build-wrapper
|
|
uses: sonarsource/sonarcloud-github-c-cpp@v3
|
|
id: sonarscan
|
|
|
|
- name: Download and set up sonar-scanner
|
|
run: |
|
|
wget -nv https://cdn.anotherfoxguy.com/sonar-scanner/mofilereader -O run-sonar-scanner
|
|
sudo chmod 777 run-sonar-scanner
|
|
|
|
- name: Cache conan
|
|
uses: actions/cache@v4
|
|
with:
|
|
key: conan-linux-${{ hashFiles('conanfile.txt') }}
|
|
path: ~/.conan2/
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-cmake.sh" | sudo bash
|
|
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash
|
|
|
|
- name: Configure
|
|
run: |
|
|
cmake --preset conan-release -DBUILD_TEST=ON -DENABLE_COVERAGE=ON -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="cmake/conan_provider.cmake"
|
|
|
|
- name: Run build-wrapper
|
|
run: build-wrapper-linux-x86-64 --out-dir bw-output make -j4
|
|
|
|
- name: Test
|
|
continue-on-error: true
|
|
run: ctest --output-on-failure
|
|
|
|
- name: Generate coverage
|
|
run: make gcov
|
|
|
|
- name: Run sonar-scanner
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_SCANNER_EXE: ${{ steps.sonarscan.outputs.sonar-scanner-binary }}
|
|
run: ./run-sonar-scanner
|
|
|
|
- name: Clean Conan pkgs
|
|
run: conan cache clean "*" -sbd |