blob: 965f5428085b6fb96713c76421524c87d721cd2c [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 all Maven commands when building the code
required: false
default: '-D"invoker.streamLogsOnFailures"'
type: string
maven_version:
description: The Maven version used for builds
required: false
default: '3.8.4'
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
# fail fast job setup
ff-os:
description: The os used during fail-fast-build job
required: false
default: 'ubuntu-latest'
type: string
ff-jdk:
description: The jdk version used during fail-fast-build job
required: false
default: '11'
type: string
ff-jdk-distribution:
description: The jdk distribution used during fail-fast-build job
required: false
default: 'temurin'
type: string
ff-goal:
description: The Maven goal used by fail-fast-build job
required: false
default: '-P run-its verify'
type: string
ff-site-goal:
description: The Maven goal used by fail-fast-build job to build site
required: false
default: '-DskipTests -P reporting site'
type: string
verify-goal:
description: The Maven goal used by verfy jobs
required: false
default: '-P run-its verify'
type: string
verify-site-goal:
description: The Maven goal used by verfy jobs to build site
required: false
default: '-DskipTests -P reporting site'
type: string
verify-fail-fast:
description: Determinate if verification matrix should fail fast
required: false
default: true
type: boolean
jobs:
# verify build on one node - before matrix will start
fail-fast-build:
name: ${{ inputs.ff-os }} jdk-${{ inputs.ff-jdk }}-${{ inputs.ff-jdk-distribution }}
runs-on: ${{ inputs.ff-os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.ff-jdk }}
distribution: ${{ inputs.ff-jdk-distribution }}
cache: 'maven'
- name: Set up Maven
run: mvn --errors --batch-mode --show-version wrapper:wrapper "-Dmaven=${{ inputs.maven_version }}"
- name: Build with Maven
run: ./mvnw --errors --batch-mode --show-version ${{ inputs.maven_args }} ${{ inputs.ff-goal }}
- name: Build Maven Site
run: ./mvnw --errors --batch-mode --show-version ${{ inputs.maven_args }} ${{ inputs.ff-site-goal }}
verify:
needs: fail-fast-build
name: ${{ matrix.os }} jdk-${{ matrix.jdk }}-${{ matrix.distribution }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: ${{ inputs.verify-fail-fast }}
matrix:
os: ${{ fromJSON( inputs.os-matrix ) }}
jdk: ${{ fromJSON( inputs.jdk-matrix ) }}
distribution: ${{ fromJSON( inputs.jdk-distribution-matrix ) }}
exclude: ${{ fromJSON( inputs.matrix-exclude ) }}
steps:
- name: Should run
id: should-run
if: >
matrix.os != inputs.ff-os ||
matrix.jdk != inputs.ff-jdk ||
matrix.distribution != inputs.ff-jdk-distribution ||
inputs.verify-goal != inputs.ff-goal ||
inputs.verify-site-goal != inputs.ff-site-goal
run: echo ok
- name: Checkout
if: steps.should-run.conclusion == 'success'
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up JDK
if: steps.should-run.conclusion == 'success'
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk }}
distribution: ${{ matrix.distribution }}
cache: 'maven'
- name: Set up Maven
if: steps.should-run.conclusion == 'success'
run: mvn --errors --batch-mode --show-version wrapper:wrapper "-Dmaven=${{ inputs.maven_version }}"
- name: Build with Maven
if: steps.should-run.conclusion == 'success'
run: ./mvnw --errors --batch-mode --show-version ${{ inputs.maven_args }} ${{ inputs.verify-goal }}
- name: Build Maven Site
if: steps.should-run.conclusion == 'success'
run: ./mvnw --errors --batch-mode --show-version ${{ inputs.maven_args }} ${{ inputs.verify-site-goal }}