Skip to content

Commit 1749a5f

Browse files
authored
CI: Update Mimir steps (#11169)
Initial step was not cached, so m-wrapper-p and Maven distro was always pulled from MC. Changes: * using Mimir 0.9.3 * centralized Mimir config * using provided infusers After this, ~there is only one thing not cached: Mimir extension itself~ not anymore 😉
1 parent 1fc1972 commit 1749a5f

File tree

16 files changed

+78
-167
lines changed

16 files changed

+78
-167
lines changed

.github/ci-extensions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ under the License.
2121
<extension>
2222
<groupId>eu.maveniverse.maven.mimir</groupId>
2323
<artifactId>extension3</artifactId>
24-
<version>0.8.1</version>
24+
<version>${env.MIMIR_VERSION}</version>
2525
</extension>
2626
</extensions>

.github/ci-mimir-daemon.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717

1818
# Mimir Daemon config properties
1919

20-
# Disable JGroups; we don't want/use LAN cache sharing
21-
mimir.jgroups.enabled=false
20+
# Pre-seed itself
21+
mimir.daemon.preSeedItself=true
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# Mimir Session config properties
19+
20+
# do not waste time on this; we maintain the version
21+
mimir.daemon.autoupdate=false

.github/workflows/maven.yml

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ concurrency:
3131
# clear all permissions for GITHUB_TOKEN
3232
permissions: {}
3333

34+
env:
35+
MIMIR_VERSION: 0.9.3
36+
MIMIR_BASEDIR: ~/.mimir
37+
MIMIR_LOCAL: ~/.mimir/local
38+
3439
jobs:
3540
initial-build:
3641
runs-on: ubuntu-latest
@@ -46,23 +51,31 @@ jobs:
4651
with:
4752
persist-credentials: false
4853

49-
- name: Prepare Mimir
54+
- name: Prepare Mimir for Maven 3.x
5055
shell: bash
5156
run: |
52-
mkdir -p ~/.mimir
53-
cp .github/ci-extensions.xml ~/.m2/extensions.xml
54-
cp .github/ci-mimir-daemon.properties ~/.mimir/daemon.properties
57+
mkdir -p ${{ env.MIMIR_BASEDIR }}
58+
cp .github/ci-mimir-session.properties ${{ env.MIMIR_BASEDIR }}/session.properties
59+
cp .github/ci-mimir-daemon.properties ${{ env.MIMIR_BASEDIR }}/daemon.properties
60+
cp .github/ci-extensions.xml .mvn/extensions.xml
5561
5662
- name: Restore Mimir caches
5763
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
5864
id: restore-cache
5965
with:
60-
path: ~/.mimir/local
66+
path: ${{ env.MIMIR_LOCAL }}
6167
key: mimir-${{ runner.os }}-initial
6268

6369
- name: Set up Maven
6470
shell: bash
65-
run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper "-Dmaven=4.0.0-rc-3"
71+
run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.4:wrapper "-Dmaven=4.0.0-rc-4"
72+
73+
- name: Prepare Mimir for Maven 4.x
74+
shell: bash
75+
run: |
76+
rm .mvn/extensions.xml
77+
mkdir -p ~/.m2
78+
cp .github/ci-extensions.xml ~/.m2/extensions.xml
6679
6780
- name: Build Maven distributions
6881
shell: bash
@@ -76,7 +89,7 @@ jobs:
7689
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
7790
if: ${{ github.event_name != 'pull_request' && !cancelled() && !failure() }}
7891
with:
79-
path: ~/.mimir/local
92+
path: ${{ env.MIMIR_LOCAL }}
8093
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
8194

8295
- name: Upload Maven distributions
@@ -119,19 +132,20 @@ jobs:
119132
with:
120133
persist-credentials: false
121134

122-
- name: Prepare Mimir
135+
- name: Prepare Mimir for Maven 4.x
123136
shell: bash
124137
run: |
138+
mkdir -p ${{ env.MIMIR_BASEDIR }}
139+
cp .github/ci-mimir-session.properties ${{ env.MIMIR_BASEDIR }}/session.properties
140+
cp .github/ci-mimir-daemon.properties ${{ env.MIMIR_BASEDIR }}/daemon.properties
125141
mkdir -p ~/.m2
126-
mkdir -p ~/.mimir
127142
cp .github/ci-extensions.xml ~/.m2/extensions.xml
128-
cp .github/ci-mimir-daemon.properties ~/.mimir/daemon.properties
129143
130144
- name: Restore Mimir caches
131145
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
132146
id: restore-cache
133147
with:
134-
path: ~/.mimir/local
148+
path: ${{ env.MIMIR_LOCAL }}
135149
key: mimir-full-${{ matrix.os }}-${{ matrix.java }}
136150
restore-keys: |
137151
mimir-full-${{ matrix.os }}-
@@ -176,7 +190,7 @@ jobs:
176190
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
177191
if: ${{ github.event_name != 'pull_request' && !cancelled() && !failure() }}
178192
with:
179-
path: ~/.mimir/local
193+
path: ${{ env.MIMIR_LOCAL }}
180194
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
181195

182196
- name: Upload test artifacts
@@ -206,19 +220,20 @@ jobs:
206220
with:
207221
persist-credentials: false
208222

209-
- name: Prepare Mimir
223+
- name: Prepare Mimir for Maven 4.x
210224
shell: bash
211225
run: |
226+
mkdir -p ${{ env.MIMIR_BASEDIR }}
227+
cp .github/ci-mimir-session.properties ${{ env.MIMIR_BASEDIR }}/session.properties
228+
cp .github/ci-mimir-daemon.properties ${{ env.MIMIR_BASEDIR }}/daemon.properties
212229
mkdir -p ~/.m2
213-
mkdir -p ~/.mimir
214230
cp .github/ci-extensions.xml ~/.m2/extensions.xml
215-
cp .github/ci-mimir-daemon.properties ~/.mimir/daemon.properties
216231
217232
- name: Restore Mimir caches
218233
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
219234
id: restore-cache
220235
with:
221-
path: ~/.mimir/local
236+
path: ${{ env.MIMIR_LOCAL }}
222237
key: mimir-its-${{ matrix.os }}-${{ matrix.java }}
223238
restore-keys: |
224239
mimir-its-${{ matrix.os }}-
@@ -259,7 +274,7 @@ jobs:
259274
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
260275
if: ${{ github.event_name != 'pull_request' && !cancelled() && !failure() }}
261276
with:
262-
path: ~/.mimir/local
277+
path: ${{ env.MIMIR_LOCAL }}
263278
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
264279

265280
- name: Upload test artifacts

impl/maven-cli/pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,14 @@ under the License.
235235
<artifactId>jline-native</artifactId>
236236
<scope>test</scope>
237237
</dependency>
238+
<dependency>
239+
<groupId>eu.maveniverse.maven.mimir</groupId>
240+
<artifactId>testing</artifactId>
241+
<scope>test</scope>
242+
</dependency>
238243
</dependencies>
239244

240245
<build>
241-
<testResources>
242-
<testResource>
243-
<filtering>true</filtering>
244-
<directory>src/test/resources-filtered</directory>
245-
</testResource>
246-
</testResources>
247246
<plugins>
248247
<plugin>
249248
<groupId>org.apache.maven.plugins</groupId>

impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvn/MavenInvokerTestSupport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.List;
2929
import java.util.Map;
3030

31+
import eu.maveniverse.maven.mimir.testing.MimirInfuser;
3132
import org.apache.maven.api.cli.Invoker;
3233
import org.apache.maven.api.cli.Parser;
3334
import org.apache.maven.api.cli.ParserRequest;
@@ -98,7 +99,7 @@ protected Map<String, String> invoke(Path cwd, Path userHome, Collection<String>
9899
Files.createDirectories(appJava.getParent());
99100
Files.writeString(appJava, APP_JAVA_STRING);
100101

101-
MimirInfuser.infuse(userHome);
102+
MimirInfuser.infuseUW(userHome);
102103

103104
HashMap<String, String> logs = new HashMap<>();
104105
Parser parser = createParser();

impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvn/MimirInfuser.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

impl/maven-cli/src/test/resources-filtered/ut-mimir.properties

Lines changed: 0 additions & 8 deletions
This file was deleted.

impl/maven-executor/pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ under the License.
5353
<artifactId>junit-jupiter-params</artifactId>
5454
<scope>test</scope>
5555
</dependency>
56+
<dependency>
57+
<groupId>eu.maveniverse.maven.mimir</groupId>
58+
<artifactId>testing</artifactId>
59+
<scope>test</scope>
60+
</dependency>
5661
<dependency>
5762
<groupId>org.apache.maven</groupId>
5863
<artifactId>apache-maven</artifactId>
@@ -70,12 +75,6 @@ under the License.
7075
</dependencies>
7176

7277
<build>
73-
<testResources>
74-
<testResource>
75-
<filtering>true</filtering>
76-
<directory>src/test/resources-filtered</directory>
77-
</testResource>
78-
</testResources>
7978
<plugins>
8079
<plugin>
8180
<groupId>org.apache.maven.plugins</groupId>

impl/maven-executor/src/test/java/org/apache/maven/cling/executor/MavenExecutorTestSupport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.Collection;
2727
import java.util.List;
2828

29+
import eu.maveniverse.maven.mimir.testing.MimirInfuser;
2930
import org.apache.maven.api.annotations.Nullable;
3031
import org.apache.maven.api.cli.Executor;
3132
import org.apache.maven.api.cli.ExecutorRequest;
@@ -316,7 +317,7 @@ public static void main(String... args) {
316317
protected void execute(@Nullable Path logFile, Collection<ExecutorRequest> requests) throws Exception {
317318
Executor invoker = createAndMemoizeExecutor();
318319
for (ExecutorRequest request : requests) {
319-
MimirInfuser.infuse(request.userHomeDirectory());
320+
MimirInfuser.infuseUW(request.userHomeDirectory());
320321
int exitCode = invoker.execute(request);
321322
if (exitCode != 0) {
322323
throw new FailedExecution(request, exitCode, logFile == null ? "" : Files.readString(logFile));

0 commit comments

Comments
 (0)