From ca73028cc2fde5008a9170c4b6aed01a2157e45f Mon Sep 17 00:00:00 2001 From: "jules.vinot" Date: Wed, 22 May 2024 11:31:13 +0200 Subject: [PATCH] Test SC GHA --- .github/workflows/build.yml | 35 +++++++---------------------------- sonar-project.properties | 13 +++++++++++++ 2 files changed, 20 insertions(+), 28 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f2c09b..083be39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,41 +1,20 @@ name: Build - on: push: branches: - - master - - develop - - feature + - test-action pull_request: types: [opened, synchronize, reopened] - jobs: - build: - name: Build + sonarcloud: + name: SonarCloud runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 - - name: Cache SonarQube packages - uses: actions/cache@v1 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Cache Gradle packages - uses: actions/cache@v1 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle - - name: Build and analyze + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@6c92dc36709458d7d6e1ed85a661f492d074301a env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - run: ./gradlew build sonar --info + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_GHA }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..bdb6479 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,13 @@ +sonar.projectKey=testavinot_test-sc-scan-gha +sonar.organization=testavinot + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=test-sc-scan-gha +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8