Skip to content

feat: monster critical chance and multipliers refactor (#1679) #162

feat: monster critical chance and multipliers refactor (#1679)

feat: monster critical chance and multipliers refactor (#1679) #162

---
name: Analysis - SonarCloud
on:
pull_request_target:
types: [opened, synchronize, reopened]
paths:
- 'src/**'
push:
paths:
- 'src/**'
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 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