Skip to content

Commit

Permalink
22706 cli testcontainers configuration improvements (#25963)
Browse files Browse the repository at this point in the history
* #22706 Excluding integration tests of surefire plugin.

* #22706 Fixing cli tests reporting status (error cases).

* #22706 Building CORE docker image for current commit before running cli testcontainers tests.

* #22706 Fixing build image docker stage on GHA

* #22706 Fixing docker build stage on GHA.

* #22706 Fix on checking for test failures and errors.

* #22706 Removing surefire plugin.

* #22706 Enabling cache on the docker image build step.

* #22706 Updating CLI GHA triggers.

---------

Co-authored-by: daniel.colina <[email protected]>
  • Loading branch information
dcolina and dcolina authored Sep 6, 2023
1 parent f3061a2 commit 49ab573
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 49 deletions.
84 changes: 74 additions & 10 deletions .github/workflows/cli-cicd-test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
name: CLI tests
on:
pull_request:
paths:
- 'tools/dotcms-cli/**'
workflow_dispatch:
inputs:
docker_build_cache:
description: 'Docker build cache'
default: 'false'
docker_build_push:
description: 'Docker build push'
default: 'false'
push:
branches:
- master
- release-*
paths-ignore:
- '.gitignore'
- '.dockerignore'
- 'dotCMS/src/main/webapp/html'
- '!docker/**'
- 'cicd/**'
- '.cicd/**'
- '*.md'
- '*.adoc'
- '*.txt'
- '.github/ISSUE_TEMPLATE/**'
pull_request:
paths-ignore:
- '.gitignore'
- '.dockerignore'
- 'dotCMS/src/main/webapp/html'
- '!docker/**'
- 'cicd/**'
- '.cicd/**'
- '*.md'
- '*.adoc'
- '*.txt'
- '.github/ISSUE_TEMPLATE/**'
jobs:
cli_tests:
name: CLI tests
Expand All @@ -19,6 +47,44 @@ jobs:
- id: checkout-core
name: Checkout core
uses: actions/checkout@v3

-
id: meta
name: Docker meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
dotcms/dotcms
# generate Docker tags based on the following events/attributes
tags: |
type=sha,enable=true,priority=100,prefix=master_,suffix=_SNAPSHOT,format=short
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
push: ${{ github.event.inputs.docker_build_push || 'false' }}
context: docker/dotcms
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
pull: true
no-cache: ${{ github.event.inputs.docker_build_cache || 'false' }}
build-args: |
BUILD_ID=${{ github.head_ref }}
BUILD_FROM=COMMIT
- id: prepare-license
name: Prepare license
working-directory: ./tools/dotcms-cli/
Expand Down Expand Up @@ -49,16 +115,17 @@ jobs:
./mvnw clean verify -Dtest.failure.ignore=true
FAILURES=$(find . -name TEST-*.xml | xargs grep '<failure' | wc -l)
ERRORS=$(find . -name TEST-*.xml | xargs grep '<error' | wc -l)
if [ $FAILURES -eq 0 ]; then
if [[ $FAILURES -eq 0 && $ERRORS -eq 0 ]]; then
OUTPUT_STATUS="PASSED"
else
OUTPUT_STATUS="FAILED"
fi
echo "status=$OUTPUT_STATUS" >> $GITHUB_OUTPUT
./mvnw surefire-report:report-only surefire-report:failsafe-report-only
./mvnw surefire-report:failsafe-report-only
DOT_CLI_PATH=${{ github.workspace }}/tools/dotcms-cli
RESULTS_PATH=${DOT_CLI_PATH}/target/test-results
Expand All @@ -76,15 +143,12 @@ jobs:
for module in $MODULES
do
mkdir -p ${XML_REPORTS_PATH}/${module}
cp -r ${module}/target/surefire-reports ${XML_REPORTS_PATH}/${module}
cp -r ${module}/target/failsafe-reports ${XML_REPORTS_PATH}/${module}
mkdir -p ${HTML_REPORTS_PATH}/${module}
cp -r ${module}/target/site/* ${HTML_REPORTS_PATH}/${module}
echo "<tr><td>${module}</td><td><a href=\"${module}/failsafe-report.html\">failsafe report</a></td></tr>" >> ${INDEX_FILE}
for report in surefire failsafe
do
echo "<tr><td>${module}</td><td><a href=\"${module}/${report}-report.html\">${report} report</a></td></tr>" >> ${INDEX_FILE}
done
done
cat ${CICD_RES_PATH}/cli/cli-results-footer.html >> ${INDEX_FILE}
Expand Down
23 changes: 4 additions & 19 deletions tools/dotcms-cli/api-data-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>2.9.1.Final</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<testcontainers.version>1.17.6</testcontainers.version>
<skip.surefire.tests>false</skip.surefire.tests>
<skip.failsafe.tests>false</skip.failsafe.tests>
<failsafe-plugin.version>3.0.0-M5</failsafe-plugin.version>
<test.failure.ignore>false</test.failure.ignore>
<maven.plugin.jar.version>3.3.0</maven.plugin.jar.version>
</properties>
Expand Down Expand Up @@ -147,27 +145,14 @@
<forceJavacCompilerUse>true</forceJavacCompilerUse>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<testFailureIgnore>${test.failure.ignore}</testFailureIgnore>
<skipTests>${skip.surefire.tests}</skipTests>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>${failsafe-plugin.version}</version>
<configuration>
<testFailureIgnore>${test.failure.ignore}</testFailureIgnore>
<skipTests>${skip.failsafe.tests}</skipTests>
<includes>
<include>**/*IntegrationTest.java</include>
<include>**/*Test.java</include>
</includes>
</configuration>
<executions>
Expand Down Expand Up @@ -213,7 +198,7 @@
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>${failsafe-plugin.version}</version>
<executions>
<execution>
<goals>
Expand Down
21 changes: 3 additions & 18 deletions tools/dotcms-cli/cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>2.9.1.Final</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<testcontainers.version>1.17.6</testcontainers.version>
<skip.surefire.tests>false</skip.surefire.tests>
<skip.failsafe.tests>false</skip.failsafe.tests>
<failsafe-plugin.version>3.0.0-M5</failsafe-plugin.version>
<test.failure.ignore>false</test.failure.ignore>
</properties>
<dependencyManagement>
Expand Down Expand Up @@ -133,27 +131,14 @@
<forceJavacCompilerUse>true</forceJavacCompilerUse>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<testFailureIgnore>${test.failure.ignore}</testFailureIgnore>
<skipTests>${skip.surefire.tests}</skipTests>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>${failsafe-plugin.version}</version>
<configuration>
<testFailureIgnore>${test.failure.ignore}</testFailureIgnore>
<skipTests>${skip.failsafe.tests}</skipTests>
<includes>
<include>**/*IntegrationTest.java</include>
<include>**/*Test.java</include>
</includes>
</configuration>
<executions>
Expand Down
4 changes: 2 additions & 2 deletions tools/dotcms-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>2.9.1.Final</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<failsafe-plugin.version>3.0.0-M5</failsafe-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
Expand All @@ -43,7 +43,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>${failsafe-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down

0 comments on commit 49ab573

Please sign in to comment.