Skip to content

Process Listener API #362

Process Listener API

Process Listener API #362

name: Sonar
on:
push:
paths-ignore:
- publiccode.yml
branches:
- master
- develop
pull_request:
types:
- opened
- reopened
- synchronize
# The branches below must be a subset of the branches above
branches:
- master
- develop
env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Install ffmpeg on Ubuntu
run: sudo apt-get update && sudo apt-get install -y ffmpeg && ffmpeg -version
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- uses: actions/cache@v4
with:
# be careful not to include ~/.m2/settings.xml which contains credentials
path: |
~/.m2/repository
~/.m2/wrapper
key: release-m2-${{ hashFiles('**/pom.xml', '.mvn/*.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.SONAR_TOKEN }}
run: |
if [ -n "$SONAR_TOKEN" ]
then
bash mvnw -B jacoco:prepare-agent verify jacoco:report sonar:sonar
else
echo "Skipping sonar if a PR is created from a fork"
echo "Secrets are not available in such PRs for security reason"
fi