Skip to content

HDDS-15673. Use Java 25 in CI (#10625) #971

HDDS-15673. Use Java 25 in CI (#10625)

HDDS-15673. Use Java 25 in CI (#10625) #971

# 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.
# This workflow creates cache with Maven dependencies for Ozone build.
name: populate-cache
on:
push:
branches:
- master
- ozone-1.4
- ozone-2.0
- ozone-2.1
paths:
- 'pom.xml'
- '**/pom.xml'
- '.github/workflows/populate-cache.yml'
workflow_call:
workflow_dispatch:
permissions: { }
env:
# variables are duplicated from ci.yml, please keep in sync
BUILD_ARGS: "-Pdist -Psrc -Dmaven.javadoc.skip=true -Drocks_tools_native"
TEST_JAVA_VERSION: 25 # JDK version used by CI build and tests; should match the JDK version in apache/ozone-runner image
MAVEN_ARGS: --batch-mode --settings ${{ github.workspace }}/dev-support/ci/maven-settings.xml
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout project
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Restore cache for Maven dependencies
id: restore-cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/ozone
key: maven-repo-${{ hashFiles('**/pom.xml') }}
- name: Setup Java
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with:
distribution: 'temurin'
java-version: ${{ env.TEST_JAVA_VERSION }}
- name: Get NodeJS version
id: nodejs-version
if: steps.restore-cache.outputs.cache-hit != 'true'
run: echo "nodejs-version=$(mvn help:evaluate -Dexpression=nodejs.version -q -DforceStdout -Dscan=false)" >> $GITHUB_OUTPUT
- name: Restore NodeJS tarballs
id: restore-nodejs
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.m2/repository/com/github/eirslett/node
key: nodejs-${{ steps.nodejs-version.outputs.nodejs-version }}
- name: Download NodeJS
if: steps.restore-cache.outputs.cache-hit != 'true' && steps.restore-nodejs.outputs.cache-hit != 'true'
run: dev-support/ci/download-nodejs.sh
env:
NODEJS_VERSION: ${{ steps.nodejs-version.outputs.nodejs-version }}
- name: Fetch dependencies
if: steps.restore-cache.outputs.cache-hit != 'true'
run: mvn $BUILD_ARGS $MAVEN_ARGS --no-transfer-progress --show-version -Pgo-offline clean verify
- name: Setup Java 8
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with:
distribution: 'temurin'
java-version: 8
- name: Fetch dependencies for Java 8
if: steps.restore-cache.outputs.cache-hit != 'true'
run: mvn $MAVEN_ARGS --no-transfer-progress --show-version -Pgo-offline -DskipRecon -DskipShade test-compile
- name: Delete Ozone jars from repo
if: steps.restore-cache.outputs.cache-hit != 'true'
run: rm -fr ~/.m2/repository/org/apache/ozone
- name: List repo contents
if: always()
run: find ~/.m2/repository -type f | sort | xargs ls -lh
- name: Save cache for Maven dependencies
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/ozone
key: maven-repo-${{ hashFiles('**/pom.xml') }}