|
| 1 | +name: SonarCloud |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + sonar: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + with: |
| 14 | + fetch-depth: 0 # Needed to access history |
| 15 | + |
| 16 | + - name: Install dependencies |
| 17 | + run: | |
| 18 | + sudo apt-get -y update |
| 19 | + # Qt5 |
| 20 | + sudo apt-get install -y qtbase5-dev libqt5svg5-dev |
| 21 | + # OpenCascade |
| 22 | + sudo apt-get -y install libocct-data-exchange-dev libocct-draw-dev occt-misc |
| 23 | + sudo apt-get -y install libtbb-dev libxi-dev |
| 24 | + # Assimp |
| 25 | + sudo apt-get -y install libassimp-dev |
| 26 | +
|
| 27 | + - name: Configure |
| 28 | + run: | |
| 29 | + cmake -S . -B build \ |
| 30 | + -DCMAKE_BUILD_TYPE=Release \ |
| 31 | + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ |
| 32 | + -DMayo_BuildTests=ON \ |
| 33 | + -DMayo_BuildPluginAssimp=ON |
| 34 | +
|
| 35 | + - name: Build(instrumented) |
| 36 | + run: | |
| 37 | + curl -sSLo build-wrapper.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip |
| 38 | + unzip -o build-wrapper.zip |
| 39 | + build-wrapper-linux-x86/build-wrapper-linux-x86-64 \ |
| 40 | + --out-dir bw-output \ |
| 41 | + cmake --build build --config Release --parallel $(nproc) |
| 42 | +
|
| 43 | + - name: SonarCloud Scan |
| 44 | + run: | |
| 45 | + sudo apt-get install -y unzip |
| 46 | + curl -sSLo sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip |
| 47 | + unzip -q sonar-scanner.zip |
| 48 | + SCANNER_DIR=$(find . -maxdepth 1 -type d -name "sonar-scanner-*") |
| 49 | +
|
| 50 | + $SCANNER_DIR/bin/sonar-scanner \ |
| 51 | + -Dsonar.projectKey=fougue_mayo \ |
| 52 | + -Dsonar.organization=fougue \ |
| 53 | + -Dsonar.sources=. \ |
| 54 | + -Dsonar.cfamily.cpp-standard=c++17 \ |
| 55 | + -Dsonar.inclusions=src/**/*.cpp,src/**/*.h \ |
| 56 | + -Dsonar.exclusions=**/3rdparty/**,**/*moc_*.cpp,**/ui_*.h \ |
| 57 | + -Dsonar.cfamily.compile-commands=bw-output/compile_commands.json \ |
| 58 | + -Dsonar.host.url=https://sonarcloud.io \ |
| 59 | + -Dsonar.login=${SONAR_TOKEN} |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 63 | + |
| 64 | + |
0 commit comments