Increases CI Speed #859
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' | |
jobs: | |
Build-BaSyx: | |
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: Start environment | |
run: docker compose --project-directory ./ci up -d --wait | |
- name: Install BaSyx | |
run: mvn clean install -DskipTests | |
- name: Stop environment | |
if: always() | |
run: docker compose --project-directory ./ci down | |
Build-AAS-CD-Docker-Images: | |
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 Docker Images | |
run: | | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasrepository.component" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasenvironment.component" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.conceptdescriptionrepository.component" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasdiscoveryservice.component" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasxfileserver.component" | |
- name: Test Docker Images | |
run: | | |
images=("test/aas-repository" "test/aas-environment" "test/conceptdescription-repository" "test/aas-discovery" "test/aasxfileserver") | |
for image in "${images[@]}"; do | |
echo "Testing image $image" | |
docker run -d --name test_$image test/$image | |
sleep 30 # Give the container some time to start | |
# Check if the container is healthy (assuming the Dockerfile defines a HEALTHCHECK) | |
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_$image)" == "healthy" ]; then | |
echo "$image started successfully and is healthy." | |
else | |
echo "$image failed to start or is unhealthy." | |
docker logs test_$image | |
exit 1 | |
fi | |
# Stop and remove the container after testing | |
docker stop test_$image | |
docker rm test_$image | |
done | |
- name: Clean up Docker Images | |
run: | | |
docker rmi -f $(docker images -aq) | |
Build-Submodel-Docker-Images: | |
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 Docker Images | |
run: | | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelservice.example" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelrepository.component" | |
- name: Test Docker Images | |
run: | | |
images=("test/submodel-repository" "test/submodel-service") | |
for image in "${images[@]}"; do | |
echo "Testing image $image" | |
docker run -d --name test_$image test/$image | |
sleep 30 # Give the container some time to start | |
# Check if the container is healthy (assuming the Dockerfile defines a HEALTHCHECK) | |
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_$image)" == "healthy" ]; then | |
echo "$image started successfully and is healthy." | |
else | |
echo "$image failed to start or is unhealthy." | |
docker logs test_$image | |
exit 1 | |
fi | |
# Stop and remove the container after testing | |
docker stop test_$image | |
docker rm test_$image | |
done | |
- name: Clean up Docker Images | |
run: | | |
docker rmi -f $(docker images -aq) | |
Build-AAS-Registry-Docker-Images: | |
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 Docker Images | |
run: | | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasregistry-service-release-kafka-mem" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasregistry-service-release-kafka-mongodb" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasregistry-service-release-log-mem" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.aasregistry-service-release-log-mongodb" | |
- name: Test Docker Images | |
run: | | |
images=("test/aas-registry-kafka-mem" "test/aas-registry-kafka-mongodb" "test/aas-registry-log-mem" "test/aas-registry-log-mongodb") | |
for image in "${images[@]}"; do | |
echo "Testing image $image" | |
docker run -d --name test_$image test/$image | |
sleep 30 # Give the container some time to start | |
# Check if the container is healthy (assuming the Dockerfile defines a HEALTHCHECK) | |
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_$image)" == "healthy" ]; then | |
echo "$image started successfully and is healthy." | |
else | |
echo "$image failed to start or is unhealthy." | |
docker logs test_$image | |
exit 1 | |
fi | |
# Stop and remove the container after testing | |
docker stop test_$image | |
docker rm test_$image | |
done | |
- name: Clean up Docker Images | |
run: | | |
docker rmi -f $(docker images -aq) | |
Build-Submodel-Registry-Docker-Images: | |
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 Docker Images | |
run: | | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelregistry-service-release-kafka-mem" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelregistry-service-release-kafka-mongodb" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelregistry-service-release-log-mem" | |
mvn package -DskipTests -Ddocker.namespace=test --pl "org.eclipse.digitaltwin.basyx:basyx.submodelregistry-service-release-log-mongodb" | |
- name: Test Docker Images | |
run: | | |
images=("test/submodel-registry-kafka-mem" "test/submodel-registry-kafka-mongodb" "test/submodel-registry-log-mem" "test/submodel-registry-log-mongodb") | |
for image in "${images[@]}"; do | |
echo "Testing image $image" | |
docker run -d --name test_$image test/$image | |
sleep 30 # Give the container some time to start | |
# Check if the container is healthy (assuming the Dockerfile defines a HEALTHCHECK) | |
if [ "$(docker inspect --format='{{.State.Health.Status}}' test_$image)" == "healthy" ]; then | |
echo "$image started successfully and is healthy." | |
else | |
echo "$image failed to start or is unhealthy." | |
docker logs test_$image | |
exit 1 | |
fi | |
# Stop and remove the container after testing | |
docker stop test_$image | |
docker rm test_$image | |
done | |
- name: Clean up Docker Images | |
run: | | |
docker rmi -f $(docker images -aq) |