Skip to content

Commit c61ec35

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

File tree

2 files changed

+159
-132
lines changed

2 files changed

+159
-132
lines changed

.github/workflows/build.yml

+142-132
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ 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 * * * *'
14+
# For building snapshots
15+
workflow_call:
16+
inputs:
17+
branch:
18+
required: true
19+
type: string
1920
# Allow running this workflow against a specific branch/tag
2021
workflow_dispatch:
2122

2223
# See https://github.com/hibernate/hibernate-orm/pull/4615 for a description of the behavior we're getting.
2324
concurrency:
2425
# Consider that two builds are in the same concurrency group (cannot run concurrently)
25-
# 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 }}"
26+
# if they use the same workflow and are about the same branch ("ref"), pull request, and branch (for scheduled job).
27+
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}, branch=${{ inputs.branch }}"
2728
# Cancel previous builds in the same concurrency group even if they are in process
2829
# for pull requests or pushes to forks (not the upstream repository).
2930
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'hibernate/hibernate-reactive' }}
3031

3132
jobs:
3233
run_examples:
3334
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' )
3535
runs-on: ubuntu-latest
3636
strategy:
3737
matrix:
@@ -42,7 +42,7 @@ jobs:
4242
- example: 'native-sql-example'
4343
db: 'MySQL'
4444
services:
45-
# Label used to access the service container
45+
# Label used to access the service container
4646
mysql:
4747
# Docker Hub image
4848
image: mysql:8.4.0
@@ -75,81 +75,85 @@ jobs:
7575
ports:
7676
- 5432:5432
7777
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/'
78+
- name: Checkout ${{ inputs.branch }}
79+
uses: actions/checkout@v2
80+
with:
81+
ref: ${{ inputs.branch }}
82+
- name: Get year/month for cache key
83+
id: get-date
84+
run: |
85+
echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
86+
shell: bash
87+
- name: Cache Gradle downloads
88+
uses: actions/cache@v2
89+
id: cache-gradle
90+
with:
91+
path: |
92+
.gradle/caches
93+
.gradle/jdks
94+
.gradle/wrapper
95+
# refresh cache every month to avoid unlimited growth
96+
key: gradle-examples-${{ matrix.db }}-${{ steps.get-date.outputs.yearmonth }}
97+
- name: Set up JDK 11
98+
uses: actions/[email protected]
99+
with:
100+
distribution: 'temurin'
101+
java-version: 11
102+
- name: Print the effective ORM version used
103+
run: ./gradlew :${{ matrix.example }}:dependencyInsight --dependency org.hibernate.orm:hibernate-core
104+
- name: Run examples in '${{ matrix.example }}' on ${{ matrix.db }}
105+
run: ./gradlew :${{ matrix.example }}:runAllExamplesOn${{ matrix.db }}
106+
- name: Upload reports (if build failed)
107+
uses: actions/upload-artifact@v2
108+
if: failure()
109+
with:
110+
name: reports-examples-${{ matrix.db }}
111+
path: './**/build/reports/'
109112

110113
test_dbs:
111114
name: Test with ${{ matrix.db }}
112-
if: ( github.event_name == 'schedule' && startsWith( github.ref, 'refs/heads/wip/' ) ) || ( github.event_name != 'schedule' )
113115
runs-on: ubuntu-latest
114116
strategy:
115117
matrix:
116118
db: [ 'MariaDB', 'MySQL', 'PostgreSQL', 'MSSQLServer', 'CockroachDB', 'Db2', 'Oracle' ]
117119
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/'
120+
- name: Checkout ${{ inputs.branch }}
121+
uses: actions/checkout@v2
122+
with:
123+
ref: ${{ inputs.branch }}
124+
- name: Get year/month for cache key
125+
id: get-date
126+
run: |
127+
echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
128+
shell: bash
129+
- name: Cache Gradle downloads
130+
uses: actions/cache@v2
131+
id: cache-gradle
132+
with:
133+
path: |
134+
.gradle/caches
135+
.gradle/jdks
136+
.gradle/wrapper
137+
# refresh cache every month to avoid unlimited growth
138+
key: gradle-db-${{ matrix.db }}-${{ steps.get-date.outputs.yearmonth }}
139+
- name: Set up JDK 11
140+
uses: actions/[email protected]
141+
with:
142+
distribution: 'temurin'
143+
java-version: 11
144+
- name: Print the effective ORM version used
145+
run: ./gradlew :hibernate-reactive-core:dependencyInsight --dependency org.hibernate.orm:hibernate-core
146+
- name: Build and Test with ${{ matrix.db }}
147+
run: ./gradlew build -PshowStandardOutput -Pdocker -Pdb=${{ matrix.db }}
148+
- name: Upload reports (if build failed)
149+
uses: actions/upload-artifact@v2
150+
if: failure()
151+
with:
152+
name: reports-db-${{ matrix.db }}
153+
path: './**/build/reports/'
149154

