This is an automated email from the ASF dual-hosted git repository. cstamas pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push: new 3c02ad0517 [MNG-8623] Use Mimir on CI (#2144) 3c02ad0517 is described below commit 3c02ad05173401d4f6573a72d0dc3559103d5074 Author: Tamas Cservenak <ta...@cservenak.net> AuthorDate: Thu Mar 13 13:54:33 2025 +0100 [MNG-8623] Use Mimir on CI (#2144) Use Maveniverse Mimir to cache central artifacts. This makes caching way simpler as well. Update Maven used to build to Maven 4.0.0-rc-3 as well. --- https://issues.apache.org/jira/browse/MNG-8623 --- .github/ci-extensions.xml | 26 +++++++ .github/workflows/maven.yml | 85 ++++++++++++---------- its/core-it-suite/pom.xml | 31 +++++++- .../test/resources-filtered/it-mimir.properties | 8 ++ 4 files changed, 111 insertions(+), 39 deletions(-) diff --git a/.github/ci-extensions.xml b/.github/ci-extensions.xml new file mode 100644 index 0000000000..04d2b3ccbc --- /dev/null +++ b/.github/ci-extensions.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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. +--> +<extensions> + <extension> + <groupId>eu.maveniverse.maven.mimir</groupId> + <artifactId>extension</artifactId> + <version>0.4.0</version> + </extension> +</extensions> \ No newline at end of file diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index c1d0010280..83681df2fb 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -41,22 +41,28 @@ jobs: with: persist-credentials: false - - name: Cache Maven packages + - name: Prepare Mimir + shell: bash + run: | + mkdir -p ~/.m2 + cp .github/ci-extensions.xml ~/.m2/extensions.xml + + - name: Handle Mimir caches uses: actions/cache@v4 with: - path: ~/.m2/repository/cached - key: maven-${{ runner.os }}-initial-${{ hashFiles('**/pom.xml') }} + path: ~/.mimir/local + key: mimir-${{ runner.os }}-initial-${{ hashFiles('**/pom.xml') }} restore-keys: | - maven-${{ runner.os }}-initial- - maven-${{ runner.os }}- + mimir-${{ runner.os }}-initial- + mimir-${{ runner.os }}- - name: Set up Maven shell: bash - run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper "-Dmaven=4.0.0-rc-2" + run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper "-Dmaven=4.0.0-rc-3" - name: Build Maven distributions shell: bash - run: ./mvnw verify -e -B -V -Dmaven.repo.local=$HOME/.m2/repository/cached + run: ./mvnw verify -e -B -V - name: List contents of target directory shell: bash @@ -102,6 +108,21 @@ jobs: with: persist-credentials: false + - name: Prepare Mimir + shell: bash + run: | + mkdir -p ~/.m2 + cp .github/ci-extensions.xml ~/.m2/extensions.xml + + - name: Handle Mimir caches + uses: actions/cache@v4 + with: + path: ~/.mimir/local + key: mimir-${{ runner.os }}-full-${{ hashFiles('**/pom.xml') }} + restore-keys: | + mimir-${{ runner.os }}-full- + mimir-${{ runner.os }}- + - name: Download Maven distribution uses: actions/download-artifact@v4 with: @@ -129,26 +150,17 @@ jobs: echo "MAVEN_HOME=$PWD/maven-local" >> $GITHUB_ENV echo "$PWD/maven-local/bin" >> $GITHUB_PATH - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: ~/.m2/repository/cached - key: maven-${{ runner.os }}-full-${{ hashFiles('**/pom.xml') }} - restore-keys: | - maven-${{ runner.os }}-full- - maven-${{ runner.os }}- - - name: Show IP shell: bash run: curl --silent https://api.ipify.org - name: Build with downloaded Maven shell: bash - run: mvn verify -Papache-release -Dgpg.skip=true -e -B -V -Dmaven.repo.local=$HOME/.m2/repository/cached + 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 -Dmaven.repo.local=$HOME/.m2/repository/cached + run: mvn site -e -B -V -Preporting - name: Upload test artifacts uses: actions/upload-artifact@v4 @@ -177,6 +189,21 @@ jobs: with: persist-credentials: false + - name: Prepare Mimir + shell: bash + run: | + mkdir -p ~/.m2 + cp .github/ci-extensions.xml ~/.m2/extensions.xml + + - name: Handle Mimir caches + uses: actions/cache@v4 + with: + path: ~/.mimir/local + key: mimir-${{ runner.os }}-its-${{ hashFiles('**/pom.xml') }} + restore-keys: | + mimir-${{ runner.os }}-its- + mimir-${{ runner.os }}- + - name: Download Maven distribution uses: actions/download-artifact@v4 with: @@ -204,33 +231,17 @@ jobs: echo "MAVEN_HOME=$PWD/maven-local" >> $GITHUB_ENV echo "$PWD/maven-local/bin" >> $GITHUB_PATH - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: ~/.m2/repository/cached - key: maven-${{ runner.os }}-its-${{ hashFiles('**/pom.xml') }} - restore-keys: | - maven-${{ runner.os }}-its - maven-${{ runner.os }}- - - name: Show IP shell: bash run: curl --silent https://api.ipify.org - # we use two steps so that we can cache artifacts downloaded from Maven Central repository - # without installing any local artifacts to not pollute the cache - - name: Build maven and ITs - shell: bash - run: mvn package -DskipTests -e -B -V -Prun-its -Dmaven.repo.local=$HOME/.m2/repository/cached - - # Now run tests and ITs using a separate local repo (using the previous filled repo as tail) - - name: Run integration tests + - name: Build Maven and ITs and run them shell: bash - run: mvn install -e -B -V -Prun-its -Dmaven.repo.local=$HOME/.m2/repository/local -Dmaven.repo.local.tail=$HOME/.m2/repository/cached + run: mvn install -e -B -V -Prun-its,mimir - name: Upload test artifacts uses: actions/upload-artifact@v4 if: failure() with: name: ${{ github.run_number }}-integration-test-artifact-${{ runner.os }}-${{ matrix.java }} - path: ./its/core-it-suite/target/test-classes/ \ No newline at end of file + path: ./its/core-it-suite/target/test-classes/ diff --git a/its/core-it-suite/pom.xml b/its/core-it-suite/pom.xml index 19a42780dc..0fe91f79fe 100644 --- a/its/core-it-suite/pom.xml +++ b/its/core-it-suite/pom.xml @@ -67,6 +67,7 @@ under the License. <!-- The (possibly instrumented copy of the) Maven distribution we actually use for the tests. --> <preparedMavenHome>${mavenHome}</preparedMavenHome> + <preparedUserHome>${project.build.directory}/user-home</preparedUserHome> <!-- default properties used to filter the global settings --> <maven.it.central>https://repo.maven.apache.org/maven2</maven.it.central> <proxy.active>false</proxy.active> @@ -518,7 +519,7 @@ under the License. <useSystemClassLoader>false</useSystemClassLoader> <promoteUserPropertiesToSystemProperties>false</promoteUserPropertiesToSystemProperties> <systemPropertyVariables> - <maven.test.user.home>${project.build.directory}/user-home</maven.test.user.home> + <maven.test.user.home>${preparedUserHome}</maven.test.user.home> <maven.test.repo.local>${settings.localRepository}</maven.test.repo.local> <maven.test.tmpdir>${project.build.testOutputDirectory}</maven.test.tmpdir> <maven.version>${maven.version}</maven.version> @@ -540,8 +541,34 @@ under the License. </plugin> </plugins> </build> - <profiles> + <profile> + <id>mimir</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>setup-mimir</id> + <goals> + <goal>run</goal> + </goals> + <phase>process-test-resources</phase> + <configuration> + <target> + <delete dir="${preparedUserHome}" /> + <copy file="${session.rootDirectory}/.github/ci-extensions.xml" toFile="${preparedUserHome}/.m2/extensions.xml" /> + <copy file="${project.build.testOutputDirectory}/it-mimir.properties" toFile="${preparedUserHome}/.mimir/mimir.properties" /> + </target> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> <profile> <id>parallel</id> <build> diff --git a/its/core-it-suite/src/test/resources-filtered/it-mimir.properties b/its/core-it-suite/src/test/resources-filtered/it-mimir.properties new file mode 100644 index 0000000000..101cf00afa --- /dev/null +++ b/its/core-it-suite/src/test/resources-filtered/it-mimir.properties @@ -0,0 +1,8 @@ +# Used when profile "mimir" is activated + +# we change user.home in IT, so we want this interpolated +mimir.daemon.socketPath=${user.home}/.mimir/mimir-socket +# outer build already did this +mimir.daemon.autoupdate=false +# outer build already did this +mimir.daemon.autostart=false \ No newline at end of file