Skip to content

Increases CI Speed #874

Increases CI Speed

Increases CI Speed #874

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
pull_request:
branches: [ main ]
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '.github/CODE_OF_CONDUCT.md'
- '.github/CODING_CONVENTIONS.md'
- '.github/CONTRIBUTING.md'
- '.github/dependabot.yml'
- '.github/pull_request_template.md'
- '.github/SECURITY.md'
- 'docs/**'
- 'examples/**'
- 'README.md'
- '.gitattributes'
- '.gitignore'
- 'LICENSE'
- 'NOTICE'
env:
VERSION: 2.0.0-SNAPSHOT
jobs:
build-test-aas-repository:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build AAS Repository Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasrepository.component"
- name: Test AAS Repository Docker Image
run: |
docker run -d --name test_aas_repository test/aas-repository:${VERSION}
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_aas_repository)" == "healthy" ]; then
echo "AAS Repository started successfully and is healthy."
break
else
echo "Waiting for AAS Repository to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "AAS Repository failed to start or is unhealthy after 2 minutes."
docker logs test_aas_repository
exit 1
fi
# Stop and remove the container after testing
docker stop test_aas_repository
docker rm test_aas_repository
- name: Clean up
run: exit 0
build-test-aas-environment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build AAS Environment Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasenvironment.component"
- name: Test AAS Environment Docker Image
run: |
docker run -d --name test_aas_environment test/aas-environment:${VERSION}
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_aas_environment)" == "healthy" ]; then
echo "AAS Environment started successfully and is healthy."
break
else
echo "Waiting for AAS Environment to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "AAS Environment failed to start or is unhealthy after 2 minutes."
docker logs test_aas_environment
exit 1
fi
# Stop and remove the container after testing
docker stop test_aas_environment
docker rm test_aas_environment
- name: Clean up
run: exit 0
build-test-concept-description-repository:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build Concept Description Repository Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.conceptdescriptionrepository.component"
- name: Test Concept Description Repository Docker Image
run: |
docker run -d --name test_conceptdescription_repository test/conceptdescription-repository:${VERSION}
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_conceptdescription_repository)" == "healthy" ]; then
echo "Concept Description Repository started successfully and is healthy."
break
else
echo "Waiting for Concept Description Repository to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "Concept Description Repository failed to start or is unhealthy after 2 minutes."
docker logs test_conceptdescription_repository
exit 1
fi
# Stop and remove the container after testing
docker stop test_conceptdescription_repository
docker rm test_conceptdescription_repository
- name: Clean up
run: exit 0
build-test-aas-discovery:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build AAS Discovery Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasdiscoveryservice.component"
- name: Test AAS Discovery Docker Image
run: |
docker run -d --name test_aas_discovery test/aas-discovery:${VERSION}
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_aas_discovery)" == "healthy" ]; then
echo "AAS Discovery started successfully and is healthy."
break
else
echo "Waiting for AAS Discovery to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "AAS Discovery failed to start or is unhealthy after 2 minutes."
docker logs test_aas_discovery
exit 1
fi
# Stop and remove the container after testing
docker stop test_aas_discovery
docker rm test_aas_discovery
- name: Clean up
run: exit 0
build-test-aasx-fileserver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build AASX File Server Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasxfileserver.component"
- name: Test AASX File Server Docker Image
run: |
docker run -d --name test_aasxfileserver test/aasxfileserver:${VERSION}
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_aasxfileserver)" == "healthy" ]; then
echo "AASX File Server started successfully and is healthy."
break
else
echo "Waiting for AASX File Server to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "AASX File Server failed to start or is unhealthy after 2 minutes."
docker logs test_aasxfileserver
exit 1
fi
# Stop and remove the container after testing
docker stop test_aasxfileserver
docker rm test_aasxfileserver
- name: Clean up
run: exit 0
build-test-submodel-repository:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build Submodel Repository Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelrepository.component"
- name: Test Submodel Repository Docker Image
run: |
docker run -p 8081:8081 -d --name test_submodel_repository test/submodel-repository:${VERSION}
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_submodel_repository)" == "healthy" ]; then
echo "Submodel Repository started successfully and is healthy."
break
else
echo "Waiting for Submodel Repository to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "Submodel Repository failed to start or is unhealthy after 2 minutes."
docker logs test_submodel_repository
exit 1
fi
# Stop and remove the container after testing
docker stop test_submodel_repository
docker rm test_submodel_repository
- name: Clean up
run: exit 0
build-test-submodel-service:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build Submodel Service Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelservice.example"
- name: Test Submodel Service Docker Image
run: |
docker run -d --name test_submodel_service test/submodel-service:${VERSION}
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_submodel_service)" == "healthy" ]; then
echo "Submodel Service started successfully and is healthy."
break
else
echo "Waiting for Submodel Service to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "Submodel Service failed to start or is unhealthy after 2 minutes."
docker logs test_submodel_service
exit 1
fi
# Stop and remove the container after testing
docker stop test_submodel_service
docker rm test_submodel_service
- name: Clean up
run: exit 0
build-test-aas-registry-kafka-mem:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build AAS Registry Kafka Mem Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasregistry-service-release-kafka-mem"
- name: Test AAS Registry Kafka Mem Docker Image
run: |
docker compose --project-directory ./ci -f ./ci/test-aas-registry-kafka-mem.yml up -d
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_aas_registry_kafka_mem)" == "healthy" ]; then
echo "AAS Registry Kafka Mem started successfully and is healthy."
break
else
echo "Waiting for AAS Registry Kafka Mem to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "AAS Registry Kafka Mem failed to start or is unhealthy after 2 minutes."
docker logs test_aas_registry_kafka_mem
exit 1
fi
# Stop and remove the container after testing
docker stop test_aas_registry_kafka_mem
docker rm test_aas_registry_kafka_mem
- name: Clean up
run: exit 0
build-test-aas-registry-kafka-mongodb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build AAS Registry Kafka MongoDB Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasregistry-service-release-kafka-mongodb"
- name: Test AAS Registry Kafka MongoDB Docker Image
run: |
docker compose --project-directory ./ci -f ./ci/test-aas-registry-kafka-mongodb.yml up -d
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_aas_registry_kafka_mongodb)" == "healthy" ]; then
echo "AAS Registry Kafka MongoDB started successfully and is healthy."
break
else
echo "Waiting for AAS Registry Kafka MongoDB to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "AAS Registry Kafka MongoDB failed to start or is unhealthy after 2 minutes."
docker logs test_aas_registry_kafka_mongodb
exit 1
fi
# Stop and remove the container after testing
docker stop test_aas_registry_kafka_mongodb
docker rm test_aas_registry_kafka_mongodb
- name: Clean up
run: exit 0
build-test-aas-registry-log-mem:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build AAS Registry Log Mem Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasregistry-service-release-log-mem"
- name: Test AAS Registry Log Mem Docker Image
run: |
docker run -d --name test_aas_registry_log_mem test/aas-registry-log-mem:${VERSION}
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_aas_registry_log_mem)" == "healthy" ]; then
echo "AAS Registry Log Mem started successfully and is healthy."
break
else
echo "Waiting for AAS Registry Log Mem to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "AAS Registry Log Mem failed to start or is unhealthy after 2 minutes."
docker logs test_aas_registry_log_mem
exit 1
fi
# Stop and remove the container after testing
docker stop test_aas_registry_log_mem
docker rm test_aas_registry_log_mem
- name: Clean up
run: exit 0
build-test-aas-registry-log-mongodb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build AAS Registry Log MongoDB Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasregistry-service-release-log-mongodb"
- name: Test AAS Registry Log MongoDB Docker Image
run: |
docker compose --project-directory ./ci -f ./ci/test-aas-registry-log-mongodb.yml up -d
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_aas_registry_log_mongodb)" == "healthy" ]; then
echo "AAS Registry Log MongoDB started successfully and is healthy."
break
else
echo "Waiting for AAS Registry Log MongoDB to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "AAS Registry Log MongoDB failed to start or is unhealthy after 2 minutes."
docker logs test_aas_registry_log_mongodb
exit 1
fi
# Stop and remove the container after testing
docker stop test_aas_registry_log_mongodb
docker rm test_aas_registry_log_mongodb
- name: Clean up
run: exit 0
build-test-submodel-registry-kafka-mem:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build Submodel Registry Kafka Mem Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelregistry-service-release-kafka-mem"
- name: Test Submodel Registry Kafka Mem Docker Image
run: |
docker compose --project-directory ./ci -f ./ci/test-submodel-registry-kafka-mem.yml up -d
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_submodel_registry_kafka_mem)" == "healthy" ]; then
echo "Submodel Registry Kafka Mem started successfully and is healthy."
break
else
echo "Waiting for Submodel Registry Kafka Mem to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "Submodel Registry Kafka Mem failed to start or is unhealthy after 2 minutes."
docker logs test_submodel_registry_kafka_mem
exit 1
fi
# Stop and remove the container after testing
docker stop test_submodel_registry_kafka_mem
docker rm test_submodel_registry_kafka_mem
- name: Clean up
run: exit 0
build-test-submodel-registry-kafka-mongodb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build Submodel Registry Kafka MongoDB Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelregistry-service-release-kafka-mongodb"
- name: Test Submodel Registry Kafka MongoDB Docker Image
run: |
docker compose --project-directory ./ci -f ./ci/test-submodel-registry-kafka-mongodb.yml up -d
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_submodel_registry_kafka_mongodb)" == "healthy" ]; then
echo "Submodel Registry Kafka MongoDB started successfully and is healthy."
break
else
echo "Waiting for Submodel Registry Kafka MongoDB to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "Submodel Registry Kafka MongoDB failed to start or is unhealthy after 2 minutes."
docker logs test_submodel_registry_kafka_mongodb
exit 1
fi
# Stop and remove the container after testing
docker stop test_submodel_registry_kafka_mongodb
docker rm test_submodel_registry_kafka_mongodb
- name: Clean up
run: exit 0
build-test-submodel-registry-log-mem:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build Submodel Registry Log Mem Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelregistry-service-release-log-mem"
- name: Test Submodel Registry Log Mem Docker Image
run: |
docker run -d --name test_submodel_registry_log_mem test/submodel-registry-log-mem:${VERSION}
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_submodel_registry_log_mem)" == "healthy" ]; then
echo "Submodel Registry Log Mem started successfully and is healthy."
break
else
echo "Waiting for Submodel Registry Log Mem to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "Submodel Registry Log Mem failed to start or is unhealthy after 2 minutes."
docker logs test_submodel_registry_log_mem
exit 1
fi
# Stop and remove the container after testing
docker stop test_submodel_registry_log_mem
docker rm test_submodel_registry_log_mem
- name: Clean up
run: exit 0
build-test-submodel-registry-log-mongodb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build Submodel Registry Log MongoDB Docker Image
run: |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelregistry-service-release-log-mongodb"
- name: Test Submodel Registry Log MongoDB Docker Image
run: |
docker compose --project-directory ./ci -f ./ci/test-submodel-registry-log-mongodb.yml up -d
# Initialize variables
max_checks=24 # 2 minutes total (120 seconds / 5 seconds per check)
sleep_interval=5 # Interval in seconds between checks
check_count=0
# Loop to check health status
while [ $check_count -lt $max_checks ]; do
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_submodel_registry_log_mongodb)" == "healthy" ]; then
echo "Submodel Registry Log MongoDB started successfully and is healthy."
break
else
echo "Waiting for Submodel Registry Log MongoDB to become healthy..."
check_count=$((check_count + 1))
sleep $sleep_interval
fi
done
# If the container is still not healthy after the loop
if [ $check_count -eq $max_checks ]; then
echo "Submodel Registry Log MongoDB failed to start or is unhealthy after 2 minutes."
docker logs test_submodel_registry_log_mongodb
exit 1
fi
# Stop and remove the container after testing
docker stop test_submodel_registry_log_mongodb
docker rm test_submodel_registry_log_mongodb
- name: Clean up
run: exit 0