Skip to content

Commit

Permalink
[MNG-7339] Verify Maven can build itself
Browse files Browse the repository at this point in the history
Closes #613.
  • Loading branch information
ManagedServicesDevOpsTeam3 authored and mthmulders committed Dec 13, 2021
1 parent 3a06530 commit 16dd31a
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/maven_build_itself.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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]

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
java: [8, 11, 17]
fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'

- name: Build with Maven
run: mvn verify -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 }}\" succesfully 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: mvn clean

- name: Build again with Maven SNAPSHOT
shell: bash
run: |
set +e
export PATH=${{ env.TEMP_MAVEN_BIN_DIR }}:$PATH
mvn verify -e -B -V -DdistributionFileName=apache-maven

0 comments on commit 16dd31a

Please sign in to comment.