diff --git a/.github/workflows/build-reusable.yaml b/.github/workflows/build-reusable.yaml index cc42178d..85729f59 100644 --- a/.github/workflows/build-reusable.yaml +++ b/.github/workflows/build-reusable.yaml @@ -89,7 +89,41 @@ jobs: with: distribution: zulu java-version: ${{ inputs.java-version }} - cache: maven + + # + # Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories + # + # Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots. + # Therefore, it can be reused between builds, even on different architectures. + # Since the size of the cache increases in time, as we download new dependency versions, we reset the cache + # once a month. + # + # WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be + # copied to multiple workflows. + # The `build-reusable` workflow uses `actions/cache`, + # while the other workflows only use `actions/cache/restore` + # + - name: Set up Mimír configuration + shell: bash + run: | + # Compute the key cache + echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV + # Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`. + echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV + + - name: Set up Mimír cache + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3 + with: + # Mimir is a partial mirror of Maven Central. + # Therefore, we only need to clean it from time to time to remove old versions. + # + # However, GitHub caches are immutable, and we need a unique key to update them. + # If no cache hit occurs for this key, we fall back to any other cache. + key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}" + restore-keys: | + ${{ env.MIMIR_KEY }}- + path: .mimir/local + enableCrossOsArchive: true - name: Set up Develocity if: inputs.develocity-enabled diff --git a/.github/workflows/codeql-analysis-reusable.yaml b/.github/workflows/codeql-analysis-reusable.yaml index 2317b25e..5f2783dc 100644 --- a/.github/workflows/codeql-analysis-reusable.yaml +++ b/.github/workflows/codeql-analysis-reusable.yaml @@ -53,7 +53,40 @@ jobs: with: distribution: zulu java-version: ${{ inputs.java-version }} - cache: maven + + # + # Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories + # + # Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots. + # Therefore, it can be reused between builds, even on different architectures. + # Since the size of the cache increases in time, as we download new dependency versions, we reset the cache + # once a month. + # + # WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be + # copied to multiple workflows. + # The `build-reusable` workflow uses `actions/cache`, + # while the other workflows only use `actions/cache/restore` + # + - name: Set up Mimír configuration + shell: bash + run: | + # Compute the key cache + echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV + # Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`. + echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV + + - name: Set up Mimír cache + uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3 + with: + # Mimir is a partial mirror of Maven Central. + # Therefore, we only need to clean it from time to time to remove old versions. + # + # However, GitHub caches are immutable, and we need a unique key to update them. + # If no cache hit occurs for this key, we fall back to any other cache. + key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}" + restore-keys: | + ${{ env.MIMIR_KEY }}- + path: .mimir/local - name: Build with Maven shell: bash diff --git a/.github/workflows/deploy-release-reusable.yaml b/.github/workflows/deploy-release-reusable.yaml index 98215e96..529a5010 100644 --- a/.github/workflows/deploy-release-reusable.yaml +++ b/.github/workflows/deploy-release-reusable.yaml @@ -68,12 +68,45 @@ jobs: with: distribution: zulu java-version: ${{ inputs.java-version }} - cache: maven server-id: apache.releases.https server-username: NEXUS_USERNAME server-password: NEXUS_PASSWORD gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} + # + # Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories + # + # Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots. + # Therefore, it can be reused between builds, even on different architectures. + # Since the size of the cache increases in time, as we download new dependency versions, we reset the cache + # once a month. + # + # WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be + # copied to multiple workflows. + # The `build-reusable` workflow uses `actions/cache`, + # while the other workflows only use `actions/cache/restore` + # + - name: Set up Mimír configuration + shell: bash + run: | + # Compute the key cache + echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV + # Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`. + echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV + + - name: Set up Mimír cache + uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3 + with: + # Mimir is a partial mirror of Maven Central. + # Therefore, we only need to clean it from time to time to remove old versions. + # + # However, GitHub caches are immutable, and we need a unique key to update them. + # If no cache hit occurs for this key, we fall back to any other cache. + key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}" + restore-keys: | + ${{ env.MIMIR_KEY }}- + path: .mimir/local + - name: Set up Git user shell: bash run: | diff --git a/.github/workflows/deploy-site-reusable.yaml b/.github/workflows/deploy-site-reusable.yaml index 2464864a..24fa1ab3 100644 --- a/.github/workflows/deploy-site-reusable.yaml +++ b/.github/workflows/deploy-site-reusable.yaml @@ -61,9 +61,42 @@ jobs: with: distribution: zulu java-version: ${{ inputs.java-version }} - cache: maven gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} + # + # Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories + # + # Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots. + # Therefore, it can be reused between builds, even on different architectures. + # Since the size of the cache increases in time, as we download new dependency versions, we reset the cache + # once a month. + # + # WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be + # copied to multiple workflows. + # The `build-reusable` workflow uses `actions/cache`, + # while the other workflows only use `actions/cache/restore` + # + - name: Set up Mimír configuration + shell: bash + run: | + # Compute the key cache + echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV + # Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`. + echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV + + - name: Set up Mimír cache + uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3 + with: + # Mimir is a partial mirror of Maven Central. + # Therefore, we only need to clean it from time to time to remove old versions. + # + # However, GitHub caches are immutable, and we need a unique key to update them. + # If no cache hit occurs for this key, we fall back to any other cache. + key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}" + restore-keys: | + ${{ env.MIMIR_KEY }}- + path: .mimir/local + - name: Build the project shell: bash if: inputs.install-required diff --git a/.github/workflows/deploy-snapshot-reusable.yaml b/.github/workflows/deploy-snapshot-reusable.yaml index c1b1c3dc..3c2e89a2 100644 --- a/.github/workflows/deploy-snapshot-reusable.yaml +++ b/.github/workflows/deploy-snapshot-reusable.yaml @@ -51,11 +51,44 @@ jobs: with: distribution: zulu java-version: ${{ inputs.java-version }} - cache: maven server-id: apache.snapshots.https server-username: NEXUS_USERNAME server-password: NEXUS_PASSWORD + # + # Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories + # + # Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots. + # Therefore, it can be reused between builds, even on different architectures. + # Since the size of the cache increases in time, as we download new dependency versions, we reset the cache + # once a month. + # + # WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be + # copied to multiple workflows. + # The `build-reusable` workflow uses `actions/cache`, + # while the other workflows only use `actions/cache/restore` + # + - name: Set up Mimír configuration + shell: bash + run: | + # Compute the key cache + echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV + # Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`. + echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV + + - name: Set up Mimír cache + uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3 + with: + # Mimir is a partial mirror of Maven Central. + # Therefore, we only need to clean it from time to time to remove old versions. + # + # However, GitHub caches are immutable, and we need a unique key to update them. + # If no cache hit occurs for this key, we fall back to any other cache. + key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}" + restore-keys: | + ${{ env.MIMIR_KEY }}- + path: .mimir/local + - name: Export version id: version shell: bash diff --git a/.github/workflows/merge-dependabot-reusable.yaml b/.github/workflows/merge-dependabot-reusable.yaml index 7bf058ad..fc03dcac 100644 --- a/.github/workflows/merge-dependabot-reusable.yaml +++ b/.github/workflows/merge-dependabot-reusable.yaml @@ -78,12 +78,45 @@ jobs: with: distribution: zulu java-version: ${{ inputs.java-version }} - cache: maven server-id: apache.releases.https server-username: NEXUS_USERNAME server-password: NEXUS_PASSWORD gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} + # + # Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories + # + # Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots. + # Therefore, it can be reused between builds, even on different architectures. + # Since the size of the cache increases in time, as we download new dependency versions, we reset the cache + # once a month. + # + # WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be + # copied to multiple workflows. + # The `build-reusable` workflow uses `actions/cache`, + # while the other workflows only use `actions/cache/restore` + # + - name: Set up Mimír configuration + shell: bash + run: | + # Compute the key cache + echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV + # Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`. + echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV + + - name: Set up Mimír cache + uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3 + with: + # Mimir is a partial mirror of Maven Central. + # Therefore, we only need to clean it from time to time to remove old versions. + # + # However, GitHub caches are immutable, and we need a unique key to update them. + # If no cache hit occurs for this key, we fall back to any other cache. + key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}" + restore-keys: | + ${{ env.MIMIR_KEY }}- + path: .mimir/local + - name: Find the release version major shell: bash run: | diff --git a/.github/workflows/verify-reproducibility-reusable.yaml b/.github/workflows/verify-reproducibility-reusable.yaml index 33a40134..98b03863 100644 --- a/.github/workflows/verify-reproducibility-reusable.yaml +++ b/.github/workflows/verify-reproducibility-reusable.yaml @@ -61,7 +61,40 @@ jobs: with: distribution: zulu java-version: ${{ inputs.java-version }} - cache: maven + + # + # Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories + # + # Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots. + # Therefore, it can be reused between builds, even on different architectures. + # Since the size of the cache increases in time, as we download new dependency versions, we reset the cache + # once a month. + # + # WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be + # copied to multiple workflows. + # The `build-reusable` workflow uses `actions/cache`, + # while the other workflows only use `actions/cache/restore` + # + - name: Set up Mimír configuration + shell: bash + run: | + # Compute the key cache + echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV + # Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`. + echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV + + - name: Set up Mimír cache + uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3 + with: + # Mimir is a partial mirror of Maven Central. + # Therefore, we only need to clean it from time to time to remove old versions. + # + # However, GitHub caches are immutable, and we need a unique key to update them. + # If no cache hit occurs for this key, we fall back to any other cache. + key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}" + restore-keys: | + ${{ env.MIMIR_KEY }}- + path: .mimir/local # `clean verify artifact:compare` is required to generate the build reproducibility report. # For details, see: https://maven.apache.org/guides/mini/guide-reproducible-builds.html#how-to-test-my-maven-build-reproducibility diff --git a/.gitignore b/.gitignore index 712b37bc..b08e3ee5 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ # Maven target/ .flattened-pom.xml +/.mimir/ /.mvn/extensions.xml /.mvn/wrapper/maven-wrapper.jar # IDEA diff --git a/pom.xml b/pom.xml index f8036c7a..ab71e7de 100644 --- a/pom.xml +++ b/pom.xml @@ -227,6 +227,7 @@ 0.8.13 0.9.0 3.6.0 + 0.7.4 2.6.1 4.9.3.0 2.44.4 @@ -362,6 +363,12 @@ ${maven-artifact-plugin.version} + + eu.maveniverse.maven.mimir + extension + ${mimir.version} + + com.github.spotbugs spotbugs-maven-plugin @@ -956,6 +963,16 @@ + + + eu.maveniverse.maven.mimir + extension + true + + diff --git a/src/changelog/.12.x.x/add-mimir.xml b/src/changelog/.12.x.x/add-mimir.xml new file mode 100644 index 00000000..8d354445 --- /dev/null +++ b/src/changelog/.12.x.x/add-mimir.xml @@ -0,0 +1,8 @@ + + + + Use Mimír instead of Maven local repository cache. +