Skip to content

Merge branch 'main' of https://github.com/s2leandro155/rzyns #8

Merge branch 'main' of https://github.com/s2leandro155/rzyns

Merge branch 'main' of https://github.com/s2leandro155/rzyns #8

---
name: Analysis - SonarCloud
on:
push:
branches:
- main
paths:
- "src/**"
env:
VCPKG_BUILD_TYPE: debug
CMAKE_BUILD_PARALLEL_LEVEL: 2
MAKEFLAGS: "-j 2"
VCPKG_BINARY_SOURCES: clear;default,readwrite
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Linux Dependencies
run: >
sudo apt-get update && sudo apt-get install ccache linux-headers-$(uname -r)
- name: CCache
id: ccache
uses: actions/cache@main
with:
path: $HOME/.ccache
key: ccache-${{ runner.os }}-${{ hashFiles('**/src') }}
restore-keys: |
ccache-${{ runner.os}}-
- name: Cache SonarCloud packages
uses: actions/cache@main
with:
path: $HOME/.sonar/cache
key: sonar-${{ runner.os}}-${{ hashFiles('**/src') }}
restore-keys: |
sonar-${{ runner.os}}-
- name: Restore artifacts and install vcpkg
id: vcpkg-step
run: |
vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ')
echo "vcpkg commit ID: $vcpkgCommitId"
echo "VCPKG_GIT_COMMIT_ID=$vcpkgCommitId" >> $GITHUB_ENV
- name: Get vcpkg commit id from vcpkg.json
uses: lukka/run-vcpkg@main
with:
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git"
vcpkgGitCommitId: ${{ env.VCPKG_GIT_COMMIT_ID }}
- name: Install sonar-scanner
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Generate compilation database
run: |
mkdir -p build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DOPTIONS_ENABLE_CCACHE=ON -DSPEED_UP_BUILD_UNITY=OFF -S . -B build
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner \
--define sonar.cfamily.compile-commands=build/compile_commands.json