Skip to content

Commit

Permalink
Merge pull request #5 from xdev-software/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
AB-xdev committed May 6, 2024
2 parents 80ca591 + c1e2676 commit 0f24164
Show file tree
Hide file tree
Showing 179 changed files with 33,754 additions and 159 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/checkBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ on:

env:
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo

jobs:
build:
Expand All @@ -43,7 +42,7 @@ jobs:
cache: 'maven'

- name: Build with Maven
run: ./mvnw -B clean package
run: ./mvnw -B clean package -P ignore-service-loading

- name: Check for uncommited changes
run: |
Expand All @@ -63,13 +62,6 @@ jobs:
exit 1
fi
- name: Upload demo files
uses: actions/upload-artifact@v4
with:
name: demo-files-java-${{ matrix.java }}
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
if-no-files-found: error

code-style:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
cache: 'maven'

- name: Build with Maven
run: ./mvnw -B clean package
run: ./mvnw -B clean package -P ignore-service-loading

- name: Check for uncommited changes
run: |
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/run-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Run integration tests

on:
workflow_dispatch:
push:
branches: [ develop ]
paths-ignore:
- '**.md'
- '.config/**'
- '.github/**'
- '.idea/**'
- 'assets/**'
pull_request:
branches: [ develop ]
paths-ignore:
- '**.md'
- '.config/**'
- '.github/**'
- '.idea/**'
- 'assets/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
run-integration-tests:
strategy:
fail-fast: false
matrix:
java: [17, 21]
project: [persistence-it, webapp-it]
parallel: [0, 2]
pre-start: [false, true]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: 'maven'

- name: Test
run: |
./mvnw -B test \
-pl "tci-advanced-demo/${{ matrix.project }}" -am \
-P run-it \
${{ matrix.pre-start && '-Dinfra-pre-start.enabled=1 ' || '' }} \
${{ 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) || '' }}
# Replace '/' with '-'
- name: Normalize project name
if: failure()
env:
PROJECT: ${{ matrix.project }}
run: echo PROJECT_NORMALIZED=${PROJECT/\//-} >> $GITHUB_ENV

- name: Upload videos of test failures
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-fail-videos-${{ matrix.java }}-${{ env.PROJECT_NORMALIZED }}-${{ matrix.parallel }}-${{ matrix.pre-start }}
path: ${{ matrix.project }}/target/records
if-no-files-found: ignore
12 changes: 12 additions & 0 deletions .run/All in persistence-it.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All in persistence-it" type="JUnit" factoryName="JUnit" nameIsGenerated="true">
<module name="persistence-it" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
13 changes: 13 additions & 0 deletions .run/All in webapp-it (p=2 + PreStart).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All in webapp-it (p=2 + PreStart)" type="JUnit" factoryName="JUnit">
<module name="webapp-it" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -Dinfra-pre-start.enabled=1 -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=2" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
13 changes: 13 additions & 0 deletions .run/All in webapp-it (p=2).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All in webapp-it (p=2)" type="JUnit" factoryName="JUnit">
<module name="webapp-it" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -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=2" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
12 changes: 12 additions & 0 deletions .run/All in webapp-it.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All in webapp-it" type="JUnit" factoryName="JUnit" nameIsGenerated="true">
<module name="webapp-it" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
9 changes: 9 additions & 0 deletions .run/Demo Application.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Demo Application" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="software.xdev.tci.demo.Application" />
<module name="webapp" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
16 changes: 0 additions & 16 deletions .run/Run Demo.run.xml

This file was deleted.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 1.0.0
_Initial release_
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ You should have the following things installed:
* Ensure that the JDK/Java-Version is correct


## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/release.yml?branch=master)](https://github.com/xdev-software/template-placeholder/actions/workflows/release.yml)
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/tci-base/release.yml?branch=master)](https://github.com/xdev-software/tci-base/actions/workflows/release.yml)

Before releasing:
* Consider doing a [test-deployment](https://github.com/xdev-software/template-placeholder/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
* Consider doing a [test-deployment](https://github.com/xdev-software/tci-base/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
* Check the [changelog](CHANGELOG.md)

If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes
Expand Down
34 changes: 34 additions & 0 deletions PERFORMANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Performance

## PreStarting Comparison
_As of: 2024-05-03_

> [!NOTE]
> PreStarting performance is highly situational.<br/>
> Checkout the JavaDocs for more information.
### Initial situation

* Running the demo webapp integration tests
* Parallelization (tests executed in parallel) is 2
* Launched using the launch files in the demo

#### Environment
* Windows + Docker Desktop
* Ryzen 3700X 8C/16T @3.6GHz
* 32GB available RAM for Docker

### Results

| | Without PreStarting | With PreStarting |
| --- | --- | --- |
| Total duration | 3m 22s | 2m 34s |
| Average duration per test | 25s | 20s |
| PreStarting Utilization<br/>(how often was PreStarted infrastructure used instead of directly booting it) | - | >90% |
| Avg. time to get basic infra (db, oidc, app) | 10s | 9s |
| Avg. time to get Selenium/WebDriver | 7s | 1s |
| Resource utilization | ![graphic](./assets/PERF-WEBAPP-DEMO_P2.png) | ![graphic](./assets/PERF-WEBAPP-DEMO_P2_PRESTART.png) |

## Live

A live comparison using [GitHub actions is also available](https://github.com/xdev-software/tci-base/actions/workflows/run-integration-tests.yml).
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/checkBuild.yml?branch=develop)](https://github.com/xdev-software/template-placeholder/actions/workflows/checkBuild.yml?query=branch%3Adevelop)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_template-placeholder&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_template-placeholder)
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/tci-base?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/tci-base)
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/tci-base/checkBuild.yml?branch=develop)](https://github.com/xdev-software/tci-base/actions/workflows/checkBuild.yml?query=branch%3Adevelop)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_tci-base&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_tci-base)

# template-placeholder
# <img src="./assets/logo.png" height=28 > Testcontainers Infrastructure (TCI) Framework Base

Basis Module for XDEV's Testcontainer Infrastructure Framework

## Features
* Easily create infrastructure using - TCI (TestContainer Infrastructure) templating + Factories for that
* [PreStarting mechanism](./tci-base/src/main/java/software/xdev/tci/factory/prestart/) for [additional performance](./PERFORMANCE.md)
* An optimized [implementation of Network](./tci-base/src/main/java/software/xdev/tci/network/)
* [Safe starting of named containers](./tci-base/src/main/java/software/xdev/tci/safestart/)
* [Container Leak detection](./tci-base/src/main/java/software/xdev/tci/leakdetection/)
* [Tracing](./tci-base/src/main/java/software/xdev/tci/tracing/)

## Usage
This module has many different components that can be used in different situations in different ways.

Checkout the [advanced demo](./tci-advanced-demo/) as a reference to get a feeling how this can be done.

> [!TIP]
> More detailed documentation is usually available in the corresponding JavaDocs.
## Installation
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
[Installation guide for the latest release](https://github.com/xdev-software/tci-base/releases/latest#Installation)

## Support
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
Expand All @@ -15,4 +32,4 @@ If you need support as soon as possible and you can't wait for any pull request,
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.

## Dependencies and Licenses
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/tci-base/dependencies)
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Reporting a Vulnerability

Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/tci-base/security/advisories/new).
Binary file added assets/PERF-WEBAPP-DEMO_P2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/PERF-WEBAPP-DEMO_P2_PRESTART.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>software.xdev</groupId>
<artifactId>template-placeholder-root</artifactId>
<artifactId>tci-base-root</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

