blob: ac020aecdc6cd42bcbebd47175b36af1bd29767a [file] [log] [blame]
# ~ Licensed to the Apache Software Foundation (ASF) under one
# ~ or more contributor license agreements. See the NOTICE file
# ~ distributed with this work for additional information
# ~ regarding copyright ownership. The ASF licenses this file
# ~ to you under the Apache License, Version 2.0 (the
# ~ "License"); you may not use this file except in compliance
# ~ with the License. You may obtain a copy of the License at
# ~
# ~ http://www.apache.org/licenses/LICENSE-2.0
# ~
# ~ Unless required by applicable law or agreed to in writing,
# ~ software distributed under the License is distributed on an
# ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# ~ KIND, either express or implied. See the License for the
# ~ specific language governing permissions and limitations
# ~ under the License.
name: SonarCloud
on:
push:
branches:
- trunk
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.3.0
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v3.10.0
with:
java-version: 11
distribution: temurin
- name: Cache SonarCloud packages
uses: actions/cache@v3.2.6
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3.2.6
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
if: ${{ env.SONAR_TOKEN != '' }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage -Dsonar.projectKey=org.apache.jackrabbit:jackrabbit-oak -Dsonar.organization=apache