150155
test_jdks:
151156
name: Test with Java ${{ matrix.java.name }}
152-
if: ( github.event_name == 'schedule' && startsWith( github.ref, 'refs/heads/wip/' ) ) || ( github.event_name != 'schedule' )
153157
runs-on: ubuntu-latest
154158
strategy:
155159
fail-fast: false
@@ -172,71 +176,76 @@ jobs:
172176
- { name: "23-ea", java_version_numeric: 23, from: 'jdk.java.net', jvm_args: '--enable-preview' }
173177
- { name: "24-ea", java_version_numeric: 24, from: 'jdk.java.net', jvm_args: '--enable-preview' }
174178
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/'
179+
- name: Checkout ${{ inputs.branch }}
180+
uses: actions/checkout@v2
181+
with:
182+
ref: ${{ inputs.branch }}
183+
- name: Get year/month for cache key
184+
id: get-date
185+
run: |
186+
echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
187+
shell: bash
188+
- name: Cache Gradle downloads
189+
uses: actions/cache@v2
190+
id: cache-gradle
191+
with:
192+
path: |
193+
.gradle/caches
194+
.gradle/jdks
195+
.gradle/wrapper
196+
# refresh cache every month to avoid unlimited growth
197+
key: gradle-java${{ matrix.java }}-${{ steps.get-date.outputs.yearmonth }}
198+
- name: Set up latest JDK ${{ matrix.java.name }} from jdk.java.net
199+
if: matrix.java.from == 'jdk.java.net'
200+
uses: oracle-actions/setup-java@v1
201+
with:
202+
website: jdk.java.net
203+
release: ${{ matrix.java.java_version_numeric }}
204+
- name: Set up latest JDK ${{ matrix.java.name }} from Adoptium
205+
if: matrix.java.from == '' || matrix.java.from == 'adoptium.net'
206+
uses: actions/[email protected]
207+
with:
208+
distribution: 'temurin'
209+
java-version: ${{ matrix.java.java_version_numeric }}
210+
check-latest: true
211+
- name: Export path to JDK ${{ matrix.java.name }}
212+
id: testjdk-exportpath
213+
run: echo "::set-output name=path::${JAVA_HOME}"
214+
# Always use JDK 11 to build the main code: that's what we use for releases.
215+
- name: Set up JDK 11
216+
uses: actions/[email protected]
217+
with:
218+
distribution: 'temurin'
219+
java-version: 11
220+
check-latest: true
221+
- name: Export path to JDK 11
222+
id: mainjdk-exportpath
223+
run: echo "::set-output name=path::${JAVA_HOME}"
224+
- name: Display exact version of JDK ${{ matrix.java.name }}
225+
run: |
226+
${{ steps.testjdk-exportpath.outputs.path }}/bin/java -version
227+
- name: Print the effective ORM version used
228+
run: ./gradlew :hibernate-reactive-core:dependencyInsight --dependency org.hibernate.orm:hibernate-core
229+
- name: Build and Test with Java ${{ matrix.java.name }}
230+
run: |
231+
./gradlew build -PshowStandardOutput -Pdocker -Ptest.jdk.version=${{ matrix.java.java_version_numeric }} \
232+
-Porg.gradle.java.installations.paths=${{ steps.mainjdk-exportpath.outputs.path }},${{ steps.testjdk-exportpath.outputs.path }} \
233+
${{ matrix.java.jvm_args && '-Ptest.jdk.launcher.args=' }}${{ matrix.java.jvm_args }}
234+
- name: Upload reports (if build failed)
235+
uses: actions/upload-artifact@v2
236+
if: failure()
237+
with:
238+
name: reports-java${{ matrix.java.name }}
239+
path: './**/build/reports/'
233240

234241
snapshot:
235242
name: Release snapshot
243+
# Release the snapshots only if there are changes
236244
if: github.event_name == 'push' && startsWith( github.ref, 'refs/heads/wip/' )
237245
runs-on: ubuntu-latest
238246
steps:
239-
- uses: actions/checkout@v2
247+
- name: Checkout ${{ inputs.branch }}
248+
uses: actions/checkout@v2
240249
- name: Set up JDK 11
241250
uses: actions/[email protected]
242251
with:
@@ -256,6 +265,7 @@ jobs:
256265

257266
release:
258267
name: Release
268+
# Releases only happen on tags
259269
if: github.event_name == 'push' && startsWith( github.ref, 'refs/tags/' )
260270
runs-on: ubuntu-latest
261271
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)