FMA - v3.1.2 #92
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
# Description | |
# =========== | |
# This workflow is triggered each time | |
# commits are pushed to GitHub or a pull request is opened. | |
# It launches three jobs in parallel : a build with java 8, | |
# a build with java 17 and a SonarCloud analysis. | |
--- | |
name: Java CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Java 17 CI | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Build with Maven | |
run: mvn -B clean test package | |
code-analysis: | |
runs-on: ubuntu-latest | |
name: SonarCloud Code Analysis | |
# It's not possible to launch an analysis on external pull requests | |
if: ${{ github.repository_owner == 'cnescatlab' }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Setup java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Build and analyze | |
env: | |
# Needed to get some information about the pull request, if any | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/ | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.organization=lequal -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN |