From 92d9fe587dd3852e25171f6266550c1dbef3d2b9 Mon Sep 17 00:00:00 2001 From: Tony Kuker <34318535+akuker@users.noreply.github.com> Date: Sun, 9 Apr 2023 19:28:44 -0500 Subject: [PATCH] Revert "Remove SonarCloud cache setup as it is now offered by default (#1135)" (#1144) This reverts commit 3ad668cfd1bc84c80a6ea0edb024bee08264bd37. --- .github/workflows/cpp.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 33a84537..b70855fb 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -93,16 +93,28 @@ jobs: working-directory: cpp run: gcov --preserve-paths $(find -name '*.gcno') + - uses: actions/cache@v3 + name: Cache SonarCloud scan cache + id: sonar-scan-cache + with: + path: ~/.sonar_cache/ + key: sonar-scan-cache-${{ env.SONAR_SCANNER_VERSION }}-${{ github.ref_name }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} + restore-keys: | + sonar-scan-cache-${{ env.SONAR_SCANNER_VERSION }}-${{ github.ref_name }} + - name: Run sonar-scanner env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: >- + (mkdir -p $HOME/.sonar_cache || true) && $HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin/sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.projectKey=${{ env.SONAR_PROJECT_KEY }} --define sonar.organization=${{ env.SONAR_ORGANIZATION }} --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" --define sonar.cfamily.gcov.reportsPath=. + --define sonar.cfamily.cache.enabled=true + --define sonar.cfamily.cache.path="$HOME/.sonar_cache/" --define sonar.coverage.exclusions="cpp/**/test/**" --define sonar.cpd.exclusions="cpp/**/test/**" --define sonar.inclusions="cpp/**,python/**"