Repository navigation
49 lines (48 loc) · 1.59 KB
/
Copy pathbuild.yml
File metadata and controls
49 lines (48 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Build
on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- master
jobs:
maven-build:
name: "${{ matrix.os }}, jdk-${{ matrix.jdk }}, ${{ matrix.distribution }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-11, windows-2022]
jdk: [11, 17]
distribution: ["adopt", "temurin", "zulu"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.jdk }} with ${{ matrix.distribution }} distribution
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.jdk }}
distribution: ${{ matrix.distribution }}
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
build-result:
runs-on: ubuntu-latest
needs: [maven-build]
if: ${{ always() }}
steps:
- uses: actions/checkout@v2
- name: Collect build result
run: |
#!/bin/bash
# This script collects the result of the maven-build jobs
# It will check if any job was cancelled or failed
# If any cancelled or failed job is found, it will log a message and exit with a non-zero status code
# Otherwise, it will log a success message and exit with a zero status code
for job in "${{ needs.maven-build.result }}"; do
if [[ "$job" == "cancelled" || "$job" == "failure" ]]; then
echo "There are failed/cancelled builds"
exit 1
fi
done
echo "All builds are successful/skipped"
exit 0