Fedora base #53
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: sonar-scanner | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
sonar: | |
name: Sonar | |
runs-on: ubuntu-latest | |
env: | |
SONAR_SCANNER_VERSION: 4.6.1.2450 # Find the latest version in the "Linux" link on this page: | |
# https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Install boost | |
run: sudo apt update && sudo apt install -y libboost-all-dev | |
- name: Install gtest | |
run: | | |
wget https://github.com/google/googletest/archive/2fe3bd9.tar.gz -O gtest.tar.gz | |
tar xf gtest.tar.gz | |
cd googletest* | |
cmake . | |
sudo make -j install | |
cd .. && sudo rm -rf googletest* | |
- name: Install rapidjson | |
run: sudo apt install -y rapidjson-dev | |
- name: Install nghttp2 | |
run: | | |
wget https://github.com/nghttp2/nghttp2/releases/download/v1.45.1/nghttp2-1.45.1.tar.bz2 | |
tar xf nghttp2-1.45.1.tar.bz2 | |
cd nghttp2-1.45.1 | |
./configure --enable-asio-lib --disable-shared --enable-python-bindings=no | |
sudo make -j install | |
cd .. && sudo rm -rf nghttp2* | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v1 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- 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 | |
run: | | |
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip | |
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: | | |
mkdir build | |
sudo sh scripts/generate_certs_for_ut_server.sh | |
sudo chmod +r /usr/local/share/ca-certificates/localhost.key /usr/local/share/ca-certificates/localhost.crt | |
cmake -S . -B build | |
build-wrapper-linux-x86-64 --out-dir build_wrapper_output_directory cmake --build build/ --config Debug | |
- name: Exec unit tests | |
run: ./build/ut/unit-test | |
- name: Generate gcov files | |
run: | | |
mkdir gcov | |
cd gcov | |
for i in $(find .. -type f -name '*gcno' -printf '%h\n' 2> /dev/null | uniq); do gcov -b -p -c $i/*.gcno; done | |
cd .. | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner |