Bump github/codeql-action from 3.28.5 to 3.28.8 #867
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: SonarCloud | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
sonarcloud: | |
name: SonarCloud | |
runs-on: ubuntu-22.04 | |
env: | |
SONAR_SERVER_URL: "https://sonarcloud.io" | |
# Directory where build-wrapper output will be placed | |
WRAPPER_OUT: build_wrapper_output_directory | |
CLANG_VERSION: 18 | |
BUILD_DIR: build | |
COVERAGE: "./coverage.txt" | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
submodules: True | |
- name: Get branch names | |
id: branch-names | |
uses: tj-actions/branch-names@6871f53176ad61624f978536bbf089c574dc19a2 # v8.0.1 | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake ninja-build | |
- name: Install Dependencies (LLVM) | |
uses: paulhuggett/install-llvm@ad897b4b1cf03f54c1218ec6d97a23ff4b10b870 # v1.0 | |
with: | |
version: ${{ env.CLANG_VERSION }} | |
- name: Install sonar-scanner and build-wrapper | |
uses: SonarSource/sonarcloud-github-c-cpp@44cc4d3d487fbc35e5c29b0a9d717be218d3a0e8 # v3.2.0 | |
- name: CMake Configure | |
run: | | |
mkdir "$BUILD_DIR" | |
cmake -G Ninja \ | |
-S . \ | |
-B "$BUILD_DIR" \ | |
-D ICUBABY_COVERAGE=Yes \ | |
-D ICUBABY_STANDALONE=Yes \ | |
-D "CMAKE_C_COMPILER=clang-$CLANG_VERSION" \ | |
-D "CMAKE_CXX_COMPILER=clang++-$CLANG_VERSION" | |
- name: Build | |
run: | | |
build-wrapper-linux-x86-64 \ | |
--out-dir "$WRAPPER_OUT" \ | |
cmake --build "$BUILD_DIR" --config Release | |
- name: Run Test Tools | |
run: | | |
set -v | |
TESTS="\ | |
tests/iconv/iconv-test \ | |
tests/ranges/ranges \ | |
tests/demo8/demo8 \ | |
tests/exhaust/icubaby-exhaust-test \ | |
tests/performance/performance \ | |
unittests/icubaby-unittests" | |
for f in $TESTS; do | |
P="$BUILD_DIR/$f" | |
LLVM_PROFILE_FILE="$P.profraw" $P | |
done | |
- name: Index the Raw Profiles | |
run: | | |
find "$BUILD_DIR" -name \*.profraw -print0 | | |
xargs -0 \ | |
"llvm-profdata-$CLANG_VERSION" \ | |
merge \ | |
-o "$BUILD_DIR/merged.profdata" \ | |
-sparse | |
- name: Collect Coverage | |
run: | | |
{ \ | |
find "$BUILD_DIR" -name CMakeFiles -prune -type f -or -type f -perm -u=x -print0 | \ | |
xargs -0 -n 1 "llvm-cov-$CLANG_VERSION" show --instr-profile build/merged.profdata | |
} > "$COVERAGE" | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
echo "Running on branch: ${{ steps.branch-names.outputs.current_branch }}" | |
echo "Base branch: ${{ steps.branch-names.outputs.base_ref_branch }}" | |
sonar-scanner \ | |
-X \ | |
--define sonar.branch.name="${{ steps.branch-names.outputs.current_branch }}" \ | |
--define sonar.branch.target="${{ steps.branch-names.outputs.base_ref_branch }}" \ | |
--define sonar.cfamily.compile-commands="$WRAPPER_OUT/compile_commands.json" \ | |
--define sonar.exclusions="$BUILD_DIR/**/*,docs/**/*" \ | |
--define sonar.host.url="$SONAR_SERVER_URL" \ | |
--define sonar.organization=paulhuggett-github \ | |
--define sonar.projectKey=paulhuggett_icubaby \ | |
--define sonar.projectVersion="$(git rev-parse HEAD)" \ | |
--define sonar.python.version=3.7,3.8,3.9,3.10,3.11 \ | |
--define sonar.sourceEncoding=UTF-8 | |
# Disabled due to exception from Sonar. | |
#--define sonar.cfamily.llvm-cov.reportPath="$COVERAGE" |