SongodaCore/.github/workflows/sonarcloud.yml

49 lines
1.3 KiB
YAML

name: SonarCloud
on:
push:
branches: [ master, development ]
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
# Checkout project files
- uses: actions/checkout@v2
if: ${{ env.SONAR_TOKEN != null }}
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
# Setup Java
- uses: actions/setup-java@v2
if: ${{ env.SONAR_TOKEN != null }}
with:
java-version: 17
distribution: adopt
cache: maven
# Cache
- name: 'Cache: SonarCloud'
if: ${{ env.SONAR_TOKEN != null }}
uses: actions/cache@v2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
# Build remapped Spigot versions
- uses: SpraxDev/Action-SpigotMC@v4
with:
versions: 1.18, 1.18.2, 1.19, 1.19.2, 1.19.3, 1.19.4
remapped: true
- name: Analyze project
if: ${{ env.SONAR_TOKEN != null }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=songoda_SongodaCore
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any