Skip to content

Merge pull request #579 from ckormanyos/more_syntax #649

Merge pull request #579 from ckormanyos/more_syntax

Merge pull request #579 from ckormanyos/more_syntax #649

# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022 - 2024.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
name: real-time-cpp-sonar
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: sonar-gcc-native
runs-on: ubuntu-latest
env:
SONAR_SCANNER_VERSION: 5.0.1.3006
SONAR_SERVER_URL: "https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
overwrite-settings: true
- name: Download and set up sonar-scanner
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
run: |
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
- name: Download and set up build-wrapper
env:
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip
run: |
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Run build-wrapper
run: |
java -version
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} g++ -O3 -std=c++14 -Wall -Wextra -Wpedantic -Wmain -Wundef -Wconversion -Wsign-conversion -Wunused-parameter -Wuninitialized -Wmissing-declarations -Wshadow -Wunreachable-code -Wswitch-default -Wswitch-enum -Wcast-align -Wmissing-include-dirs -Winit-self -Wfloat-equal -Wdouble-promotion -Wno-comment -gdwarf-2 -fno-exceptions -ffunction-sections -fdata-sections -fno-rtti -fno-use-cxa-atexit -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs -ftemplate-depth=128 -Wzero-as-null-pointer-constant -Iref_app/src -Iref_app/src/mcal/host -pthread -lpthread ref_app/src/app/benchmark/app_benchmark.cpp ref_app/src/app/benchmark/app_benchmark_none.cpp ref_app/src/app/led/app_led.cpp ref_app/src/mcal/host/mcal_cpu.cpp ref_app/src/mcal/host/mcal_eep.cpp ref_app/src/mcal/host/mcal_gpt.cpp ref_app/src/mcal/host/mcal_irq.cpp ref_app/src/mcal/host/mcal_led.cpp ref_app/src/mcal/host/mcal_osc.cpp ref_app/src/mcal/host/mcal_pwm.cpp ref_app/src/mcal/host/mcal_port.cpp ref_app/src/mcal/host/mcal_spi.cpp ref_app/src/mcal/host/mcal_wdg.cpp ref_app/src/mcal/host/mcal_wdg_watchdog.cpp ref_app/src/mcal/mcal.cpp ref_app/src/os/os.cpp ref_app/src/sys/idle/sys_idle.cpp ref_app/src/sys/mon/sys_mon.cpp ref_app/src/sys/start/sys_start.cpp -o ref_app.exe
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
java -version
sonar-scanner -Dsonar.projectKey=ckormanyos_real-time-cpp -Dsonar.projectName=real-time-cpp --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"