Skip to content

Commit 3c02ad0

Browse files
authored
[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
1 parent 4fc2ea0 commit 3c02ad0

File tree

4 files changed

+111
-39
lines changed

4 files changed

+111
-39
lines changed

.github/ci-extensions.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
20+
<extensions>
21+
<extension>
22+
<groupId>eu.maveniverse.maven.mimir</groupId>
23+
<artifactId>extension</artifactId>
24+
<version>0.4.0</version>
25+
</extension>
26+
</extensions>

.github/workflows/maven.yml

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,28 @@ jobs:
4141
with:
4242
persist-credentials: false
4343

44-
- name: Cache Maven packages
44+
- name: Prepare Mimir
45+
shell: bash
46+
run: |
47+
mkdir -p ~/.m2
48+
cp .github/ci-extensions.xml ~/.m2/extensions.xml
49+
50+
- name: Handle Mimir caches
4551
uses: actions/cache@v4
4652
with:
47-
path: ~/.m2/repository/cached
48-
key: maven-${{ runner.os }}-initial-${{ hashFiles('**/pom.xml') }}
53+
path: ~/.mimir/local
54+
key: mimir-${{ runner.os }}-initial-${{ hashFiles('**/pom.xml') }}
4955
restore-keys: |
50-
maven-${{ runner.os }}-initial-
51-
maven-${{ runner.os }}-
56+
mimir-${{ runner.os }}-initial-
57+
mimir-${{ runner.os }}-
5258
5359
- name: Set up Maven
5460
shell: bash
55-
run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper "-Dmaven=4.0.0-rc-2"
61+
run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper "-Dmaven=4.0.0-rc-3"
5662

5763
- name: Build Maven distributions
5864
shell: bash
59-
run: ./mvnw verify -e -B -V -Dmaven.repo.local=$HOME/.m2/repository/cached
65+
run: ./mvnw verify -e -B -V
6066

6167
- name: List contents of target directory
6268
shell: bash
@@ -102,6 +108,21 @@ jobs:
102108
with:
103109
persist-credentials: false
104110

111+
- name: Prepare Mimir
112+
shell: bash
113+
run: |
114+
mkdir -p ~/.m2
115+
cp .github/ci-extensions.xml ~/.m2/extensions.xml
116+
117+
- name: Handle Mimir caches
118+
uses: actions/cache@v4
119+
with:
120+
path: ~/.mimir/local
121+
key: mimir-${{ runner.os }}-full-${{ hashFiles('**/pom.xml') }}
122+
restore-keys: |
123+
mimir-${{ runner.os }}-full-
124+
mimir-${{ runner.os }}-
125+
105126
- name: Download Maven distribution
106127
uses: actions/download-artifact@v4
107128
with:
@@ -129,26 +150,17 @@ jobs:
129150
echo "MAVEN_HOME=$PWD/maven-local" >> $GITHUB_ENV
130151
echo "$PWD/maven-local/bin" >> $GITHUB_PATH
131152
132-
- name: Cache Maven packages
133-
uses: actions/cache@v4
134-
with:
135-
path: ~/.m2/repository/cached
136-
key: maven-${{ runner.os }}-full-${{ hashFiles('**/pom.xml') }}
137-
restore-keys: |
138-
maven-${{ runner.os }}-full-
139-
maven-${{ runner.os }}-
140-
141153
- name: Show IP
142154
shell: bash
143155
run: curl --silent https://api.ipify.org
144156

145157
- name: Build with downloaded Maven
146158
shell: bash
147-
run: mvn verify -Papache-release -Dgpg.skip=true -e -B -V -Dmaven.repo.local=$HOME/.m2/repository/cached
159+
run: mvn verify -Papache-release -Dgpg.skip=true -e -B -V
148160

149161
- name: Build site with downloaded Maven
150162
shell: bash
151-
run: mvn site -e -B -V -Preporting -Dmaven.repo.local=$HOME/.m2/repository/cached
163+
run: mvn site -e -B -V -Preporting
152164

153165
- name: Upload test artifacts
154166
uses: actions/upload-artifact@v4
@@ -177,6 +189,21 @@ jobs:
177189
with:
178190
persist-credentials: false
179191

192+
- name: Prepare Mimir
193+
shell: bash
194+
run: |
195+
mkdir -p ~/.m2
196+
cp .github/ci-extensions.xml ~/.m2/extensions.xml
197+
198+
- name: Handle Mimir caches
199+
uses: actions/cache@v4
200+
with:
201+
path: ~/.mimir/local
202+
key: mimir-${{ runner.os }}-its-${{ hashFiles('**/pom.xml') }}
203+
restore-keys: |
204+
mimir-${{ runner.os }}-its-
205+
mimir-${{ runner.os }}-
206+
180207
- name: Download Maven distribution
181208
uses: actions/download-artifact@v4
182209
with:
@@ -204,33 +231,17 @@ jobs:
204231
echo "MAVEN_HOME=$PWD/maven-local" >> $GITHUB_ENV
205232
echo "$PWD/maven-local/bin" >> $GITHUB_PATH
206233
207-
- name: Cache Maven packages
208-
uses: actions/cache@v4
209-
with:
210-
path: ~/.m2/repository/cached
211-
key: maven-${{ runner.os }}-its-${{ hashFiles('**/pom.xml') }}
212-
restore-keys: |
213-
maven-${{ runner.os }}-its
214-
maven-${{ runner.os }}-
215-
216234
- name: Show IP
217235
shell: bash
218236
run: curl --silent https://api.ipify.org
219237

220-
# we use two steps so that we can cache artifacts downloaded from Maven Central repository
221-
# without installing any local artifacts to not pollute the cache
222-
- name: Build maven and ITs
223-
shell: bash
224-
run: mvn package -DskipTests -e -B -V -Prun-its -Dmaven.repo.local=$HOME/.m2/repository/cached
225-
226-
# Now run tests and ITs using a separate local repo (using the previous filled repo as tail)
227-
- name: Run integration tests
238+
- name: Build Maven and ITs and run them
228239
shell: bash
229-
run: mvn install -e -B -V -Prun-its -Dmaven.repo.local=$HOME/.m2/repository/local -Dmaven.repo.local.tail=$HOME/.m2/repository/cached
240+
run: mvn install -e -B -V -Prun-its,mimir
230241

231242
- name: Upload test artifacts
232243
uses: actions/upload-artifact@v4
233244
if: failure()
234245
with:
235246
name: ${{ github.run_number }}-integration-test-artifact-${{ runner.os }}-${{ matrix.java }}
236-
path: ./its/core-it-suite/target/test-classes/
247+
path: ./its/core-it-suite/target/test-classes/

its/core-it-suite/pom.xml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ under the License.
6767
<!-- The (possibly instrumented copy of the) Maven distribution we actually
6868
use for the tests. -->
6969
<preparedMavenHome>${mavenHome}</preparedMavenHome>
70+
<preparedUserHome>${project.build.directory}/user-home</preparedUserHome>
7071
<!-- default properties used to filter the global settings -->
7172
<maven.it.central>https://repo.maven.apache.org/maven2</maven.it.central>
7273
<proxy.active>false</proxy.active>
@@ -518,7 +519,7 @@ under the License.
518519
<useSystemClassLoader>false</useSystemClassLoader>
519520
<promoteUserPropertiesToSystemProperties>false</promoteUserPropertiesToSystemProperties>
520521
<systemPropertyVariables>
521-
<maven.test.user.home>${project.build.directory}/user-home</maven.test.user.home>
522+
<maven.test.user.home>${preparedUserHome}</maven.test.user.home>
522523
<maven.test.repo.local>${settings.localRepository}</maven.test.repo.local>
523524
<maven.test.tmpdir>${project.build.testOutputDirectory}</maven.test.tmpdir>
524525
<maven.version>${maven.version}</maven.version>
@@ -540,8 +541,34 @@ under the License.
540541
</plugin>
541542
</plugins>
542543
</build>
543-
544544
<profiles>
545+
<profile>
546+
<id>mimir</id>
547+
<build>
548+
<plugins>
549+
<plugin>
550+
<groupId>org.apache.maven.plugins</groupId>
551+
<artifactId>maven-antrun-plugin</artifactId>
552+
<executions>
553+
<execution>
554+
<id>setup-mimir</id>
555+
<goals>
556+
<goal>run</goal>
557+
</goals>
558+
<phase>process-test-resources</phase>
559+
<configuration>
560+
<target>
561+
<delete dir="${preparedUserHome}" />
562+
<copy file="${session.rootDirectory}/.github/ci-extensions.xml" toFile="${preparedUserHome}/.m2/extensions.xml" />
563+
<copy file="${project.build.testOutputDirectory}/it-mimir.properties" toFile="${preparedUserHome}/.mimir/mimir.properties" />
564+
</target>
565+
</configuration>
566+
</execution>
567+
</executions>
568+
</plugin>
569+
</plugins>
570+
</build>
571+
</profile>
545572
<profile>
546573
<id>parallel</id>
547574
<build>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Used when profile "mimir" is activated
2+
3+
# we change user.home in IT, so we want this interpolated
4+
mimir.daemon.socketPath=${user.home}/.mimir/mimir-socket
5+
# outer build already did this
6+
mimir.daemon.autoupdate=false
7+
# outer build already did this
8+
mimir.daemon.autostart=false

0 commit comments

Comments
 (0)