Skip to content

Commit

Permalink
Merge pull request #213 from InseeFr/GtanSndil-patch-1
Browse files Browse the repository at this point in the history
Update build.yaml
  • Loading branch information
EmmanuelDemey authored Dec 12, 2024
2 parents 7318f8c + 7fd4970 commit 43e4f38
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ jobs:
name: app-jar
path: target/*.jar

- name: Run Sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage

docker:
needs:
- check-version
Expand All @@ -82,4 +88,4 @@ jobs:
name: inseefr/magma-back-office
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
tags: "latest, ${{ needs.check-version.outputs.release-version }}"
tags: "latest, ${{ needs.check-version.outputs.release-version }}"
39 changes: 39 additions & 0 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test and Sonar Analysis
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
jobs:
test-build:
name: build & test & 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: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Run unit tests
run: mvn -B clean test
- name: Run Sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -X -B clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<rdf4j.version>5.0.0-M3</rdf4j.version>
<springdoc.version>2.3.0</springdoc.version>
<jacoco.version>0.8.12</jacoco.version>

<sonar.organization>inseefr</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.projectKey>InseeFr_Magma</sonar.projectKey>
</properties>

<dependencies>
Expand Down

0 comments on commit 43e4f38

Please sign in to comment.