From 8b36c720383e24cbeb948790719c721cd358649b Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 8 Jul 2024 12:36:38 +0000 Subject: [PATCH] CI: Update SonarCloud to 6.2 + Java 17 --- .github/workflows/sonarcloud.yml | 48 +++++++++----------------------- 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 961ca6786b..3d53706277 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -1,51 +1,29 @@ name: SonarCloud Scan on: - push: - branches: [ main ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] - schedule: - - cron: '0 9 * * *' # Daily at 10:00 UTC + workflow_dispatch: + # push: + # branches: [ main ] + # pull_request: + # # The branches below must be a subset of the branches above + # branches: [ main ] + # schedule: + # - cron: '0 9 * * *' # Daily at 10:00 UTC jobs: build: name: Build runs-on: ubuntu-latest env: - SONAR_SCANNER_VERSION: 4.6.1.2450 # Find the latest version in the "Linux" link on this page: - # https://sonarcloud.io/documentation/analysis/scan/sonarscanner/ + SONAR_SCANNER_VERSION: 6.2.0.4584 # Find the latest version in the following link: + # https://docs.sonarsource.com/sonarcloud/advanced-setup/ci-based-analysis/sonarscanner-cli/ 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@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis submodules: recursive - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - 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 - 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: Install sonar-scanner and build-wrapper + uses: sonarsource/sonarcloud-github-c-cpp@v2 - name: build dependencies run: | sudo apt-get update