Skip to content

fix: repair workflows integrationtests docker #504

fix: repair workflows integrationtests docker

fix: repair workflows integrationtests docker #504

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Integration test suite
on:
push:
branches: [ "main", "feat/**" ]
pull_request:
branches: [ "main", "feat/**" ]
jobs:
ors-test-scenarios:
name: Build with Maven and Docker caches
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install plzip
run: sudo apt-get install -y plzip
- name: Set up JDK 17
id: setup-java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
cache-dependency-path: '**/pom.xml'
- name: Cache Maven dependencies for the ors maven project
run: |
echo "Sync the maven dependencies"
mvn dependency:go-offline -B -q
# TODO: The maven caching works good but the docker package still takes forever.
# We need to cache the docker image.
# Use the compression approach from a few revisions earlier for the ors-test-scenarios-war-builder and try if `max` allows the others to reuse the basic builder image.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: inject maven-build-cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"/home/runner/.m2": "/root/.m2"
}
- name: Prepare Build.Dockerfile for the maven caching
run: |
# Replace RUN mvn dependency:go-offline -B -q with RUN --mount=type=cache,target=/root/.m2 mvn dependency:go-offline -B -q
sed -i 's/RUN mvn dependency:go-offline -B -q/RUN --mount=type=cache,target=\/root\/.m2 mvn dependency:go-offline -B -q/' ors-test-scenarios/src/test/resources/Builder.Dockerfile
- name: Build ors-test-scenarios-builder
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
file: ./ors-test-scenarios/src/test/resources/Builder.Dockerfile
tags: ors-test-scenarios-builder:latest
target: ors-test-scenarios-builder
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build ors-test-scenarios-war-builder
id: docker_build_war
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
file: ./ors-test-scenarios/src/test/resources/Builder.Dockerfile
tags: ors-test-scenarios-war-builder:latest
target: ors-test-scenarios-war-builder
cache-from: type=gha
cache-to: type=gha,mode=min
- name: Build ors-test-scenarios-jar-builder
id: docker_build_jar
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
file: ./ors-test-scenarios/src/test/resources/Builder.Dockerfile
tags: ors-test-scenarios-jar-builder:latest
target: ors-test-scenarios-jar-builder
cache-from: type=gha
cache-to: type=gha,mode=min
- name: Build ors-test-scenarios-maven-builder
id: docker_build_maven
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
file: ./ors-test-scenarios/src/test/resources/Builder.Dockerfile
tags: ors-test-scenarios-maven-builder:latest
target: ors-test-scenarios-maven-builder
cache-from: type=gha
cache-to: type=gha,mode=min
- name: List images
run: |
echo "List all docker images"
docker image ls -a
- name: Restore cached graphs
id: restore-cached-image
continue-on-error: true
uses: actions/cache@v4
with:
path: |
ors-test-scenarios/graphs-integrationtests
key: ${{ runner.os }}-ors-test-scenarios-builder-${{ steps.docker_build.outputs.imageid }}
# - name: Rebuild shared graphs
# run: |
# echo "Rebuilding the shared graphs, if needed"
# mvn -pl ors-test-scenarios -Dtest=utils.OneShotImageBuilderTest#oneShotGraphBuilder test
# env:
# ONE_SHOT_IMAGE_BUILDER: true
# - name: Run integration tests
# run: |
# echo "Running integration tests"
# # mvn -pl ors-test-scenarios test -Dtest=ConfigEnvironmentTest
# mvn -pl ors-test-scenarios -Dtest=integrationtests.ConfigEnvironmentTest\$ConfigEnvironmentTests\#testMissingConfigButRequiredParamsAsEnvUpperAndLower test
# env:
# CI: true
# - name: Export the graph to be cached
# run: |
# echo "Compressing the graph to be cached"
# tar -cv ors-test-scenarios/graphs-integrationtests | plzip -cvvv > ors-test-scenarios-graphs-integrationtests.tar.lz || echo "Could not save ors-test-scenarios-graphs-integrationtests"