-
-
Notifications
You must be signed in to change notification settings - Fork 595
229 lines (213 loc) · 8.4 KB
/
Copy pathci.yml
File metadata and controls
229 lines (213 loc) · 8.4 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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# SPDX-License-Identifier: Apache-2.0
# Copyright Red Hat Inc. and Hibernate Authors
# The main CI of Hibernate Validator is https://ci.hibernate.org/job/hibernate-validator/.
# However, Hibernate Validator builds run on GitHub actions regularly
# to build on Windows
# and check that both the Linux and Windows workflows still work
# and can be used in GitHub forks.
# See https://docs.github.com/en/actions
# for more information about GitHub actions.
name: GH Actions CI
on:
push:
branches:
# Pattern order matters: the last matching inclusion/exclusion wins
- '**'
- '!4.*'
- '!5.*'
- '!6.*'
- '!7.*'
- '!8.*'
- '!dependabot/**'
tags:
- '**'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
# Pattern order matters: the last matching inclusion/exclusion wins
- '**'
- '!4.*'
- '!5.*'
- '!6.*'
- '!7.*'
- '!8.*'
# Ignore dependabot PRs that are not just about build dependencies;
# we'll reject such dependant PRs and send a PR ourselves.
- '!dependabot/**'
- 'dependabot/maven/build-dependencies-**'
concurrency:
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'hibernate/hibernate-validator' }}
defaults:
run:
shell: bash
env:
MAVEN_ARGS: "-e -B --settings .github/mvn-settings.xml --fail-at-end -Pci-build --no-transfer-progress"
permissions:
contents: read
jobs:
build:
name: ${{matrix.os.name}}
runs-on: ${{ matrix.os.runs-on }}
strategy:
fail-fast: false
matrix:
os:
- {
name: "Linux JDK 25",
runs-on: 'ubuntu-latest',
java: {
version: 25
},
maven: {
args: '-Pcoverage'
},
reporting: {
coverage: true,
docs-preview: true
}
}
- {
name: "Windows JDK 25",
runs-on: 'windows-latest',
java: {
version: 25
},
maven: {
args: ''
},
reporting: {
coverage: false,
docs-preview: false
}
}
steps:
- name: Support longpaths on Windows
if: "startsWith(matrix.os.runs-on, 'windows')"
run: git config --global core.longpaths true
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
with:
persist-credentials: false
- name: Set up Java ${{ matrix.os.java.version }}
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # 5.6.0
with:
java-version: ${{ matrix.os.java.version }}
distribution: temurin
# https://github.com/actions/cache/blob/main/examples.md#java---maven
- name: Cache local Maven repository
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # 6.1.0
with:
path: ~/.m2/repository
# use a different key than workflows running in trusted mode
key: ${{ github.event_name == 'push' && 'trusted' || 'untrusted' }}-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ github.event_name == 'push' && 'trusted' || 'untrusted' }}-${{ runner.os }}-maven-
- name: Set up Maven
run: ./mvnw -v
- name: Build code and run tests and basic checks (Standalone)
run: |
read -ra mvn_args <<< "$MAVEN_ARGS"
read -ra mvn_matrix_args <<< "$MAVEN_MATRIX_ARGS"
./mvnw "${mvn_args[@]}" "${mvn_matrix_args[@]}" clean install \
-Pjqassistant -Pdist -Dsurefire.environment=standalone
env:
DEVELOCITY_ACCESS_KEY: "${{ secrets.DEVELOCITY_ACCESS_KEY || '' }}"
DEVELOCITY_BASE_URL: "${{ env.DEVELOCITY_BASE_URL || 'https://develocity.commonhaus.dev' }}"
MAVEN_MATRIX_ARGS: ${{ matrix.os.maven.args }}
# For jobs running on 'pull_request', upload build scan data.
# The actual publishing must be done in a separate job (see ci-report.yml).
# We don't write to the remote cache as that would be unsafe.
- name: Upload GitHub Actions artifact for the Develocity build scan
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
if: "${{ github.event_name == 'pull_request' && !cancelled() }}"
with:
name: build-scan-data-standalone-${{ matrix.os.name }}
path: ~/.m2/.develocity/build-scan-data
- name: Store coverage report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
if: ${{ matrix.os.reporting.coverage }}
with:
name: build-coverage-data-standalone
retention-days: 1
path: |
./**/coverage/jacoco-*.exec
- name: Upload docs preview
if: ${{ matrix.os.reporting.docs-preview }}
uses: hibernate/.github/actions/build-docs-preview@f95c7959b0b60c30a8c006cf506f25141d759575 # main
with:
dist-path: 'documentation/target/dist'
src-paths: |
documentation/src
- name: Run TCK tests in container mode
run: |
read -ra mvn_args <<< "$MAVEN_ARGS"
read -ra mvn_matrix_args <<< "$MAVEN_MATRIX_ARGS"
./mvnw "${mvn_args[@]}" "${mvn_matrix_args[@]}" clean verify \
-Pjqassistant -Pskip-checks \
-am -pl :hibernate-validator-tck-runner \
-Dincontainer -Dincontainer-prepared -Dsurefire.environment=incontainer
env:
DEVELOCITY_ACCESS_KEY: "${{ secrets.DEVELOCITY_ACCESS_KEY || '' }}"
DEVELOCITY_BASE_URL: "${{ env.DEVELOCITY_BASE_URL || 'https://develocity.commonhaus.dev' }}"
MAVEN_MATRIX_ARGS: ${{ matrix.os.maven.args }}
- name: Upload GitHub Actions artifact for the Develocity build scan
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
if: "${{ github.event_name == 'pull_request' && !cancelled() }}"
with:
name: build-scan-data-incontainer-${{ matrix.os.name }}
path: ~/.m2/.develocity/build-scan-data
- name: Store coverage report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
if: ${{ matrix.os.reporting.coverage }}
with:
name: build-coverage-data-incontainer
retention-days: 1
path: |
./**/coverage/jacoco-*.exec
- name: Omit produced artifacts from build cache
run: rm -r ~/.m2/repository/org/hibernate/validator
prepare-sonar-bundle:
name: Prepare build bundle for Sonar scanner
needs: build
if: always() && !cancelled() && needs.build.result != 'cancelled'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
with:
persist-credentials: false
- name: Set up Java 25
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # 5.6.0
with:
java-version: 25
distribution: temurin
- name: Cache local Maven repository
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # 6.1.0
with:
path: ~/.m2/repository
key: trusted-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
trusted-${{ runner.os }}-maven-
- name: Download coverage reports
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
with:
pattern: build-coverage-data-*
path: .
merge-multiple: 'true'
continue-on-error: true
- name: Merge JaCoCo reports
run: |
read -ra mvn_args <<< "$MAVEN_ARGS"
./mvnw "${mvn_args[@]}" package \
-Pskip-checks -Pcoverage-report \
-DskipTests
- name: Store build info for Sonar scanning
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
with:
name: build-results-data
retention-days: 1
path: |
./**/target/classes/
./**/coverage/jacoco-*.exec
build/reports/target/site/jacoco-aggregate/jacoco.xml
build/reports/target/sonar-dependencies/