Skip to content

[MNG-8230] Rewrite CI friendly versions #4321

[MNG-8230] Rewrite CI friendly versions

[MNG-8230] Rewrite CI friendly versions #4321

# 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.
name: Can Maven build itself
on: [push, pull_request]
# clear all permissions for GITHUB_TOKEN
permissions: {}
jobs:
build:
# execute on any push or pull request from forked repo
if: github.event_name == 'push' || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork )
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
java: [17, 21]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'
- name: Set up Maven
run:
mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper "-Dmaven=3.9.7"
- name: Build with Maven
run: ./mvnw install -e -B -V -DdistributionFileName=apache-maven
- name: Extract tarball
shell: bash
run: |
set +e
if [ -f ${{ env.TAR_BALL }} ]; then
temp_dir=$(mktemp -d)
tar -xzf ${{ env.TAR_BALL }} -C "$temp_dir" --strip 1
maven_bin_dir=$temp_dir/bin
if [ -d $maven_bin_dir ]; then
echo "tar.gz file \"${{ env.TAR_BALL }}\" successfully extracted in temporarily directory \"$temp_dir.\""
echo "TEMP_MAVEN_BIN_DIR=$maven_bin_dir" >> $GITHUB_ENV
else
echo "$maven_bin_dir does not exist."
exit 1;
fi
else
echo "${{ env.TAR_BALL }} does not exist."
exit 1;
fi
env:
TAR_BALL: apache-maven/target/apache-maven-bin.tar.gz
- name: Clean with Maven
run: ./mvnw -e -B -V clean
- name: Build again with Maven SNAPSHOT
shell: bash
run: |
set +e
export PATH=${{ env.TEMP_MAVEN_BIN_DIR }}:$PATH
mvn verify site -e -B -V -DdistributionFileName=apache-maven -Preporting