Giter Site home page Giter Site logo

maven-gh-actions-shared's Introduction

Apache Maven Shared GitHub Actions

Usage

Create GitHub workflow in project file:

.github/workflows/maven-verify.yml

with content:

# 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:
  push:
  pull_request:

jobs:
  build:
    name: Verify
    uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4

Events that can trigger workflows

In such configuration workflow can be executed in the same time twice for two separate events.

It can occurs when we create PR for branch from the same repository, we have two events:

  • push on branch
  • pull_request on PR for the same branch

In order to minimize resource consumptions shared workflow from version v2 detect such situation and skips the execution for pull_request event if PR is created for local branch.

Only workflow for PR from external forks will be executed.

Breaking changes in V3

  • replace maven_version by maven-matrix and ff-maven
  • rename maven_args to maven-args
  • remove not used verify-site-goal

Additional configurations

Attach logs on failure

We can store some logs of execution in case of failure as workflow attachments:

...
    uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
    with:
      failure-upload-path: |
        **/target/surefire-reports/*

Excludes from build matrix:

...
    uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
    with:
      matrix-exclude: >
        [ 
          {"jdk": "8"},   # exclude jdk 8 from all builds
          {"os": "windows-latest"}, # exclude windows from all builds
          {"jdk": "8", "os": "windows-latest"} # exclude jkd 8 on windows
        ]

Change default goals

...
    uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
    with:
      ff-goal: 'install'
      verify-goal: 'install -P run-its'

Testing against different Maven versions

...
    uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
    with:
      ff-maven: "3.8.6"                     # Maven version for fail-fast-build
      maven-matrix: '[ "3.2.5", "3.8.6" ]'  # Maven versions matrix for verify builds

More options

More options with default values can be found in workflow source in inputs section:

https://github.com/apache/maven-gh-actions-shared/blob/v4/.github/workflows/maven-verify.yml

Resources

maven-gh-actions-shared's People

Contributors

cstamas avatar hboutemy avatar olamy avatar slachiewicz avatar slawekjaranowski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.