-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73adc31
commit 6996ad2
Showing
3 changed files
with
43 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,38 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# This workflow helps you trigger a SonarCloud analysis of your code and populates | ||
# GitHub Code Scanning alerts with the vulnerabilities found. | ||
# Free for open source project. | ||
|
||
# 1. Login to SonarCloud.io using your GitHub account | ||
|
||
# 2. Import your project on SonarCloud | ||
# * Add your GitHub organization first, then add your repository as a new project. | ||
# * Please note that many languages are eligible for automatic analysis, | ||
# which means that the analysis will start automatically without the need to set up GitHub Actions. | ||
# * This behavior can be changed in Administration > Analysis Method. | ||
# | ||
# 3. Follow the SonarCloud in-product tutorial | ||
# * a. Copy/paste the Project Key and the Organization Key into the args parameter below | ||
# (You'll find this information in SonarCloud. Click on "Information" at the bottom left) | ||
# | ||
# * b. Generate a new token and add it to your Github repository's secrets using the name SONAR_TOKEN | ||
# (On SonarCloud, click on your avatar on top-right > My account > Security | ||
# or go directly to https://sonarcloud.io/account/security/) | ||
|
||
# Feel free to take a look at our documentation (https://docs.sonarcloud.io/getting-started/github/) | ||
# or reach out to our community forum if you need some help (https://community.sonarsource.com/c/help/sc/9) | ||
|
||
name: SonarCloud analysis | ||
|
||
on: | ||
# Only manual run for now as this integration is not scanning Kotlin files | ||
workflow_dispatch: | ||
|
||
permissions: | ||
pull-requests: read | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
Analysis: | ||
build: | ||
name: Build and analyze | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Analyze with SonarCloud | ||
|
||
# You can pin the exact commit or the version. | ||
# uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 | ||
uses: SonarSource/sonarcloud-github-action@master | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'zulu' # Alternative distribution options are available | ||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
- name: Cache Gradle packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
- name: Build and analyze | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
GITHUB_TOKEN: ${{ secrets.PAT }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
with: | ||
args: | ||
-Dsonar.projectKey=NorseDreki_dogcat | ||
-Dsonar.organization=norsedreki | ||
-Dsonar.inclusions=**/*.kt | ||
-Dsonar.language=kotlin | ||
run: ./gradlew assemble sonar --info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters