feat: monsters weight #367
Workflow file for this run
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: Analysis - SonarCloud | |
on: | |
pull_request_target: | |
types: [opened, synchronize, reopened] | |
paths: | |
- 'src/**' | |
- 'source/**' | |
- 'cmake/**' | |
- 'CMakeLists.txt' | |
- 'CMakePresets.json' | |
- 'vcpkg.json' | |
push: | |
paths: | |
- 'src/**' | |
- 'source/**' | |
- 'cmake/**' | |
- 'CMakeLists.txt' | |
- 'CMakePresets.json' | |
- 'vcpkg.json' | |
branches: | |
- main | |
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: | |
- name: Cancel Previous Runs | |
if: github.ref != 'refs/heads/main' | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
concurrent_skipping: 'same_content' | |
cancel_others: true | |
- uses: actions/checkout@v3 | |
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} | |
with: | |
fetch-depth: 0 | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- uses: actions/checkout@v3 | |
if: ${{ github.event_name == 'push' }} | |
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 additional libraries | |
run: sudo apt-get install libasio-dev nlohmann-json3-dev libfmt-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev libglib2.0-dev at-spi2-core libwxgtk3.0-gtk3-dev libarchive-dev freeglut3-dev libxmu-dev libdbus-1-dev libxtst-dev | |
- 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 PR sonar-scanner | |
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner \ | |
--define sonar.cfamily.compile-commands=build/compile_commands.json \ | |
--define sonar.pullrequest.key=${{ github.event.pull_request.number }} \ | |
--define sonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} \ | |
--define sonar.pullrequest.base=${{ github.event.pull_request.base_ref }} | |
- name: Run sonar-scanner | |
if: ${{ github.event_name == 'push' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner \ | |
--define sonar.cfamily.compile-commands=build/compile_commands.json |