Skip to content

Commit 31d5b1b

Browse files
committed
[hibernate#1977] Schedule snapshots build
1 parent 5bbacd7 commit 31d5b1b

File tree

2 files changed

+157
-133
lines changed

2 files changed

+157
-133
lines changed

.github/workflows/build.yml

+140-133
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,24 @@ on:
1111
branches:
1212
- 'main'
1313
- '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
2119

2220
# See https://github.com/hibernate/hibernate-orm/pull/4615 for a description of the behavior we're getting.
2321
concurrency:
2422
# Consider that two builds are in the same concurrency group (cannot run concurrently)
2523
# 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 }}"
2725
# Cancel previous builds in the same concurrency group even if they are in process
2826
# for pull requests or pushes to forks (not the upstream repository).
2927
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'hibernate/hibernate-reactive' }}
3028

3129
jobs:
3230
run_examples:
3331
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' )
3532
runs-on: ubuntu-latest
3633
strategy:
3734
matrix:
@@ -42,7 +39,7 @@ jobs:
4239
- example: 'native-sql-example'
4340
db: 'MySQL'
4441
services:
45-
# Label used to access the service container
42+
# Label used to access the service container
4643
mysql:
4744
# Docker Hub image
4845
image: mysql:8.4.0
@@ -75,81 +72,85 @@ jobs:
7572
ports:
7673
- 5432:5432
7774
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-
uses: actions/[email protected]
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+
uses: actions/[email protected]
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/'
109109

110110
test_dbs:
111111
name: Test with ${{ matrix.db }}
112-
if: ( github.event_name == 'schedule' && startsWith( github.ref, 'refs/heads/wip/' ) ) || ( github.event_name != 'schedule' )
113112
runs-on: ubuntu-latest
114113
strategy:
115114
matrix:
116115
db: [ 'MariaDB', 'MySQL', 'PostgreSQL', 'MSSQLServer', 'CockroachDB', 'Db2', 'Oracle' ]
117116
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-
uses: actions/[email protected]
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+
uses: actions/[email protected]
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/'
149151

150152
test_jdks:
151153
name: Test with Java ${{ matrix.java.name }}
152-
if: ( github.event_name == 'schedule' && startsWith( github.ref, 'refs/heads/wip/' ) ) || ( github.event_name != 'schedule' )
153154
runs-on: ubuntu-latest
154155
strategy:
155156
fail-fast: false
@@ -172,71 +173,76 @@ jobs:
172173
- { name: "23-ea", java_version_numeric: 23, from: 'jdk.java.net', jvm_args: '--enable-preview' }
173174
- { name: "24-ea", java_version_numeric: 24, from: 'jdk.java.net', jvm_args: '--enable-preview' }
174175
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-
uses: actions/[email protected]
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-
uses: actions/[email protected]
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+
uses: actions/[email protected]
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+
uses: actions/[email protected]
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/'
233237

234238
snapshot:
235239
name: Release snapshot
240+
# Release the snapshots only if there are changes
236241
if: github.event_name == 'push' && startsWith( github.ref, 'refs/heads/wip/' )
237242
runs-on: ubuntu-latest
238243
steps:
239-
- uses: actions/checkout@v2
244+
- name: Checkout ${{ inputs.branch }}
245+
uses: actions/checkout@v2
240246
- name: Set up JDK 11
241247
uses: actions/[email protected]
242248
with:
@@ -256,6 +262,7 @@ jobs:
256262

257263
release:
258264
name: Release
265+
# Releases only happen on tags
259266
if: github.event_name == 'push' && startsWith( github.ref, 'refs/tags/' )
260267
runs-on: ubuntu-latest
261268
steps:

.github/workflows/scheduler.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# A scheduler can only run on the default branch.
2+
# With workflow_call, we can pass the branch we want to test as parameter so that we can check it out instead of the
3+
# default branch
4+
name: Scheduler for Hibernate Reactive CI build
5+
6+
on:
7+
schedule:
8+
- cron: '25 * * * *'
9+
10+
jobs:
11+
build-snapshots:
12+
strategy:
13+
matrix:
14+
branch: [ 'wip/2.3', 'wip/2.4' ]
15+
uses: ./.github/workflows/build.yml
16+
with:
17+
branch: ${{ matrix.branch }}

0 commit comments

Comments
 (0)