Skip to content

Commit

Permalink
Ajout CI & Sonar (#12)
Browse files Browse the repository at this point in the history
* atelier 3/auth(fix): utilisation interface repository

* atelier 3/all(feat): ajout sonar et jacoco pour code coverage

* atelier 3/all(ci): ajout ci build github actions

* atelier 3/all(fix-ci): ajout distribution jdk
  • Loading branch information
PowerPixel authored Jun 2, 2024
1 parent 8a5f567 commit a9f7a07
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and Test

on:
push:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

- name: Build with Maven
run: mvn clean install

- name: Test with Maven
run: mvn clean verify

- name: SonarQube Scan
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.projectKey=cpe-divers-cours_cpe-cours -Dsonar.coverage.jacoco.xmlReportPaths=$(pwd)/coverage-aggregate/target/site/jacoco-aggregate/jacoco.xml
2 changes: 2 additions & 0 deletions card-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.skip>true</sonar.skip>

</properties>

<dependencies>
Expand Down
1 change: 1 addition & 0 deletions card-fight/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<sonar.skip>true</sonar.skip>
</properties>
<dependencies>
<dependency>
Expand Down
1 change: 1 addition & 0 deletions card-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.skip>true</sonar.skip>
</properties>

<dependencies>
Expand Down
1 change: 1 addition & 0 deletions card-service-discovery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.skip>true</sonar.skip>
</properties>
<dependencies>
<dependency>
Expand Down
63 changes: 63 additions & 0 deletions coverage-aggregate/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0
SPDX-License-Identifier: EPL-2.0
Contributors:
Marc R. Hoffmann, Jan Wloka - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>cpe</groupId>
<artifactId>atelier3</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<groupId>cpe.atelier3</groupId>
<artifactId>report</artifactId>
<name>Aggregate Report</name>

<dependencies>
<dependency>
<groupId>cpe.atelier3</groupId>
<artifactId>market</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cpe.atelier3</groupId>
<artifactId>auth</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cpe.atelier3</groupId>
<artifactId>manager</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
37 changes: 37 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@
<module>card-commons</module>
<module>card-service-discovery</module>
<module>card-gateway</module>

<module>coverage-aggregate</module>
</modules>
<properties>
<java.version>17</java.version>
<sonar.organization>cpe-divers-cours</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.coverage.jacoco.xmlReportPaths>
coverage-aggregate/target/site/jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
</properties>
<dependencies>
<dependency>
Expand All @@ -34,4 +41,34 @@
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>post-integration-test</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
<configuration>
<formats>
<format>XML</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit a9f7a07

Please sign in to comment.