Skip to content

Commit

Permalink
CI: Update SonarCloud to 6.2 + Java 17
Browse files Browse the repository at this point in the history
  • Loading branch information
orgads committed Sep 29, 2024
1 parent 5454ca8 commit 8b36c72
Showing 1 changed file with 13 additions and 35 deletions.
48 changes: 13 additions & 35 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 8b36c72

Please sign in to comment.