From 1ead2bbd90dd8d6577aaf30d1da18536986b6c04 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Sun, 4 Feb 2024 21:20:57 +0530 Subject: [PATCH] ci : Run E2E tests against multiple versions of Docker + Use `crazy-max/ghaction-setup-docker` GitHub action to run E2E tests tied to a specific version of Docker + Add a minimal E2E test for windows that would just verify that DMP is able to build image with docker on windows + Add build job for verifying project compiles on Mac OS Signed-off-by: Rohan Kumar --- .github/workflows/e2e-tests.yml | 39 +++++++++++--- .github/workflows/e2e-windows.yml | 35 +++++++++++++ .../workflows/macos-mavenwrapper-build.yml | 24 +++++++++ it/pom.xml | 1 + it/windows-build/pom.xml | 52 +++++++++++++++++++ 5 files changed, 144 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/e2e-windows.yml create mode 100644 .github/workflows/macos-mavenwrapper-build.yml create mode 100644 it/windows-build/pom.xml diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index add13118c..354b52873 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -18,23 +18,48 @@ concurrency: cancel-in-progress: true jobs: + buildWithoutTests: + name: BuildWithoutTests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Cache .m2 registry + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: cache-e2e-${{ github.sha }}-${{ github.run_id }} + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: '11' + - name: Install DMP + run: mvn ${MAVEN_ARGS} clean install -DskipTests -Djacoco.skip=true + build: - name: Linux Java ${{ matrix.java }} Maven + name: Docker ${{ matrix.docker }} on Linux runs-on: ubuntu-latest + needs: buildWithoutTests strategy: + fail-fast: false matrix: - java: [11] + docker: [v25.0.2, v24.0.9, v23.0.6] steps: - name: Checkout uses: actions/checkout@v2 - name: Setup Java uses: actions/setup-java@v1 with: - java-version: ${{ matrix.java }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Install Docker Maven Plugin - run: mvn ${MAVEN_ARGS} clean install -DskipTests -Djacoco.skip=true + java-version: '11' + - name: Cache .m2 registry + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: cache-e2e-${{ github.sha }}-${{ github.run_id }} + - name: Set up Docker + uses: crazy-max/ghaction-setup-docker@v2 + with: + version: ${{ matrix.docker }} - name: Run Integration tests run: | cd it/ diff --git a/.github/workflows/e2e-windows.yml b/.github/workflows/e2e-windows.yml new file mode 100644 index 000000000..c86809250 --- /dev/null +++ b/.github/workflows/e2e-windows.yml @@ -0,0 +1,35 @@ +name: E2E Tests + +env: + MAVEN_ARGS: -B -C -V -ntp -Dhttp.keepAlive=false -e + +on: + workflow_dispatch: + push: + branches: + - master + pull_request: + schedule: + - cron: '0 1 * * *' # Every day at 1 + +jobs: + windows-build: + name: Windows + runs-on: windows-latest + steps: + - name: Get Windows Version > Used to retrieve specific Docker Image + shell: cmd + run: | + ver + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: '11' + - name: Install DMP + run: mvn ${MAVEN_ARGS} clean install -DskipTests + - name: Run Integration tests + run: | + cd it/windows-build + mvn clean install -Pwindows diff --git a/.github/workflows/macos-mavenwrapper-build.yml b/.github/workflows/macos-mavenwrapper-build.yml new file mode 100644 index 000000000..2190adce7 --- /dev/null +++ b/.github/workflows/macos-mavenwrapper-build.yml @@ -0,0 +1,24 @@ +name: Mac OS Build + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + name: Java ${{ matrix.java }} Maven Wrapper + runs-on: macos-13 + strategy: + matrix: + java: [11] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: Build Project + run: ./mvnw -B -C -V -ntp clean install \ No newline at end of file diff --git a/it/pom.xml b/it/pom.xml index 5b9c694f6..7fd833dcb 100644 --- a/it/pom.xml +++ b/it/pom.xml @@ -44,5 +44,6 @@ spring-boot-with-jib volume zero-config + windows-build diff --git a/it/windows-build/pom.xml b/it/windows-build/pom.xml new file mode 100644 index 000000000..2aa1a6976 --- /dev/null +++ b/it/windows-build/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + + io.fabric8.dmp.itests + dmp-it-parent + 0.44-SNAPSHOT + ../pom.xml + + + fabric8io + dmp-it-windows-build + 0.44-SNAPSHOT + + + + windows + + + + io.fabric8 + docker-maven-plugin + + + + %g/%a:${project.version} + + mcr.microsoft.com/windows/nanoserver:ltsc2022 + + artifact + + + + + + + + + build + + build + + pre-integration-test + + + + + + + +