diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 259c4135cd..1296bcaeb2 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -10,7 +10,7 @@ on: branches: [ "main", "feat/**" ] jobs: - maven-build-cache: + build-caches: name: Build with Maven and cache dependencies runs-on: ubuntu-latest steps: @@ -29,70 +29,24 @@ jobs: run: | echo "Caching the maven dependencies" mvn -pl ors-test-scenarios package -B dependency:go-offline -q - first-pass-image-cache: - name: Build the Docker image cache for the first time - runs-on: ubuntu-latest - needs: - - maven-build-cache - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - id: buildx - with: - install: true - - name: Cache image ors-test-scenarios-maven-bare - uses: docker/build-push-action@v4 - with: - context: . - push: false - load: false - tags: ors-test-scenarios-maven-bare:latest - file: ors-test-scenarios/src/test/resources/Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=max - second-pass-image-cache: - name: Build the Docker image cache for the second time - runs-on: ubuntu-latest - needs: - - maven-build-cache - - first-pass-image-cache - strategy: - matrix: - docker_image: [ 'ors-test-scenarios-maven-bare', 'ors-test-scenarios-war-bare','ors-test-scenarios-jar-bare','ors-test-scenarios-maven','ors-test-scenarios-war','ors-test-scenarios-jar' ] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - id: buildx - with: - install: true - - name: Cache images - uses: docker/build-push-action@v4 + - name: Build the docker image with the one shot builder + run: | + echo "Building the docker image with the one shot builder" + mvn -pl ors-test-scenarios test -Dtest=utils.OneShotImageBuilderTest + - name: Export the docker image + run: | + echo "Exporting the docker image" + docker save -o ors-test-scenarios-war-bare.tar ors-test-scenarios-war-bare:latest + - name: Save the docker image to the cache + uses: actions/cache/save@v4 with: - context: . - push: false - load: false - tags: ${{ matrix.docker_image }}:latest - file: ors-test-scenarios/src/test/resources/Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=max + path: ors-test-scenarios-war-bare.tar + key: ${{ runner.os }}-ors-test-scenarios-war-bare-${{ hashFiles('ors-test-scenarios-war-bare.tar') }} ors-test-scenarios: name: Run the ors-test-scenarios integration tests runs-on: ubuntu-latest needs: - - maven-build-cache - - second-pass-image-cache + - build-caches strategy: matrix: test_class: [ 'ConfigEnvironmentTest','ConfigFileTest','ConfigLookupTest','GeoToolsTest','GraphRepoTest' ] @@ -112,17 +66,17 @@ jobs: id: buildx with: install: true - - name: Load the Docker image - uses: docker/build-push-action@v4 + - name: Download the docker image from the cache + uses: actions/download-artifact@v4 with: - context: . - load: true - tags: ors-test-scenarios-maven:latest - file: ors-test-scenarios/src/test/resources/Dockerfile - cache-from: type=gha + name: ors-test-scenarios-war-bare.tar + - name: Load the docker image + run: | + echo "Loading the docker image" + docker load -i ors-test-scenarios-war-bare.tar - name: Run integration tests run: | echo "List all docker images" - docker image ls -a + docker image ls -a echo "Running integration tests ${{ matrix.test_class }}" mvn -pl ors-test-scenarios test -Dtest=${{ matrix.test_class }} \ No newline at end of file diff --git a/ors-test-scenarios/src/test/java/utils/OneShotImageBuilderTest.java b/ors-test-scenarios/src/test/java/utils/OneShotImageBuilderTest.java index 6e7b5a939f..e69de4dd5e 100644 --- a/ors-test-scenarios/src/test/java/utils/OneShotImageBuilderTest.java +++ b/ors-test-scenarios/src/test/java/utils/OneShotImageBuilderTest.java @@ -15,7 +15,6 @@ class OneShotImageBuilderTest { @Test void oneShotImageBuilder() { - // Cache one GenericContainer containerWar = initContainerWithSharedGraphs(ContainerInitializer.ContainerTestImageBare.WAR_CONTAINER_BARE, false); containerWar.setWaitStrategy(new ShellStrategy()); containerWar.start();