11
11
branches :
12
12
- ' main'
13
13
- ' wip/**'
14
- # We run the build every hour to check for changes in the snapshots
15
- schedule :
16
- # * is a special character in YAML, so you have to quote this string
17
- # Run every hour at minute 25
18
- - cron : ' 25 * * * *'
19
- # Allow running this workflow against a specific branch/tag
20
- workflow_dispatch :
14
+ workflow_call :
15
+ inputs :
16
+ branch :
17
+ required : true
18
+ type : string
21
19
22
20
# See https://github.com/hibernate/hibernate-orm/pull/4615 for a description of the behavior we're getting.
23
21
concurrency :
24
22
# Consider that two builds are in the same concurrency group (cannot run concurrently)
25
23
# if they use the same workflow and are about the same branch ("ref") or pull request.
26
- group : " workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
24
+ group : " workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}, branch=${{ inputs.branch }} "
27
25
# Cancel previous builds in the same concurrency group even if they are in process
28
26
# for pull requests or pushes to forks (not the upstream repository).
29
27
cancel-in-progress : ${{ github.event_name == 'pull_request' || github.repository != 'hibernate/hibernate-reactive' }}
30
28
31
29
jobs :
32
30
run_examples :
33
31
name : Run examples in '${{ matrix.example }}' on ${{ matrix.db }}
34
- if : ( github.event_name == 'schedule' && startsWith( github.ref, 'refs/heads/wip/' ) ) || ( github.event_name != 'schedule' )
35
32
runs-on : ubuntu-latest
36
33
strategy :
37
34
matrix :
42
39
- example : ' native-sql-example'
43
40
db : ' MySQL'
44
41
services :
45
- # Label used to access the service container
42
+ # Label used to access the service container
46
43
mysql :
47
44
# Docker Hub image
48
45
image : mysql:8.4.0
@@ -75,81 +72,85 @@ jobs:
75
72
ports :
76
73
- 5432:5432
77
74
steps :
78
- - uses : actions/checkout@v2
79
- - name : Get year/month for cache key
80
- id : get-date
81
- run : |
82
- echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
83
- shell : bash
84
- - name : Cache Gradle downloads
85
- uses : actions/cache@v2
86
- id : cache-gradle
87
- with :
88
- path : |
89
- .gradle/caches
90
- .gradle/jdks
91
- .gradle/wrapper
92
- # refresh cache every month to avoid unlimited growth
93
- key : gradle-examples-${{ matrix.db }}-${{ steps.get-date.outputs.yearmonth }}
94
- - name : Set up JDK 11
95
-
96
- with :
97
- distribution : ' temurin'
98
- java-version : 11
99
- - name : Print the effective ORM version used
100
- run : ./gradlew :${{ matrix.example }}:dependencyInsight --dependency org.hibernate.orm:hibernate-core
101
- - name : Run examples in '${{ matrix.example }}' on ${{ matrix.db }}
102
- run : ./gradlew :${{ matrix.example }}:runAllExamplesOn${{ matrix.db }}
103
- - name : Upload reports (if build failed)
104
- uses : actions/upload-artifact@v2
105
- if : failure()
106
- with :
107
- name : reports-examples-${{ matrix.db }}
108
- path : ' ./**/build/reports/'
75
+ - name : Checkout ${{ inputs.branch }}
76
+ uses : actions/checkout@v2
77
+ with :
78
+ ref : ${{ inputs.branch }}
79
+ - name : Get year/month for cache key
80
+ id : get-date
81
+ run : |
82
+ echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
83
+ shell : bash
84
+ - name : Cache Gradle downloads
85
+ uses : actions/cache@v2
86
+ id : cache-gradle
87
+ with :
88
+ path : |
89
+ .gradle/caches
90
+ .gradle/jdks
91
+ .gradle/wrapper
92
+ # refresh cache every month to avoid unlimited growth
93
+ key : gradle-examples-${{ matrix.db }}-${{ steps.get-date.outputs.yearmonth }}
94
+ - name : Set up JDK 11
95
+
96
+ with :
97
+ distribution : ' temurin'
98
+ java-version : 11
99
+ - name : Print the effective ORM version used
100
+ run : ./gradlew :${{ matrix.example }}:dependencyInsight --dependency org.hibernate.orm:hibernate-core
101
+ - name : Run examples in '${{ matrix.example }}' on ${{ matrix.db }}
102
+ run : ./gradlew :${{ matrix.example }}:runAllExamplesOn${{ matrix.db }}
103
+ - name : Upload reports (if build failed)
104
+ uses : actions/upload-artifact@v2
105
+ if : failure()
106
+ with :
107
+ name : reports-examples-${{ matrix.db }}
108
+ path : ' ./**/build/reports/'
109
109
110
110
test_dbs :
111
111
name : Test with ${{ matrix.db }}
112
- if : ( github.event_name == 'schedule' && startsWith( github.ref, 'refs/heads/wip/' ) ) || ( github.event_name != 'schedule' )
113
112
runs-on : ubuntu-latest
114
113
strategy :
115
114
matrix :
116
115
db : [ 'MariaDB', 'MySQL', 'PostgreSQL', 'MSSQLServer', 'CockroachDB', 'Db2', 'Oracle' ]
117
116
steps :
118
- - uses : actions/checkout@v2
119
- - name : Get year/month for cache key
120
- id : get-date
121
- run : |
122
- echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
123
- shell : bash
124
- - name : Cache Gradle downloads
125
- uses : actions/cache@v2
126
- id : cache-gradle
127
- with :
128
- path : |
129
- .gradle/caches
130
- .gradle/jdks
131
- .gradle/wrapper
132
- # refresh cache every month to avoid unlimited growth
133
- key : gradle-db-${{ matrix.db }}-${{ steps.get-date.outputs.yearmonth }}
134
- - name : Set up JDK 11
135
-
136
- with :
137
- distribution : ' temurin'
138
- java-version : 11
139
- - name : Print the effective ORM version used
140
- run : ./gradlew :hibernate-reactive-core:dependencyInsight --dependency org.hibernate.orm:hibernate-core
141
- - name : Build and Test with ${{ matrix.db }}
142
- run : ./gradlew build -PshowStandardOutput -Pdocker -Pdb=${{ matrix.db }}
143
- - name : Upload reports (if build failed)
144
- uses : actions/upload-artifact@v2
145
- if : failure()
146
- with :
147
- name : reports-db-${{ matrix.db }}
148
- path : ' ./**/build/reports/'
117
+ - name : Checkout ${{ inputs.branch }}
118
+ uses : actions/checkout@v2
119
+ with :
120
+ ref : ${{ inputs.branch }}
121
+ - name : Get year/month for cache key
122
+ id : get-date
123
+ run : |
124
+ echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
125
+ shell : bash
126
+ - name : Cache Gradle downloads
127
+ uses : actions/cache@v2
128
+ id : cache-gradle
129
+ with :
130
+ path : |
131
+ .gradle/caches
132
+ .gradle/jdks
133
+ .gradle/wrapper
134
+ # refresh cache every month to avoid unlimited growth
135
+ key : gradle-db-${{ matrix.db }}-${{ steps.get-date.outputs.yearmonth }}
136
+ - name : Set up JDK 11
137
+
138
+ with :
139
+ distribution : ' temurin'
140
+ java-version : 11
141
+ - name : Print the effective ORM version used
142
+ run : ./gradlew :hibernate-reactive-core:dependencyInsight --dependency org.hibernate.orm:hibernate-core
143
+ - name : Build and Test with ${{ matrix.db }}
144
+ run : ./gradlew build -PshowStandardOutput -Pdocker -Pdb=${{ matrix.db }}
145
+ - name : Upload reports (if build failed)
146
+ uses : actions/upload-artifact@v2
147
+ if : failure()
148
+ with :
149
+ name : reports-db-${{ matrix.db }}
150
+ path : ' ./**/build/reports/'
149
151
150
152
test_jdks :
151
153
name : Test with Java ${{ matrix.java.name }}
152
- if : ( github.event_name == 'schedule' && startsWith( github.ref, 'refs/heads/wip/' ) ) || ( github.event_name != 'schedule' )
153
154
runs-on : ubuntu-latest
154
155
strategy :
155
156
fail-fast : false
@@ -172,71 +173,76 @@ jobs:
172
173
- { name: "23-ea", java_version_numeric: 23, from: 'jdk.java.net', jvm_args: '--enable-preview' }
173
174
- { name: "24-ea", java_version_numeric: 24, from: 'jdk.java.net', jvm_args: '--enable-preview' }
174
175
steps :
175
- - uses : actions/checkout@v2
176
- - name : Get year/month for cache key
177
- id : get-date
178
- run : |
179
- echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
180
- shell : bash
181
- - name : Cache Gradle downloads
182
- uses : actions/cache@v2
183
- id : cache-gradle
184
- with :
185
- path : |
186
- .gradle/caches
187
- .gradle/jdks
188
- .gradle/wrapper
189
- # refresh cache every month to avoid unlimited growth
190
- key : gradle-java${{ matrix.java }}-${{ steps.get-date.outputs.yearmonth }}
191
- - name : Set up latest JDK ${{ matrix.java.name }} from jdk.java.net
192
- if : matrix.java.from == 'jdk.java.net'
193
- uses : oracle-actions/setup-java@v1
194
- with :
195
- website : jdk.java.net
196
- release : ${{ matrix.java.java_version_numeric }}
197
- - name : Set up latest JDK ${{ matrix.java.name }} from Adoptium
198
- if : matrix.java.from == '' || matrix.java.from == 'adoptium.net'
199
-
200
- with :
201
- distribution : ' temurin'
202
- java-version : ${{ matrix.java.java_version_numeric }}
203
- check-latest : true
204
- - name : Export path to JDK ${{ matrix.java.name }}
205
- id : testjdk-exportpath
206
- run : echo "::set-output name=path::${JAVA_HOME}"
207
- # Always use JDK 11 to build the main code: that's what we use for releases.
208
- - name : Set up JDK 11
209
-
210
- with :
211
- distribution : ' temurin'
212
- java-version : 11
213
- check-latest : true
214
- - name : Export path to JDK 11
215
- id : mainjdk-exportpath
216
- run : echo "::set-output name=path::${JAVA_HOME}"
217
- - name : Display exact version of JDK ${{ matrix.java.name }}
218
- run : |
219
- ${{ steps.testjdk-exportpath.outputs.path }}/bin/java -version
220
- - name : Print the effective ORM version used
221
- run : ./gradlew :hibernate-reactive-core:dependencyInsight --dependency org.hibernate.orm:hibernate-core
222
- - name : Build and Test with Java ${{ matrix.java.name }}
223
- run : |
224
- ./gradlew build -PshowStandardOutput -Pdocker -Ptest.jdk.version=${{ matrix.java.java_version_numeric }} \
225
- -Porg.gradle.java.installations.paths=${{ steps.mainjdk-exportpath.outputs.path }},${{ steps.testjdk-exportpath.outputs.path }} \
226
- ${{ matrix.java.jvm_args && '-Ptest.jdk.launcher.args=' }}${{ matrix.java.jvm_args }}
227
- - name : Upload reports (if build failed)
228
- uses : actions/upload-artifact@v2
229
- if : failure()
230
- with :
231
- name : reports-java${{ matrix.java.name }}
232
- path : ' ./**/build/reports/'
176
+ - name : Checkout ${{ inputs.branch }}
177
+ uses : actions/checkout@v2
178
+ with :
179
+ ref : ${{ inputs.branch }}
180
+ - name : Get year/month for cache key
181
+ id : get-date
182
+ run : |
183
+ echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
184
+ shell : bash
185
+ - name : Cache Gradle downloads
186
+ uses : actions/cache@v2
187
+ id : cache-gradle
188
+ with :
189
+ path : |
190
+ .gradle/caches
191
+ .gradle/jdks
192
+ .gradle/wrapper
193
+ # refresh cache every month to avoid unlimited growth
194
+ key : gradle-java${{ matrix.java }}-${{ steps.get-date.outputs.yearmonth }}
195
+ - name : Set up latest JDK ${{ matrix.java.name }} from jdk.java.net
196
+ if : matrix.java.from == 'jdk.java.net'
197
+ uses : oracle-actions/setup-java@v1
198
+ with :
199
+ website : jdk.java.net
200
+ release : ${{ matrix.java.java_version_numeric }}
201
+ - name : Set up latest JDK ${{ matrix.java.name }} from Adoptium
202
+ if : matrix.java.from == '' || matrix.java.from == 'adoptium.net'
203
+
204
+ with :
205
+ distribution : ' temurin'
206
+ java-version : ${{ matrix.java.java_version_numeric }}
207
+ check-latest : true
208
+ - name : Export path to JDK ${{ matrix.java.name }}
209
+ id : testjdk-exportpath
210
+ run : echo "::set-output name=path::${JAVA_HOME}"
211
+ # Always use JDK 11 to build the main code: that's what we use for releases.
212
+ - name : Set up JDK 11
213
+
214
+ with :
215
+ distribution : ' temurin'
216
+ java-version : 11
217
+ check-latest : true
218
+ - name : Export path to JDK 11
219
+ id : mainjdk-exportpath
220
+ run : echo "::set-output name=path::${JAVA_HOME}"
221
+ - name : Display exact version of JDK ${{ matrix.java.name }}
222
+ run : |
223
+ ${{ steps.testjdk-exportpath.outputs.path }}/bin/java -version
224
+ - name : Print the effective ORM version used
225
+ run : ./gradlew :hibernate-reactive-core:dependencyInsight --dependency org.hibernate.orm:hibernate-core
226
+ - name : Build and Test with Java ${{ matrix.java.name }}
227
+ run : |
228
+ ./gradlew build -PshowStandardOutput -Pdocker -Ptest.jdk.version=${{ matrix.java.java_version_numeric }} \
229
+ -Porg.gradle.java.installations.paths=${{ steps.mainjdk-exportpath.outputs.path }},${{ steps.testjdk-exportpath.outputs.path }} \
230
+ ${{ matrix.java.jvm_args && '-Ptest.jdk.launcher.args=' }}${{ matrix.java.jvm_args }}
231
+ - name : Upload reports (if build failed)
232
+ uses : actions/upload-artifact@v2
233
+ if : failure()
234
+ with :
235
+ name : reports-java${{ matrix.java.name }}
236
+ path : ' ./**/build/reports/'
233
237
234
238
snapshot :
235
239
name : Release snapshot
240
+ # Release the snapshots only if there are changes
236
241
if : github.event_name == 'push' && startsWith( github.ref, 'refs/heads/wip/' )
237
242
runs-on : ubuntu-latest
238
243
steps :
239
- - uses : actions/checkout@v2
244
+ - name : Checkout ${{ inputs.branch }}
245
+ uses : actions/checkout@v2
240
246
- name : Set up JDK 11
241
247
242
248
with :
@@ -256,6 +262,7 @@ jobs:
256
262
257
263
release :
258
264
name : Release
265
+ # Releases only happen on tags
259
266
if : github.event_name == 'push' && startsWith( github.ref, 'refs/tags/' )
260
267
runs-on : ubuntu-latest
261
268
steps :
0 commit comments