Expand All @@ -15,8 +15,8 @@
</organization>

<modules>
<module>template-placeholder</module>
<module>template-placeholder-demo</module>
<module>tci-base</module>
<module>tci-advanced-demo</module>
</modules>

<licenses>
Expand Down
30 changes: 28 additions & 2 deletions renovate.json5
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"rebaseWhen": "behind-base-branch"
}
"rebaseWhen": "behind-base-branch",
"packageRules": [
{
"description": "Ignore dependencies for JDK8",
"packagePattern": "^org.bsc.maven:maven-processor-plugin",
"datasources": [
"maven"
],
"allowedVersions": "!/jdk8$/"
},
{
"description": "Java LTS 21",
"packagePattern": "^eclipse-temurin",
"datasources": [
"docker"
],
"allowedVersions": "/^21\\-alpine$/"
},
{
"description": "MariaDB 11 has no LTS and is experimental",
"packagePattern": "^mariadb",
"datasources": [
"docker"
],
"allowedVersions": "<11"
}
]
}
11 changes: 11 additions & 0 deletions tci-advanced-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Advanced TCI Demo

This demo is a reference implementation for TCI.

It represents a Spring Boot Application with a Database and OIDC authentication that is tested using Selenium.
There are also test that validate the database migrations and queries.

The most interesting project is probably [webapp-it](./webapp-it/) which contains the integration tests for the WebApp.

> [!TIP]
> Pre defined launchers exist for running the app and the integration tests.
2 changes: 2 additions & 0 deletions tci-advanced-demo/_dev_infra/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
db.env
oidc-user-config.json
Loading

0 comments on commit 0f24164

Please sign in to comment.