From 5720cb17ca439ad893160eba7e66cd1f48c0f628 Mon Sep 17 00:00:00 2001 From: Aaron Croissette Date: Tue, 27 Aug 2024 23:22:21 -0400 Subject: [PATCH] Add Maven build test --- .github/workflows/test.yml | 46 ++++++++++++++++++++++++++++++++++++++ maven-examples/README.md | 17 ++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 maven-examples/README.md diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..894418fa3e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,46 @@ +name: All Tests +on: + push: + schedule: + - cron: 0 0 1 * * +jobs: + test_maven: + strategy: + max-parallel: 3 + matrix: + image: + - eclipse-temurin:8-jdk + - adoptopenjdk/openjdk11:jdk-11.0.11_9-debian + - adoptopenjdk/openjdk16:jdk-16.0.1_9-debian + - eclipse-temurin:20-jdk + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Detect changed files + id: changed-files-yaml + uses: tj-actions/changed-files@v45 + with: + files_yaml: | + maven: + - 'maven-examples/**' + - '.github/workflows/test.yml' + - name: Define options + run: | + set -x + if [ -n "${JOB_CONTAINER_NAME}" ]; then + echo "options=--volumes-from=${JOB_CONTAINER_NAME}" >> $GITHUB_ENV + else + echo "options=-v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}" >> $GITHUB_ENV + fi + shell: bash + id: define-options + - name: Test Maven project updates + uses: addnab/docker-run-action@v3 + if: github.event.schedule == '0 0 1 * *' || steps.changed-files-yaml.outputs.maven_any_changed == 'true' + with: + image: ${{ matrix.image }} + options: ${{ env.options || steps.define-options.outputs.options }} --rm + run: | + cd ${{ github.workspace }}/maven-examples/maven-example + ./mvnw clean package diff --git a/maven-examples/README.md b/maven-examples/README.md new file mode 100644 index 0000000000..b3d6f8d93e --- /dev/null +++ b/maven-examples/README.md @@ -0,0 +1,17 @@ +# Maven Examples + +## Prerequisites + +Ensure the JDK is installed locally. + +Apt example: +```sh +sudo apt install openjdk-21-jdk-headless +``` + +## Running Locally + +```sh +cd ./maven-example +./mvnw package +```