Skip to content

test: Integration test debian 12 tomcat systemd #28

test: Integration test debian 12 tomcat systemd

test: Integration test debian 12 tomcat systemd #28

# 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" ]
pull_request:
branches: [ "main" ]
env:
TEST_IMAGE_NAME: 'local/tomcat-test:latest'
BUILD_PLATFORMS: 'linux/amd64'
jobs:
# This way the env variables are accessible in the individual jobs
prepare_environment:
name: Prepare the environment variables
runs-on: ubuntu-latest
outputs:
test_image_name: ${{ env.TEST_IMAGE_NAME }}
build_platforms: ${{ env.BUILD_PLATFORMS }}
steps:
- run: |
echo "Publish environment variables"
docker-build-cache:
name: Docker Buildx cache
runs-on: ubuntu-latest
needs: prepare_environment
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ./.m2 # m2 folder in the current repo root else it will not be available for the docker contexts
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Resolve missing dependencies
run: |
mvn dependency:go-offline -Dmaven.repo.local=./.m2
# If a repository folder exists force copy the dependencies to the m2 folder
if [ -d "./.m2/repository" ]; then
cp -rf ./.m2/repository/* ./.m2/
rm -rf ./.m2/repository
fi
- name: Build image for platforms ${{ needs.prepare_environment.outputs.build_platforms }}
uses: docker/build-push-action@v4
with:
context: .
push: false
load: false
tags: ${{ needs.prepare_environment.outputs.test_image_name }}
cache-from: type=gha
cache-to: type=gha,mode=max
file: ./.integration-scenarios/debian-12-tomcat-war-systemd/Dockerfile
debian-12-tomcat-war-systemd:
name: Run Debian 12 Tomcat WAR systemd integration tests
runs-on: ubuntu-latest
needs:
- prepare_environment
- docker-build-cache
strategy:
matrix:
scenario: [ '0_*.sh', '1_*.sh', '2_*.sh' ]
image: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Download the docker image to podman cache
run: |
podman pull docker-daemon:${{ needs.prepare_environment.outputs.test_image_name }}
- name: Run integration tests
run: ./.integration-scenarios/debian-12-tomcat-war-systemd/run.sh -t -g '${{ matrix.scenario }}'