Skip to content

Commit 10c12f5

Browse files
Added changes
1 parent ba51c6c commit 10c12f5

File tree

4 files changed

+76
-22
lines changed

4 files changed

+76
-22
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v4
1616

17+
- name: Cache Maven packages
18+
uses: actions/cache@v3
19+
with:
20+
path: ~/.m2
21+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
22+
restore-keys: |
23+
${{ runner.os }}-maven-
24+
1725
- name: Set up Docker Compose
1826
run: docker compose version
1927

@@ -33,11 +41,25 @@ jobs:
3341
distribution: 'temurin'
3442
java-version: '21'
3543

36-
- name: Build with Maven
37-
run: mvn clean install
44+
- name: Build and run tests
45+
run: mvn verify
46+
47+
- name: Upload JaCoCo report
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: jacoco-report
51+
path: target/site/jacoco
52+
53+
- name: Upload JaCoCo coverage to Qlty Cloud
54+
uses: qltysh/qlty-action/coverage@v1
55+
with:
56+
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
57+
files: target/site/jacoco/jacoco.xml
3858

39-
- name: Run tests
40-
run: mvn test
4159

4260
- name: Run Checkstyle
43-
run: mvn checkstyle:check
61+
run: mvn checkstyle:check
62+
63+
- name: Tear down Docker Compose
64+
if: always()
65+
run: docker compose down

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![CI](https://github.com/irinakomarchenko/user-service/actions/workflows/ci.yml/badge.svg)
2+
13
# User Service Hibernate
24

35
**User Service Hibernate** — консольное Java-приложение для управления пользователями с помощью Hibernate и PostgreSQL.

pom.xml

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>myuserservice</groupId>
8-
<artifactId>user-service-hibernate</artifactId>
8+
<artifactId>user-service</artifactId>
99
<version>1.0-SNAPSHOT</version>
1010

1111
<properties>
@@ -45,10 +45,34 @@
4545
<version>5.10.2</version>
4646
<scope>test</scope>
4747
</dependency>
48+
49+
50+
<dependency>
51+
<groupId>org.mockito</groupId>
52+
<artifactId>mockito-core</artifactId>
53+
<version>5.11.0</version>
54+
<scope>test</scope>
55+
</dependency>
56+
57+
<dependency>
58+
<groupId>org.testcontainers</groupId>
59+
<artifactId>junit-jupiter</artifactId>
60+
<version>1.19.7</version>
61+
<scope>test</scope>
62+
</dependency>
63+
64+
<dependency>
65+
<groupId>org.testcontainers</groupId>
66+
<artifactId>postgresql</artifactId>
67+
<version>1.19.7</version>
68+
<scope>test</scope>
69+
</dependency>
70+
4871
</dependencies>
4972

5073
<build>
5174
<plugins>
75+
<!-- Checkstyle -->
5276
<plugin>
5377
<groupId>org.apache.maven.plugins</groupId>
5478
<artifactId>maven-checkstyle-plugin</artifactId>
@@ -64,7 +88,6 @@
6488
</executions>
6589
<configuration>
6690
<configLocation>google_checks.xml</configLocation>
67-
<encoding>UTF-8</encoding>
6891
<consoleOutput>true</consoleOutput>
6992
<failsOnError>true</failsOnError>
7093
<includeTestSourceDirectory>true</includeTestSourceDirectory>
@@ -74,21 +97,27 @@
7497
</sourceDirectories>
7598
</configuration>
7699
</plugin>
77-
</plugins>
78-
</build>
79-
80-
<reporting>
81-
<plugins>
100+
<!-- JaCoCo -->
82101
<plugin>
83-
<groupId>org.apache.maven.plugins</groupId>
84-
<artifactId>maven-checkstyle-plugin</artifactId>
85-
<version>3.3.1</version>
86-
<configuration>
87-
<configLocation>checkstyle/checkstyle.xml</configLocation>
88-
<encoding>UTF-8</encoding>
89-
<failsOnError>true</failsOnError>
90-
</configuration>
102+
<groupId>org.jacoco</groupId>
103+
<artifactId>jacoco-maven-plugin</artifactId>
104+
<version>0.8.11</version>
105+
<executions>
106+
<execution>
107+
<id>prepare-agent</id>
108+
<goals>
109+
<goal>prepare-agent</goal>
110+
</goals>
111+
</execution>
112+
<execution>
113+
<id>report</id>
114+
<phase>verify</phase>
115+
<goals>
116+
<goal>report</goal>
117+
</goals>
118+
</execution>
119+
</executions>
91120
</plugin>
92121
</plugins>
93-
</reporting>
94-
</project>
122+
</build>
123+
</project>

src/main/resources/checkstyle/checkstyle.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<module name="Indentation"/>
1313
<module name="WhitespaceAfter"/>
1414
<module name="WhitespaceAround"/>
15+
<module name="UnusedImports"/>
1516
</module>
1617
</module>

0 commit comments

Comments
 (0)