blob: a5756f3486a7780078f86255304bb278704f5942 [file] [log] [blame]
# 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: Verify
on:
workflow_call:
inputs:
maven_args:
description: The arguments to pass to Maven when building the code
required: false
default: -P run-its -D"invoker.streamLogsOnFailures"
type: string
os-matrix:
description: 'os matrix as json array'
required: false
default: '[ "ubuntu-latest", "windows-latest", "macOS-latest" ]'
type: string
jdk-matrix:
description: 'jdk matrix as json array'
required: false
default: '[ "8", "11", "17" ]'
type: string
matrix-exclude:
description: 'exclude for matrix as json'
required: false
default: '[]'
type: string
jdk-distribution-matrix:
description: "jdk distribution matrix"
required: false
default: '[ "temurin" ]'
type: string
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
ff-os: ${{ steps.setup.outputs.ff-os }}
ff-jdk: ${{ steps.setup.outputs.ff-jdk }}
ff-jdk-distribution: ${{ steps.setup.outputs.ff-jdk-distribution }}
ff-excludes: ${{ steps.excludes.outputs.ff-excludes }}
steps:
# get first items from matrix for fail-fast
- id: setup
run: |
echo '::set-output name=ff-os::${{ fromJSON( inputs.os-matrix )[0] }}'
echo '::set-output name=ff-jdk::${{ fromJSON( inputs.jdk-matrix )[0] }}'
echo '::set-output name=ff-jdk-distribution::${{ fromJSON( inputs.jdk-distribution-matrix )[0] }}'
# prepare excludes for verify matrix in order to not run the same build twice
- id: excludes
run: |
EXCLUDES=$(echo '${{ inputs.matrix-exclude }}' | jq -rc '. + [{
"os": "${{ steps.setup.outputs.ff-os }}",
"jdk": "${{ steps.setup.outputs.ff-jdk }}",
"distribution": "${{ steps.setup.outputs.ff-jdk-distribution }}"
}]')
echo "::set-output name=ff-excludes::$EXCLUDES"
build:
needs: setup
name: ${{ needs.setup.outputs.ff-os }} jdk-${{ needs.setup.outputs.ff-jdk }}-${{ needs.setup.outputs.ff-jdk-distribution }}
runs-on: ${{ needs.setup.outputs.ff-os }}
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Set up JDK
uses: actions/setup-java@v2.3.1
with:
java-version: ${{ needs.setup.outputs.ff-jdk }}
distribution: ${{ needs.setup.outputs.ff-jdk-distribution }}
cache: 'maven'
- name: Build with Maven
run: mvn --errors --batch-mode --show-version ${{ inputs.maven_args }} verify
verify:
needs: [ setup, build ]
name: ${{ matrix.os }} jdk-${{ matrix.jdk }}-${{ matrix.distribution }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ${{ fromJSON( inputs.os-matrix ) }}
jdk: ${{ fromJSON( inputs.jdk-matrix ) }}
distribution: ${{ fromJSON( inputs.jdk-distribution-matrix ) }}
exclude: ${{ fromJSON( needs.setup.outputs.ff-excludes ) }}
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Set up JDK
uses: actions/setup-java@v2.3.1
with:
java-version: ${{ matrix.jdk }}
distribution: ${{ matrix.distribution }}
cache: 'maven'
- name: Build with Maven
run: mvn --errors --batch-mode --show-version ${{ inputs.maven_args }} verify
- name: Build Maven Site
run: mvn --errors --batch-mode --show-version ${{ inputs.maven_args }} site