Skip to content

Commit

Permalink
[build] Migrate SonarCloud to GitHub Action (#2910).
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Mar 12, 2024
1 parent 03aa5e4 commit 0a046d4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/cxx11-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,33 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]

types: [opened, synchronize, reopened]
jobs:
build:
name: ubuntu
runs-on: ubuntu-20.04

env:
BUILD_WRAPPER_OUT_DIR: sonar-output # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v3
- name: Install sonar-scanner and build-wrapper
uses: sonarsource/sonarcloud-github-c-cpp@v2
- name: configure
run: |
mkdir _build && cd _build
cmake ../ -DENABLE_STDCXX_SYNC=ON -DENABLE_ENCRYPTION=ON -DENABLE_UNITTESTS=ON -DENABLE_BONDING=ON -DENABLE_TESTING=ON -DENABLE_EXAMPLES=ON -DENABLE_CODE_COVERAGE=ON
- name: build
run: cd _build && cmake --build ./
run: cd _build && build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build .
- name: test
run: |
cd _build && ctest --extra-verbose
- name: codecov
run: |
source ./scripts/collect-gcov.sh
bash <(curl -s https://codecov.io/bash)
- name: Run SonarCloud Scan for C and C++
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options.
run: sonar-scanner --define sonar.cfamily.build-wrapper-output=_build/"${{ env.BUILD_WRAPPER_OUT_DIR }}"
21 changes: 1 addition & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ addons:
- build-essential
- libmbedtls-dev
- gdb
sonarcloud:
organization: "haivision"
token:
secure: "wJZC0kyyjuf4SZyonZ6p/5Ga9asEqSnKWF9NpRbu6S6ceERO7vbebuSJF5qX3A6ivPuw0TTk5WASOdnvIyfA28FU/D0MWRdH8K7T3w77wdE9EgAEYTUXzdrbzJY18+9pxjljHwWXWALPSGf3MClg4irWrdk1e6uHK+68R39+ZvBGBFpWeeZy/+at9+xwhtAGKBlSHe8zc+3wPxuYdvviLVJ25qbpNmnzkUR0X89G+UBl90raCPSN32EHFdImHZ5DxfEQQJgZFRjzQUY4EW/iYwaMel7jufAq0ClgV4psKujl9Lz8cPqx3WgqRfJyiIthOMTsac7G4zAw8LK2CI0VsssBp0JalLXaumi6vG7o6c3rIwKckzSKccq3pHa7h45praIVVn9s3nq+Q/JGA11FMkKQxdQtmwgFsLhbi6ZxabgsUi5KtWoWY2z6MgpJuROuAjNxZi9XJzUoJs7zSTUtRRW7V8Q2lRiOnknYh25N6TCA5bpyy1EZmRdJErm071YNI9P01gbFz5137FWJFiJzro9TGF0KoHSGiCIdUt3WlMzwr/i/wFLxFBQOZQ2rjTXvhs4hxONxMZV3gzxA1NdLaf9i5Mh6jxVMV+ujaRSV7JmPGzxqiAlpT9cJUhTCYuar9diLLeDrpe7RawEZR8V1xVDQ7yT8ruDNQ78VbSn/sC0="
homebrew:
update: false
packages:
Expand All @@ -26,7 +22,6 @@ matrix:
env:
- BUILD_TYPE=Debug
- BUILD_OPTS='-DENABLE_BONDING=ON -DCMAKE_CXX_FLAGS="-Werror"'
- RUN_SONARCUBE=1
- env:
- BUILD_TYPE=Debug
- BUILD_OPTS='-DENABLE_LOGGING=OFF -DUSE_ENCLIB=mbedtls -DENABLE_MONOTONIC_CLOCK=ON -DENABLE_BONDING=ON -DCMAKE_CXX_FLAGS="-Werror"'
Expand Down Expand Up @@ -80,25 +75,11 @@ script:
export PKG_CONFIG_PATH=$(brew --prefix openssl)"/lib/pkgconfig";
cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_OPTS -DENABLE_UNITTESTS="ON";
fi
- echo "TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG"
- echo "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST"
- if [[ "$TRAVIS_REPO_SLUG" != "Haivision/srt" || "$TRAVIS_PULL_REQUEST" -gt 0 ]]; then
export RUN_SONARCUBE=0;
fi
- echo "RUN_SONARCUBE=$RUN_SONARCUBE"
- if (( "$RUN_SONARCUBE" )); then
build-wrapper-linux-x86-64 --out-dir bw-output make;
else
make -j$(nproc);
fi
- make -j$(nproc);
- if [ "$TRAVIS_COMPILER" != "x86_64-w64-mingw32-g++" ]; then
ulimit -c unlimited;
./test-srt -disable-ipv6;
SUCCESS=$?;
if [ -f core ]; then gdb -batch ./test-srt -c core -ex bt -ex "info thread" -ex quit; else echo "NO CORE - NO CRY!"; fi;
test $SUCCESS == 0;
fi
after_success:
- if (( "$RUN_SONARCUBE" )); then
sonar-scanner -D"sonar.cfamily.gcov.reportPath=.";
fi
6 changes: 3 additions & 3 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ sonar.organization=haivision
# =====================================================

sonar.links.homepage=https://github.com/Haivision/srt
sonar.links.ci=https://travis-ci.org/Haivision/srt
sonar.links.scm=https://github.com/Haivision/srt
sonar.links.issue=https://github.com/Haivision/srt/issues

Expand All @@ -29,8 +28,9 @@ sonar.links.issue=https://github.com/Haivision/srt/issues
# =====================================================

# SQ standard properties
sonar.sources=.
sonar.sources=srtcore/,apps/,common/,examples/,haicrypt/,scripts/,testing/
sonar.tests=test/

# Properties specific to the C/C++ analyzer:
sonar.cfamily.build-wrapper-output=bw-output
sonar.cfamily.build-wrapper-output=_build/sonar-output
sonar.cfamily.gcov.reportsPath=.

0 comments on commit 0a046d4

Please sign in to comment.