Skip to content

fix: repair workflows integrationtests docker #462

fix: repair workflows integrationtests docker

fix: repair workflows integrationtests docker #462

# 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: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
cache-dependency-path: ./pom.xml
- name: Restore cached ors test image
id: restore-cached-image
uses: actions/cache/restore@v4
with:
path: ors-test-scenarios-*.tar
key: ${{ runner.os }}-ors-test-scenarios-war-bare-
- name: Load the docker image
run: |
echo "Loading the docker images"
if [ -f ors-test-scenarios-war.tar ]; then
docker load -i ors-test-scenarios-war.tar
fi
if [ -f ors-test-scenarios-jar.tar ]; then
docker load -i ors-test-scenarios-jar.tar
fi
if [ -f ors-test-scenarios-maven.tar ]; then
docker load -i ors-test-scenarios-maven.tar
fi
if [ -f ors-test-scenarios-war-bare.tar ]; then
docker load -i ors-test-scenarios-war-bare.tar
fi
if [ -f ors-test-scenarios-jar-bare.tar ]; then
docker load -i ors-test-scenarios-jar-bare.tar
fi
if [ -f ors-test-scenarios-maven-bare.tar ]; then
docker load -i ors-test-scenarios-maven-bare.tar
fi
- name: Cache Maven dependencies for the ors maven project
run: |
echo "Caching the maven dependencies"
mvn -pl ors-test-scenarios package -Dmaven.test.skip=true -B dependency:go-offline -q
- name: Test if the graphs need to be rebuilt
id: check-graphs
run: |
echo "Building the docker image with the one shot builder"
mvn -pl ors-test-scenarios test
echo "Export the docker image"
docker save -o test.tar ors-test-scenarios-war-bare:latest
echo "Check if the test.tar differs from the cached image"
if [ cmp --silent test.tar ors-test-scenarios-war-bare.tar ]; then
echo "We can download the shared graphs"
# job output to true echo "test=hello" >> "$GITHUB_OUTPUT"
echo "rebuild=false" >> "$GITHUB_ENV"
else
echo "The image is different, we need to rebuild shared graphs"
echo "rebuild=true" >> "$GITHUB_ENV"
fi
env:
ONE_SHOT_IMAGE_BUILDER: true
- name: Restore shared graphs
id: restore-cached-image

Check failure on line 78 in .github/workflows/integration-tests.yml

View workflow run for this annotation

GitHub Actions / Integration test suite

Invalid workflow file

The workflow is not valid. .github/workflows/integration-tests.yml (Line: 78, Col: 13): The identifier 'restore-cached-image' may not be used more than once within the same scope.
if: steps.check-graphs.outputs.rebuild == 'false'
uses: actions/cache/restore@v4
with:
path: ors-test-scenarios/graphs-integrationtests
key: ${{ runner.os }}-ors-test-scenarios-graphs-integrationtests-
- name: Run integration tests
run: |
echo "List all docker images"
docker image ls -a
echo "Running integration tests"
mvn -pl ors-test-scenarios test -Dtest=ConfigEnvironmentTest
- name: Export the docker image to be cached
run: |
echo "Exporting the complete docker images"
docker save -o ors-test-scenarios-war.tar ors-test-scenarios-war:latest
docker save -o ors-test-scenarios-jar.tar ors-test-scenarios-jar:latest
docker save -o ors-test-scenarios-maven.tar ors-test-scenarios-maven:latest
echo "Exporting the bare docker images"
docker save -o ors-test-scenarios-war-bare.tar ors-test-scenarios-war-bare:latest
docker save -o ors-test-scenarios-jar-bare.tar ors-test-scenarios-jar-bare:latest
docker save -o ors-test-scenarios-maven-bare.tar ors-test-scenarios-maven-bare:latest
- name: Save the docker image to the cache
uses: actions/cache/save@v4
with:
path: |
ors-test-scenarios-war.tar
ors-test-scenarios-jar.tar
ors-test-scenarios-maven.tar
ors-test-scenarios-war-bare.tar
ors-test-scenarios-jar-bare.tar
ors-test-scenarios-maven-bare.tar
key: ${{ runner.os }}-ors-test-scenarios-war-bare-${{ hashFiles('ors-test-scenarios-war.tar', 'ors-test-scenarios-jar.tar', 'ors-test-scenarios-maven.tar', 'ors-test-scenarios-war-bare.tar', 'ors-test-scenarios-jar-bare.tar', 'ors-test-scenarios-maven-bare.tar') }}
- name: Save the shared graphs to the cache
uses: actions/cache/save@v4
with:
path: ors-test-scenarios/graphs-integrationtests
key: ${{ runner.os }}-ors-test-scenarios-graphs-integrationtests-${{ hashFiles('ors-test-scenarios/graphs-integrationtests') }}