Skip to content

Merge pull request #62 from ckormanyos/reduce_scope_ci #41

Merge pull request #62 from ckormanyos/reduce_scope_ci

Merge pull request #62 from ckormanyos/reduce_scope_ci #41

# ------------------------------------------------------------------------------
# Copyright Christopher Kormanyos 2022 - 2023.
# 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: mandelbrot_sonar
on:
push:
branches:
- main
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@v3
with:
fetch-depth: '0'
- name: clone-submods-bootstrap-headers-boost-develop
run: |
git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
cd ../boost-root
git submodule update --init tools
git submodule update --init libs/array
git submodule update --init libs/assert
git submodule update --init libs/concept_check
git submodule update --init libs/config
git submodule update --init libs/container
git submodule update --init libs/container_hash
git submodule update --init libs/core
git submodule update --init libs/describe
git submodule update --init libs/detail
git submodule update --init libs/filesystem
git submodule update --init libs/functional
git submodule update --init libs/gil
git submodule update --init libs/integer
git submodule update --init libs/io
git submodule update --init libs/iterator
git submodule update --init libs/lexical_cast
git submodule update --init libs/move
git submodule update --init libs/mp11
git submodule update --init libs/mpl
git submodule update --init libs/multiprecision
git submodule update --init libs/numeric/conversion
git submodule update --init libs/preprocessor
git submodule update --init libs/range
git submodule update --init libs/smart_ptr
git submodule update --init libs/static_assert
git submodule update --init libs/system
git submodule update --init libs/throw_exception
git submodule update --init libs/type_traits
git submodule update --init libs/utility
git submodule update --init libs/variant2
./bootstrap.sh
./b2 headers
- name: prepare-environment
run: |
echo "query GCC version"
g++ -v
echo "build libjpeg-6b.a"
cd jpeg
make all
cd ..
mkdir -p images/tmp
- name: Set up JDK 17
uses: actions/setup-java@v3
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++ -c -finline-functions -march=native -mtune=native -O3 -Wall -Wextra -std=c++2a -I. -Ijpeg/jpeg-6b-2022 -I../boost-root -pthread test/test_mandelbrot.cpp -o test_mandelbrot.o && g++ test_mandelbrot.o -lpthread -ljpeg-6b -Ljpeg/jpeg-6b-2022/obj -o test_mandelbrot.exe
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
java -version
sonar-scanner -Dsonar.projectKey=ckormanyos_mandelbrot -Dsonar.projectName=mandelbrot --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"