Feature/update GitHub actions #22
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: Sidelobe Build Sonarqube | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
name: Linux, GCC, Release, Coverage & SonarQube | |
runs-on: ubuntu-latest | |
env: | |
BUILD_WRAPPER_OUT_DIR: '$GITHUB_WORKSPACE/deploy/build/bw-output' # Directory where build-wrapper output will be placed | |
cxx: g++-11 | |
cc: gcc-11 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Install Toolchain | |
run: | | |
pip3 install gcovr | |
echo "Gcovr Updated!" | |
gcovr --version | |
sudo apt-get install -y g++-11 gcc-11 | |
- name: Install Build Wrapper | |
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v4 | |
- name: Setup & Cmake | |
working-directory: deploy | |
env: | |
CC: ${{env.cc}} | |
CXX: ${{env.cxx}} | |
run: | | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Release -DCODE_COVERAGE=Yes ../.. | |
- name: Build & Run Tests | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
working-directory: deploy/build | |
run: | | |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make -j 4 | |
./MemorySentinelTest | |
cd .. | |
mkdir -p report | |
# Generate coverage report | |
gcovr -r .. -f ../source --exclude-unreachable-branches --exclude-throw-branches --sonarqube -o report/coverage.xml | |
- name: SonarQube Scan | |
uses: SonarSource/sonarqube-scan-action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: > | |
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" |