Skip to content

Commit b79ec84

Browse files
authored
Merge pull request #557 from xdev-software/develop
Release
2 parents bfd32a8 + 79eda52 commit b79ec84

49 files changed

Lines changed: 1477 additions & 219 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/run-integration-tests.yml

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,19 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
java: [21]
3130
project: [persistence-it, webapp-it]
3231
parallel: [0, 2]
3332
pre-start: [false, true]
33+
java: [21]
34+
include:
35+
- project: webapp-it
36+
jacoco: true
37+
video: true
38+
name: "run-integration-tests (${{matrix.project}}, ${{matrix.parallel}}, ${{matrix.pre-start}}, ${{matrix.java}})"
3439
runs-on: ubuntu-latest
3540
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }}
41+
permissions:
42+
checks: write # JaCoCo Coverage Report check
3643
steps:
3744
- uses: actions/checkout@v6
3845

@@ -55,21 +62,54 @@ jobs:
5562
run: |
5663
./mvnw -B test \
5764
-pl "advanced-demo/integration-tests/${{ matrix.project }}" -am \
58-
-P run-it \
65+
-P run-it${{ matrix.jacoco && ',jacoco' || '' }} \
5966
${{ matrix.pre-start && '-Dinfra-pre-start.enabled=1 ' || '' }} \
6067
${{ matrix.parallel > 0 && format('-Djunit.jupiter.execution.parallel.enabled=true -Djunit.jupiter.execution.parallel.mode.default=concurrent -Djunit.jupiter.execution.parallel.mode.classes.default=concurrent -Djunit.jupiter.execution.parallel.config.strategy=fixed -Djunit.jupiter.execution.parallel.config.fixed.parallelism=2 -Djunit.jupiter.execution.parallel.config.fixed.max-pool-size={0} ', matrix.parallel) || '' }}
6168
6269
# Replace '/' with '-'
6370
- name: Normalize project name
64-
if: failure()
6571
env:
6672
PROJECT: ${{ matrix.project }}
6773
run: echo PROJECT_NORMALIZED=${PROJECT/\//-} >> $GITHUB_ENV
6874

6975
- name: Upload videos of test failures
70-
if: failure()
76+
if: ${{ matrix.video && failure() }}
7177
uses: actions/upload-artifact@v6
7278
with:
7379
name: test-fail-videos-${{ matrix.java }}-${{ env.PROJECT_NORMALIZED }}-${{ matrix.parallel }}-${{ matrix.pre-start }}
7480
path: advanced-demo/integration-tests/${{ matrix.project }}/target/records
7581
if-no-files-found: ignore
82+
83+
- name: Aggregate WebApp JaCoCo report
84+
if: ${{ matrix.jacoco && !cancelled() }}
85+
# Important: Also run compile (if not already done) so that we have all class files - otherwise the report will be incomplete
86+
run: |
87+
./mvnw -B compile jacoco-aggregator:report-aggregate-all -pl "advanced-demo/webapp" -am -T2C
88+
89+
- name: Upload WebApp JaCoCo report
90+
if: ${{ matrix.jacoco && !cancelled() }}
91+
uses: actions/upload-artifact@v6
92+
with:
93+
name: webapp-jacoco-report-${{ matrix.java }}-${{ env.PROJECT_NORMALIZED }}-${{ matrix.parallel }}-${{ matrix.pre-start }}
94+
path: advanced-demo/target/site/jacoco-aggregate
95+
if-no-files-found: ignore
96+
97+
- name: WebApp JaCoCo Code Coverage Report
98+
if: ${{ matrix.jacoco && !cancelled() }}
99+
id: jacoco_reporter
100+
uses: PavanMudigonda/jacoco-reporter@4fc6bf270fe893e8dda5467e432253a6961345b8 # v5.0
101+
with:
102+
coverage_results_path: advanced-demo/target/site/jacoco-aggregate/jacoco.xml
103+
coverage_report_name: WebApp Coverage (${{matrix.parallel}}, ${{matrix.pre-start}}, ${{matrix.java}})
104+
coverage_report_title: JaCoCo
105+
github_token: ${{ secrets.GITHUB_TOKEN }}
106+
107+
- name: Add WebApp JaCoCo report to workflow run summary
108+
if: ${{ matrix.jacoco && !cancelled() }}
109+
run: |
110+
echo "| Outcome | Value |" >> $GITHUB_STEP_SUMMARY
111+
echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY
112+
echo "| Code Coverage % | ${{ steps.jacoco_reporter.outputs.coverage_percentage }} |" >> $GITHUB_STEP_SUMMARY
113+
echo "| :heavy_check_mark: Number of Lines Covered | ${{ steps.jacoco_reporter.outputs.covered_lines }} |" >> $GITHUB_STEP_SUMMARY
114+
echo "| :x: Number of Lines Missed | ${{ steps.jacoco_reporter.outputs.missed_lines }} |" >> $GITHUB_STEP_SUMMARY
115+
echo "| Total Number of Lines | ${{ steps.jacoco_reporter.outputs.total_lines }} |" >> $GITHUB_STEP_SUMMARY

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 3.2.0
2+
* New module: `jacoco`
3+
* Support recording Code Coverage files and extracting them from the corresponding containers
4+
* See the documentation of the module for more details
5+
* Deprecated `SeleniumRecordingExtension`
6+
* Use `SeleniumRecorder` and `FileSystemFriendlyName` instead
7+
18
# 3.1.0
29
* `EntityManagerController`
310
* Now always checks if the EntityManager is already closed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ Modules for XDEV's Testcontainer Infrastructure Framework
2020
* Data-generation template
2121
* Improved JDBC Container wait strategy
2222
* Predefined implementations for [Spring-ORM](./db-jdbc-spring-orm/) and [Hibernate](./db-jdbc-spring-orm-hibernate/)
23+
* [jacoco](./jacoco/)
24+
* Allows for recording of JaCoCo code coverage files with Java containers
2325
* [jul-to-slf4j](./jul-to-slf4j/)
2426
* Logging Adapter to redirect JUL to SLF4J
27+
* [junit-jupiter-api-support](./junit-jupiter-api-support/)
28+
* Support for JUnit 5+ (Jupiter) API
2529
* [mockserver](./mockserver/)
2630
* Predefined implementation for [Mockserver](https://github.com/xdev-software/mockserver-neolight)
2731
* [oidc-server-mock](./oidc-server-mock/)

advanced-demo/entities-metamodel/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.xdev.tci.demo</groupId>
99
<artifactId>advanced-demo</artifactId>
10-
<version>3.1.1-SNAPSHOT</version>
10+
<version>3.2.0-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>entities-metamodel</artifactId>
1313

advanced-demo/entities/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.xdev.tci.demo</groupId>
99
<artifactId>advanced-demo</artifactId>
10-
<version>3.1.1-SNAPSHOT</version>
10+
<version>3.2.0-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>entities</artifactId>
1313

advanced-demo/integration-tests/persistence-it/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.xdev.tci.demo.it</groupId>
99
<artifactId>integration-tests</artifactId>
10-
<version>3.1.1-SNAPSHOT</version>
10+
<version>3.2.0-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>persistence-it</artifactId>
1313

advanced-demo/integration-tests/pom.xml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<parent>
88
<groupId>software.xdev.tci.demo</groupId>
99
<artifactId>advanced-demo</artifactId>
10-
<version>3.1.1-SNAPSHOT</version>
10+
<version>3.2.0-SNAPSHOT</version>
1111
</parent>
1212

1313
<groupId>software.xdev.tci.demo.it</groupId>
1414
<artifactId>integration-tests</artifactId>
15-
<version>3.1.1-SNAPSHOT</version>
15+
<version>3.2.0-SNAPSHOT</version>
1616
<packaging>pom</packaging>
1717

1818
<modules>
@@ -28,13 +28,13 @@
2828
<dependency>
2929
<groupId>software.xdev.tci.demo.it</groupId>
3030
<artifactId>tci-db</artifactId>
31-
<version>3.1.1-SNAPSHOT</version>
31+
<version>3.2.0-SNAPSHOT</version>
3232
</dependency>
3333

3434
<dependency>
3535
<groupId>software.xdev.tci.demo.it</groupId>
3636
<artifactId>tci-webapp</artifactId>
37-
<version>3.1.1-SNAPSHOT</version>
37+
<version>3.2.0-SNAPSHOT</version>
3838
</dependency>
3939

4040
<dependency>
@@ -47,6 +47,11 @@
4747
<artifactId>db-jdbc-spring-orm-hibernate</artifactId>
4848
<version>${project.version}</version>
4949
</dependency>
50+
<dependency>
51+
<groupId>software.xdev.tci</groupId>
52+
<artifactId>jacoco</artifactId>
53+
<version>${project.version}</version>
54+
</dependency>
5055
<dependency>
5156
<groupId>software.xdev.tci</groupId>
5257
<artifactId>oidc-server-mock</artifactId>
@@ -67,7 +72,7 @@
6772
<dependency>
6873
<groupId>org.seleniumhq.selenium</groupId>
6974
<artifactId>selenium-dependencies-bom</artifactId>
70-
<version>4.40.0</version>
75+
<version>4.41.0</version>
7176
<type>pom</type>
7277
<scope>import</scope>
7378
</dependency>
@@ -84,7 +89,7 @@
8489
<dependency>
8590
<groupId>org.junit</groupId>
8691
<artifactId>junit-bom</artifactId>
87-
<version>6.0.2</version>
92+
<version>6.0.3</version>
8893
<type>pom</type>
8994
<scope>import</scope>
9095
</dependency>

advanced-demo/integration-tests/tci-db/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.xdev.tci.demo.it</groupId>
99
<artifactId>integration-tests</artifactId>
10-
<version>3.1.1-SNAPSHOT</version>
10+
<version>3.2.0-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>tci-db</artifactId>
1313

advanced-demo/integration-tests/tci-webapp/Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ RUN mv webapp/target/webapp.jar app.jar \
7474

7575
FROM jre-minimized
7676

77+
ARG JACOCO_AGENT_ENABLED
78+
ARG JACOCO_AGENT_VERSION="0.8.14"
79+
7780
ARG user=app
7881
ARG group=app
7982
ARG uid=1000
@@ -84,7 +87,13 @@ ARG APP_DIR=/opt/app
8487
RUN mkdir -p ${APP_DIR} \
8588
&& chown ${uid}:${gid} ${APP_DIR} \
8689
&& addgroup -g ${gid} ${group} \
87-
&& adduser -h "$APP_DIR" -u ${uid} -G ${group} -s /bin/bash -D ${user}
90+
&& adduser -h "$APP_DIR" -u ${uid} -G ${group} -s /bin/bash -D ${user}; \
91+
# Download JaCoCoAgent if required
92+
if [ "$JACOCO_AGENT_ENABLED" = "1" ]; then \
93+
mkdir -p /jacoco/report \
94+
&& chown $uid:$gid /jacoco/report \
95+
&& wget https://repo.maven.apache.org/maven2/org/jacoco/org.jacoco.agent/$JACOCO_AGENT_VERSION/org.jacoco.agent-$JACOCO_AGENT_VERSION-runtime.jar -O /jacoco/agent.jar; \
96+
fi
8897

8998
WORKDIR ${APP_DIR}
9099

@@ -101,8 +110,9 @@ COPY --from=builder --chown=${user}:${group} /builder/extracted/snapshot-depende
101110
RUN true
102111
COPY --from=builder --chown=${user}:${group} /builder/extracted/application/ ./
103112

113+
ENV JAVA_JACOCO_OPTS=${JACOCO_AGENT_ENABLED:+"-javaagent:/jacoco/agent.jar=destfile=/jacoco/report/jacoco.exec"}
104114
ENV JAVA_OPTS="-XX:MaxRAMPercentage=75 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=30 -Djava.awt.headless=true"
105115

106116
EXPOSE 8080
107117

108-
CMD [ "/bin/sh", "-c", "java $JAVA_OPTS -jar /opt/app/app.jar" ]
118+
CMD [ "/bin/sh", "-c", "java $JAVA_OPTS $JAVA_JACOCO_OPTS -jar /opt/app/app.jar" ]

advanced-demo/integration-tests/tci-webapp/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.xdev.tci.demo.it</groupId>
99
<artifactId>integration-tests</artifactId>
10-
<version>3.1.1-SNAPSHOT</version>
10+
<version>3.2.0-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>tci-webapp</artifactId>
1313

@@ -16,6 +16,10 @@
1616
<groupId>software.xdev.tci</groupId>
1717
<artifactId>base</artifactId>
1818
</dependency>
19+
<dependency>
20+
<groupId>software.xdev.tci</groupId>
21+
<artifactId>jacoco</artifactId>
22+
</dependency>
1923
<dependency>
2024
<groupId>software.xdev</groupId>
2125
<artifactId>testcontainers-advanced-imagebuilder</artifactId>

0 commit comments

Comments
 (0)