From 4b6f89e8b7adbe689c6ea3ef80b680f7ec82a0ee Mon Sep 17 00:00:00 2001 From: Balaji Srinivasan Date: Thu, 22 Jun 2023 15:43:16 +0200 Subject: [PATCH] workflow: Use sonarcloud-github-c-cpp action Saves a lot of manual steps in the workflow Signed-off-by: Balaji Srinivasan --- .github/workflows/sonarcloud-native-posix.yml | 23 +++---------------- .github/workflows/sonarcloud.yml | 23 +++---------------- 2 files changed, 6 insertions(+), 40 deletions(-) diff --git a/.github/workflows/sonarcloud-native-posix.yml b/.github/workflows/sonarcloud-native-posix.yml index 762f164e128..2144cb9b83d 100644 --- a/.github/workflows/sonarcloud-native-posix.yml +++ b/.github/workflows/sonarcloud-native-posix.yml @@ -35,6 +35,9 @@ jobs: run: | apt install -y lcov curl + - name: Install sonar-scanner and build-wrapper + uses: sonarsource/sonarcloud-github-c-cpp@v1.3.2 + # The docker image comes pre-initialized with west dependencies. We want to do west update ourselves to to be sure that we get the latest changes in all repos. # The docker image is built nightly. So it may contain slightly out of date repos. # Hence we remove the .west folder and do a re-init @@ -45,26 +48,6 @@ jobs: cd ncs west update --narrow -o=--depth=1 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - - 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 ${{ 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 - # Download the quarantine file base branch. This is needed to build and run the tests. - name: Download quarentine file from nrf (PR only) if: github.event_name == 'pull_request_target' diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 9ccb058fe09..73cc12291df 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -27,6 +27,9 @@ jobs: run: | apt install -y lcov curl + - name: Install sonar-scanner and build-wrapper + uses: sonarsource/sonarcloud-github-c-cpp@v1.3.2 + # The docker image comes pre-initialized with west dependencies. We want to do west update ourselves to to be sure that we get the latest changes in all repos. # The docker image is built nightly. So it may contain slightly out of date repos. # Hence we remove the .west folder and do a re-init @@ -37,26 +40,6 @@ jobs: cd ncs west update --narrow -o=--depth=1 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - - 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 ${{ 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 native_posix tests shell: bash run: |