| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| name: Java CI |
| |
| on: |
| push: |
| branches: [ master ] |
| pull_request: |
| branches: [ master ] |
| |
| # allow single build per branch or PR |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.ref }} |
| cancel-in-progress: true |
| |
| # clear all permissions for GITHUB_TOKEN |
| permissions: {} |
| |
| env: |
| # Keep in sync with mimir testing version in pom.xml |
| MIMIR_VERSION: 0.12.0 |
| MIMIR_BASEDIR: ~/.mimir |
| MIMIR_LOCAL: ~/.mimir/local |
| MAVEN_OPTS: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./target/java_heapdump.hprof |
| # The Google Cloud mirror of Central lags a fresh release: 4.0.0-rc-6 was |
| # still a 404 there days after Central served it, so the wrapper could not |
| # fetch the distribution this workflow had just asked for. Unset, the |
| # wrapper downloads from Central. Uncomment to put the mirror back once its |
| # sync latency stops breaking release-day builds. |
| # MVNW_REPOURL: https://maven-central.storage-download.googleapis.com/maven2 |
| |
| jobs: |
| initial-build: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Set up JDK |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 |
| with: |
| java-version: 17 |
| distribution: 'temurin' |
| |
| - name: Checkout maven |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| with: |
| persist-credentials: false |
| |
| - name: Verify Mimir version alignment |
| shell: bash |
| run: | |
| POM_VERSION=$(grep -A2 'eu.maveniverse.maven.mimir' pom.xml | grep '<version>' | sed 's/.*<version>\(.*\)<\/version>.*/\1/') |
| if [ "$POM_VERSION" != "${{ env.MIMIR_VERSION }}" ]; then |
| echo "::error::MIMIR_VERSION (${{ env.MIMIR_VERSION }}) does not match pom.xml ($POM_VERSION) — update MIMIR_VERSION in this workflow" |
| exit 1 |
| fi |
| |
| - name: Prepare Mimir for Maven 3.x |
| shell: bash |
| run: | |
| mkdir -p ${{ env.MIMIR_BASEDIR }} |
| cp .github/ci-mimir-session.properties ${{ env.MIMIR_BASEDIR }}/session.properties |
| cp .github/ci-mimir-daemon.properties ${{ env.MIMIR_BASEDIR }}/daemon.properties |
| cp .github/ci-extensions.xml .mvn/extensions.xml |
| |
| - name: Restore Mimir caches |
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| with: |
| path: ${{ env.MIMIR_LOCAL }} |
| key: master-${{ runner.os }}-${{ github.run_id }} |
| restore-keys: | |
| master-${{ runner.os }}- |
| master- |
| |
| - name: Set up Maven |
| shell: bash |
| run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.4:wrapper "-Dmaven=4.0.0-rc-6" |
| |
| - name: Prepare Mimir for Maven 4.x |
| shell: bash |
| run: | |
| rm .mvn/extensions.xml |
| mkdir -p ~/.m2 |
| cp .github/ci-extensions.xml ~/.m2/extensions.xml |
| |
| - name: Build Maven distributions |
| shell: bash |
| run: ./mvnw verify -e -B -V |
| |
| - name: List contents of target directory |
| shell: bash |
| run: ls -la apache-maven/target |
| |
| - name: Upload Mimir caches |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| if: ${{ !cancelled() && !failure() }} |
| with: |
| name: cache-${{ runner.os }}-initial |
| retention-days: 1 |
| path: ${{ env.MIMIR_LOCAL }} |
| |
| - name: Upload Maven distributions |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| with: |
| name: maven-distributions |
| path: | |
| apache-maven/target/apache-maven*.zip |
| apache-maven/target/apache-maven*.tar.gz |
| |
| - name: Upload test artifacts |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| if: ${{ failure() || cancelled() }} |
| with: |
| name: initial-logs |
| retention-days: 1 |
| path: | |
| **/target/surefire-reports/* |
| **/target/java_heapdump.hprof |
| |
| - name: Upload Mimir logs |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| if: always() |
| with: |
| name: initial-mimir-logs |
| include-hidden-files: true |
| retention-days: 1 |
| path: | |
| ~/.mimir/*.log |
| |
| full-build: |
| needs: initial-build |
| runs-on: ${{ matrix.os }} |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [ubuntu-latest, macos-latest, windows-latest] |
| java: ['17', '21', '25'] |
| steps: |
| - name: Set up JDK ${{ matrix.java }} |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 |
| with: |
| java-version: ${{ matrix.java }} |
| distribution: 'temurin' |
| |
| - name: Install Graphviz (MacOS) |
| if: runner.os == 'macOS' |
| run: brew install graphviz |
| |
| - name: Install Graphviz (Ubuntu) |
| if: runner.os == 'Linux' |
| run: sudo apt-get install graphviz |
| |
| - name: Install Graphviz (Windows) |
| if: runner.os == 'Windows' |
| run: choco install graphviz |
| |
| - name: Checkout maven |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| with: |
| persist-credentials: false |
| |
| - name: Prepare Mimir for Maven 4.x |
| shell: bash |
| run: | |
| mkdir -p ${{ env.MIMIR_BASEDIR }} |
| cp .github/ci-mimir-session.properties ${{ env.MIMIR_BASEDIR }}/session.properties |
| cp .github/ci-mimir-daemon.properties ${{ env.MIMIR_BASEDIR }}/daemon.properties |
| mkdir -p ~/.m2 |
| cp .github/ci-extensions.xml ~/.m2/extensions.xml |
| |
| - name: Restore Mimir caches |
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| with: |
| path: ${{ env.MIMIR_LOCAL }} |
| key: master-${{ runner.os }}-${{ github.run_id }} |
| restore-keys: | |
| master-${{ runner.os }}- |
| master- |
| |
| - name: Download Maven distribution |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| with: |
| name: maven-distributions |
| path: maven-dist |
| |
| - name: List downloaded files |
| shell: bash |
| run: ls -la maven-dist |
| |
| - name: Extract Maven distribution |
| shell: bash |
| run: | |
| mkdir -p maven-local |
| if [ "${{ runner.os }}" = "Windows" ]; then |
| unzip maven-dist/apache-maven-*-bin.zip -d maven-local |
| # Get the name of the extracted directory |
| MAVEN_DIR=$(ls maven-local) |
| # Move contents up one level |
| mv "maven-local/$MAVEN_DIR"/* maven-local/ |
| rm -r "maven-local/$MAVEN_DIR" |
| else |
| tar xzf maven-dist/apache-maven-*-bin.tar.gz -C maven-local --strip-components 1 |
| fi |
| echo "MAVEN_HOME=$PWD/maven-local" >> $GITHUB_ENV |
| echo "$PWD/maven-local/bin" >> $GITHUB_PATH |
| |
| - name: Build with downloaded Maven |
| shell: bash |
| run: mvn verify -Papache-release -Dgpg.skip=true -e -B -V |
| |
| - name: Build site with downloaded Maven |
| shell: bash |
| run: mvn site -e -B -V -Preporting |
| |
| - name: Upload Mimir caches |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| if: ${{ !cancelled() && !failure() }} |
| with: |
| name: cache-${{ runner.os }}-full-build-${{ matrix.java }} |
| retention-days: 1 |
| path: ${{ env.MIMIR_LOCAL }} |
| |
| - name: Upload test artifacts |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| if: failure() || cancelled() |
| with: |
| name: full-build-logs-${{ runner.os }}-${{ matrix.java }} |
| retention-days: 1 |
| path: | |
| **/target/surefire-reports/* |
| **/target/java_heapdump.hprof |
| |
| - name: Upload Mimir logs |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| if: always() |
| with: |
| name: full-build-mimir-logs-${{ runner.os }}-${{ matrix.java }} |
| include-hidden-files: true |
| retention-days: 1 |
| path: | |
| ~/.mimir/*.log |
| |
| integration-tests: |
| needs: initial-build |
| runs-on: ${{ matrix.os }} |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [ubuntu-latest, macos-latest, windows-latest] |
| java: ['17', '21', '25'] |
| steps: |
| - name: Set up JDK ${{ matrix.java }} |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 |
| with: |
| java-version: ${{ matrix.java }} |
| distribution: 'temurin' |
| |
| - name: Checkout maven |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| with: |
| persist-credentials: false |
| |
| - name: Prepare Mimir for Maven 4.x |
| shell: bash |
| run: | |
| mkdir -p ${{ env.MIMIR_BASEDIR }} |
| cp .github/ci-mimir-session.properties ${{ env.MIMIR_BASEDIR }}/session.properties |
| cp .github/ci-mimir-daemon.properties ${{ env.MIMIR_BASEDIR }}/daemon.properties |
| mkdir -p ~/.m2 |
| cp .github/ci-extensions.xml ~/.m2/extensions.xml |
| |
| - name: Restore Mimir caches |
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| with: |
| path: ${{ env.MIMIR_LOCAL }} |
| key: master-${{ runner.os }}-${{ github.run_id }} |
| restore-keys: | |
| master-${{ runner.os }}- |
| master- |
| |
| - name: Download Maven distribution |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| with: |
| name: maven-distributions |
| path: maven-dist |
| |
| - name: List downloaded files |
| shell: bash |
| run: ls -la maven-dist |
| |
| - name: Extract Maven distribution |
| shell: bash |
| run: | |
| mkdir -p maven-local |
| if [ "${{ runner.os }}" = "Windows" ]; then |
| unzip maven-dist/apache-maven-*-bin.zip -d maven-local |
| # Get the name of the extracted directory |
| MAVEN_DIR=$(ls maven-local) |
| # Move contents up one level |
| mv "maven-local/$MAVEN_DIR"/* maven-local/ |
| rm -r "maven-local/$MAVEN_DIR" |
| else |
| tar xzf maven-dist/apache-maven-*-bin.tar.gz -C maven-local --strip-components 1 |
| fi |
| echo "MAVEN_HOME=$PWD/maven-local" >> $GITHUB_ENV |
| echo "$PWD/maven-local/bin" >> $GITHUB_PATH |
| |
| - name: Build Maven and ITs and run them |
| shell: bash |
| run: mvn install -e -B -V -Prun-its,mimir |
| |
| - name: Upload Mimir caches |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| if: ${{ !cancelled() && !failure() }} |
| with: |
| name: cache-${{ runner.os }}-integration-tests-${{ matrix.java }} |
| retention-days: 1 |
| path: ${{ env.MIMIR_LOCAL }} |
| |
| - name: Upload test artifacts |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| if: ${{ failure() || cancelled() }} |
| with: |
| name: integration-test-logs-${{ runner.os }}-${{ matrix.java }} |
| retention-days: 1 |
| path: | |
| **/target/surefire-reports/* |
| **/target/failsafe-reports/* |
| ./its/core-it-suite/target/test-classes/** |
| **/target/java_heapdump.hprof |
| |
| - name: Upload Mimir logs |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| if: always() |
| with: |
| name: integration-test-mimir-logs-${{ runner.os }}-${{ matrix.java }} |
| include-hidden-files: true |
| retention-days: 1 |
| path: | |
| ~/.mimir/*.log |
| |
| consolidate-caches: |
| runs-on: ${{ matrix.os }} |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [ubuntu-latest, macos-latest, windows-latest] |
| needs: |
| - full-build |
| - integration-tests |
| steps: |
| - name: Download Caches |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| with: |
| merge-multiple: true |
| pattern: 'cache-${{ runner.os }}*' |
| path: ${{ env.MIMIR_LOCAL }} |
| - name: Publish cache |
| uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| if: ${{ github.event_name != 'pull_request' && !cancelled() && !failure() }} |
| with: |
| path: ${{ env.MIMIR_LOCAL }} |
| key: master-${{ runner.os }}-${{ github.run_id }} |