2020-06-28 16:12:55 -04:00
|
|
|
# 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: Java CI
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
|
|
fail-fast: false
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Set up cache for ~./m2/repository
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/.m2/repository
|
2020-07-01 05:30:40 -04:00
|
|
|
key: maven-${{ matrix.os }}-${{ hashFiles('**/pom.xml') }}
|
2020-06-28 16:12:55 -04:00
|
|
|
restore-keys: |
|
|
|
|
maven-${{ matrix.os }}-
|
|
|
|
|
|
|
|
- name: Set up JDK
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
2020-07-01 05:30:40 -04:00
|
|
|
java-version: 8
|
2020-06-28 16:12:55 -04:00
|
|
|
|
|
|
|
- name: Build with Maven
|
|
|
|
run: mvn verify -e -B -V -DdistributionFileName=apache-maven
|
|
|
|
|
|
|
|
- name: Upload built Maven
|
|
|
|
uses: actions/upload-artifact@v2
|
2020-07-01 05:30:40 -04:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
2020-06-28 16:12:55 -04:00
|
|
|
with:
|
|
|
|
name: built-maven
|
|
|
|
path: apache-maven/target/
|
|
|
|
|
|
|
|
- name: Upload built Maven Wrapper
|
|
|
|
uses: actions/upload-artifact@v2
|
2020-07-01 05:30:40 -04:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
2020-06-28 16:12:55 -04:00
|
|
|
with:
|
|
|
|
name: built-maven-wrapper
|
|
|
|
path: maven-wrapper/target/maven-wrapper.jar
|
|
|
|
|
|
|
|
integration-test:
|
|
|
|
needs: build
|
2020-07-01 05:30:40 -04:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
2020-09-20 05:53:53 -04:00
|
|
|
java: [8, 11, 15, 16-ea]
|
2020-07-01 05:30:40 -04:00
|
|
|
fail-fast: false
|
|
|
|
runs-on: ${{ matrix.os }}
|
2020-06-28 16:12:55 -04:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Collect environment context variables
|
|
|
|
shell: bash
|
2020-09-23 04:52:04 -04:00
|
|
|
env:
|
|
|
|
PR_HEAD_LABEL: ${{ github.event.pull_request.head.label }}
|
2020-06-28 16:12:55 -04:00
|
|
|
run: |
|
|
|
|
set +e
|
|
|
|
repo=maven-integration-testing
|
|
|
|
target_branch=master
|
|
|
|
target_user=apache
|
2020-09-23 04:52:04 -04:00
|
|
|
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
|
|
|
|
user=${PR_HEAD_LABEL%:*}
|
|
|
|
branch=${PR_HEAD_LABEL#*:}
|
|
|
|
else
|
|
|
|
user=${GITHUB_REPOSITORY%/*}
|
|
|
|
branch=${GITHUB_REF#refs/heads/}
|
|
|
|
fi
|
2020-06-28 16:12:55 -04:00
|
|
|
if [ $branch != "master" ]; then
|
2020-09-23 04:52:04 -04:00
|
|
|
git ls-remote https://github.com/$user/$repo.git | grep "refs/heads/${branch}$" > /dev/null
|
2020-06-28 16:12:55 -04:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "Found a branch \"$branch\" in fork \"$user/$repo\", configuring this for the integration tests to be run against."
|
|
|
|
target_branch=$branch
|
|
|
|
target_user=$user
|
|
|
|
else
|
|
|
|
echo "Could not find fork \"$user/$repo\" or a branch \"$branch\" in this fork. Falling back to \"$target_branch\" in \"$target_user/$repo\"."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Integration tests will run against $target_user/$repo for master builds."
|
|
|
|
fi
|
|
|
|
echo "::set-env name=REPO_BRANCH::$target_branch"
|
|
|
|
echo "::set-env name=REPO_USER::$target_user"
|
|
|
|
|
|
|
|
- name: Checkout maven-integration-testing
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: ${{ env.REPO_USER }}/maven-integration-testing
|
|
|
|
path: maven-integration-testing/
|
|
|
|
ref: ${{ env.REPO_BRANCH }}
|
|
|
|
|
|
|
|
- name: Download built Maven
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: built-maven
|
|
|
|
path: built-maven/
|
|
|
|
|
|
|
|
- name: Download built Maven Wrapper
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: built-maven-wrapper
|
|
|
|
path: built-maven-wrapper/
|
|
|
|
|
2020-07-01 05:30:40 -04:00
|
|
|
- name: Set up JDK
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
|
|
|
java-version: ${{ matrix.java }}
|
|
|
|
|
2020-06-28 16:12:55 -04:00
|
|
|
- name: Running integration tests
|
2020-07-01 05:30:40 -04:00
|
|
|
shell: bash
|
2020-08-17 03:57:59 -04:00
|
|
|
run: mvn install -e -B -V -Prun-its,embedded -Dmaven.repo.local=$GITHUB_WORKSPACE/repo/ -DmavenDistro="$GITHUB_WORKSPACE/built-maven/apache-maven-bin.zip" -DwrapperDistroDir="$GITHUB_WORKSPACE/built-maven/" -DmavenWrapper="$GITHUB_WORKSPACE/built-maven-wrapper/maven-wrapper.jar" -f maven-integration-testing/pom.xml
|