Skip to content

[4.5] Add ReactiveSelectionQuery.getKeyedResultList #9250

[4.5] Add ReactiveSelectionQuery.getKeyedResultList

[4.5] Add ReactiveSelectionQuery.getKeyedResultList #9250

Workflow file for this run

name: Hibernate Reactive CI
on:
push:
branches:
- 'main'
- 'wip/**'
- '2.*'
- '3.*'
- '4.*'
tags:
- '2.*'
- '3.*'
- '4.*'
pull_request:
branches:
- 'main'
- 'wip/**'
- '2.*'
- '3.*'
- '4.*'
# For building snapshots
workflow_call:
inputs:
branch:
required: true
type: string
# Allow running this workflow against a specific branch/tag
workflow_dispatch:
# See https://github.com/hibernate/hibernate-orm/pull/4615 for a description of the behavior we're getting.
concurrency:
# Consider that two builds are in the same concurrency group (cannot run concurrently)
# if they use the same workflow and are about the same branch ("ref"), pull request, and branch name input (for scheduled job).
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}, branch=${{ inputs.branch }}"
# Cancel previous builds in the same concurrency group even if they are in process
# for pull requests or pushes to forks (not the upstream repository).
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'hibernate/hibernate-reactive' }}
permissions:
contents: read
jobs:
run_examples:
name: Run examples in '${{ matrix.example }}' on ${{ matrix.db }}
runs-on: ubuntu-latest
strategy:
matrix:
example: [ 'session-example', 'native-sql-example' ]
db: [ 'MySQL', 'PostgreSQL' ]
exclude:
# 'native-sql-example' doesn't run on MySQL because it has native queries
- example: 'native-sql-example'
db: 'MySQL'
services:
# Label used to access the service container
mysql:
image: container-registry.oracle.com/mysql/community-server:9.3.0
env:
MYSQL_ROOT_PASSWORD: hreact
MYSQL_DATABASE: hreact
MYSQL_USER: hreact
MYSQL_PASSWORD: hreact
# Set health checks to wait until postgres has started
options: >-
--health-cmd="mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306
postgres:
# Docker Hub image
image: postgres:17.4
env:
POSTGRES_DB: hreact
POSTGRES_USER: hreact
POSTGRES_PASSWORD: hreact
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout ${{ inputs.branch }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.branch }}
- name: Get year/month for cache key
id: get-date
run: |
echo "yearmonth=$(/bin/date -u '+%Y-%m')" >> "$GITHUB_OUTPUT"
shell: bash
- name: Sanitize the branch name
# We want to include the branch in artifact names to keep them unique.
# Branch names may have some symbols that are not "friendly" for file names e.g. we may have a branch `wip/4.0`
# This step replaces any unwanted characters with a dash:`wip/4.0` -> `wip-4.0` or build/test-github-workflow-update123.4
shell: bash
id: current-branch-suffix
env:
BRANCH_NAME: ${{ inputs.branch }}
run: |
echo "value=$(echo "$BRANCH_NAME" | sed -E 's/[^A-Za-z0-9._-]+/-/g')" >> "$GITHUB_OUTPUT"
- name: Cache Gradle downloads
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache-gradle
with:
path: |
.gradle/caches
.gradle/jdks
.gradle/wrapper
# refresh cache every month to avoid unlimited growth
key: gradle-examples-${{ matrix.db }}-${{ steps.get-date.outputs.yearmonth }}
- name: Set up JDK 11
if: ${{ startsWith( inputs.branch, 'wip/2' ) }}
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version: 11
- name: Set up JDK 17
if: ${{ !startsWith( inputs.branch, 'wip/2' ) }}
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version: 17
- name: Print the effective ORM version used
env:
MATRIX_EXAMPLE: ${{ matrix.example }}
run: ./gradlew ":$MATRIX_EXAMPLE:dependencyInsight" --dependency org.hibernate.orm:hibernate-core
- name: Run examples in '${{ matrix.example }}' on ${{ matrix.db }}
env:
MATRIX_EXAMPLE: ${{ matrix.example }}
MATRIX_DB: ${{ matrix.db }}
run: ./gradlew ":$MATRIX_EXAMPLE:runAllExamplesOn$MATRIX_DB"
- name: Upload reports (if build failed)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: failure()
with:
name: reports-examples-${{ matrix.db }}-${{ matrix.example }}-${{ steps.current-branch-suffix.outputs.value }}-${{ strategy.job-index }}
path: './**/build/reports/'
- name: Upload Develocity build scan data
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-scan-data-examples-${{ matrix.db }}-${{ matrix.example }}-${{ steps.current-branch-suffix.outputs.value }}-${{ strategy.job-index }}
path: ~/.gradle/build-scan-data
retention-days: 1
continue-on-error: true
test_dbs:
name: Test with ${{ matrix.db }}
runs-on: ubuntu-latest
strategy:
matrix:
db: [ 'MariaDB', 'MySQL', 'PostgreSQL', 'MSSQLServer', 'CockroachDB', 'Db2', 'Oracle' ]
steps:
- name: Checkout ${{ inputs.branch }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.branch }}
- name: Get year/month for cache key
id: get-date
run: |
echo "yearmonth=$(/bin/date -u '+%Y-%m')" >> "$GITHUB_OUTPUT"
shell: bash
- name: Sanitize the branch name
# We want to include the branch in artifact names to keep them unique.
# Branch names may have some symbols that are not "friendly" for file names e.g. we may have a branch `wip/4.0`
# This step replaces any unwanted characters with a dash:`wip/4.0` -> `wip-4.0` or build/test-github-workflow-update123.4
shell: bash
id: current-branch-suffix
env:
BRANCH_NAME: ${{ inputs.branch }}
run: |
echo "value=$(echo "$BRANCH_NAME" | sed -E 's/[^A-Za-z0-9._-]+/-/g')" >> "$GITHUB_OUTPUT"
- name: Cache Gradle downloads
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache-gradle
with:
path: |
.gradle/caches
.gradle/jdks
.gradle/wrapper
# refresh cache every month to avoid unlimited growth
key: gradle-db-${{ matrix.db }}-${{ steps.get-date.outputs.yearmonth }}
- name: Set up JDK 11
if: ${{ startsWith( inputs.branch, 'wip/2' ) }}
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version: 11
- name: Set up JDK 17
if: ${{ !startsWith( inputs.branch, 'wip/2' ) }}
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version: 17
- name: Print the effective ORM version used
run: ./gradlew :hibernate-reactive-core:dependencyInsight --dependency org.hibernate.orm:hibernate-core
- name: Build and Test with ${{ matrix.db }}
env:
MATRIX_DB: ${{ matrix.db }}
run: ./gradlew build -PshowStandardOutput -Pdb="$MATRIX_DB"
- name: Upload reports (if build failed)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: failure()
with:
name: reports-db-${{ matrix.db }}-${{ steps.current-branch-suffix.outputs.value }}-${{ strategy.job-index }}
path: './**/build/reports/'
- name: Upload coverage reports
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-coverage-data-db-${{ matrix.db }}-${{ steps.current-branch-suffix.outputs.value }}-${{ strategy.job-index }}
path: |
./**/build/jacoco/*.exec
./**/build/classes/
./**/build/generated/
- name: Upload Develocity build scan data
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-scan-data-db-${{ matrix.db }}-${{ steps.current-branch-suffix.outputs.value }}-${{ strategy.job-index }}
path: ~/.gradle/build-scan-data
retention-days: 1
continue-on-error: true
- name: Upload docs preview
# we need to limit it to just one job execution:
if: matrix.db == 'PostgreSQL'
uses: hibernate/.github/actions/build-docs-preview@197125e1a0e9624349ef9e8157dad8ab707f3da0 # main
with:
dist-path: 'documentation/build/asciidoc'
src-paths: |
documentation/src
test_jdks:
name: Test with Java ${{ matrix.java.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# To list the available "feature versions" on adoptium.net (ignore "tip_version", it's not relevant):
# https://api.adoptium.net/v3/info/available_releases
# To list the available releases for a given "feature version" on adoptium.net (example for 16):
# https://api.adoptium.net/v3/assets/latest/16/hotspot
# To see the available versions and download links on jdk.java.net:
# https://github.com/oracle-actions/setup-java/blob/main/jdk.java.net-uri.properties
java:
- { name: "17", java_version_numeric: 17 }
# We want to enable preview features when testing newer builds of OpenJDK:
# even if we don't use these features, just enabling them can cause side effects
# and it's useful to test that.
- { name: "21", java_version_numeric: 21, jvm_args: '--enable-preview' }
- { name: "25", java_version_numeric: 25, jvm_args: '--enable-preview' }
- { name: "26", java_version_numeric: 26, jvm_args: '--enable-preview' }
- { name: "27", java_version_numeric: 27, from: 'jdk.java.net', jvm_args: '--enable-preview' }
- { name: "28-ea", java_version_numeric: 28, from: 'jdk.java.net', jvm_args: '--enable-preview' }
steps:
- name: Checkout ${{ inputs.branch }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.branch }}
- name: Get year/month for cache key
id: get-date
run: |
echo "yearmonth=$(/bin/date -u '+%Y-%m')" >> "$GITHUB_OUTPUT"
shell: bash
- name: Sanitize the branch name
# We want to include the branch in artifact names to keep them unique.
# Branch names may have some symbols that are not "friendly" for file names e.g. we may have a branch `wip/4.0`
# This step replaces any unwanted characters with a dash:`wip/4.0` -> `wip-4.0` or build/test-github-workflow-update123.4
shell: bash
id: current-branch-suffix
env:
BRANCH_NAME: ${{ inputs.branch }}
run: |
echo "value=$(echo "$BRANCH_NAME" | sed -E 's/[^A-Za-z0-9._-]+/-/g')" >> "$GITHUB_OUTPUT"
- name: Generate cache key
id: cache-key
env:
CURRENT_BRANCH: ${{ github.repository != 'hibernate/hibernate-reactive' && 'fork' || github.base_ref || github.ref_name }}
run: |
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
CURRENT_DAY=$(/bin/date -u "+%d")
ROOT_CACHE_KEY="buildtool-cache"
{
echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}"
echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}"
echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}"
} >> "$GITHUB_OUTPUT"
- name: Cache Maven/Gradle Dependency/Dist Caches
id: cache-maven
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
# if it's not a pull request, we restore and save the cache
if: github.event_name != 'pull_request'
with:
path: |
~/.m2/repository/
~/.m2/wrapper/
~/.gradle/caches/modules-2
~/.gradle/wrapper/
# A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable, but it's not a problem.
# The whole cache is dropped monthly to prevent unlimited growth.
# The cache is per branch but in case we don't find a branch for a given branch, we will get a cache from another branch.
key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
- name: Restore Maven/Gradle Dependency/Dist Caches
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
# if it's a pull request, we restore the cache, but we don't save it
if: github.event_name == 'pull_request'
with:
path: |
~/.m2/repository/
~/.m2/wrapper/
~/.gradle/caches/modules-2
~/.gradle/wrapper/
key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
- name: Set up latest JDK ${{ matrix.java.name }} from jdk.java.net
if: matrix.java.from == 'jdk.java.net'
uses: oracle-actions/setup-java@fff43251af9936a0e6a4d5d0946e14f1680e9b6b # v1.5.0
with:
website: jdk.java.net
release: ${{ matrix.java.java_version_numeric }}
- name: Set up latest JDK ${{ matrix.java.name }} from Adoptium
if: matrix.java.from == '' || matrix.java.from == 'adoptium.net'
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java.java_version_numeric }}
check-latest: true
- name: Export path to JDK ${{ matrix.java.name }}
id: testjdk-exportpath
run: echo "path=${JAVA_HOME}" >> "$GITHUB_OUTPUT"
- name: Set up JDK 11
if: ${{ startsWith( inputs.branch, 'wip/2' ) }}
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version: 11
check-latest: true
- name: Set up JDK 17
if: ${{ !startsWith( inputs.branch, 'wip/2' ) }}
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version: 17
check-latest: true
- name: Export path to JDK 11
id: mainjdk-exportpath
run: echo "path=${JAVA_HOME}" >> "$GITHUB_OUTPUT"
- name: Display exact version of JDK ${{ matrix.java.name }}
env:
TEST_JDK_PATH: ${{ steps.testjdk-exportpath.outputs.path }}
run: |
"$TEST_JDK_PATH/bin/java" -version
- name: Print the effective ORM version used
run: ./gradlew :hibernate-reactive-core:dependencyInsight --dependency org.hibernate.orm:hibernate-core
- name: Build and Test with Java ${{ matrix.java.name }}
env:
TEST_JDK_VERSION: ${{ matrix.java.java_version_numeric }}
MAIN_JDK_PATH: ${{ steps.mainjdk-exportpath.outputs.path }}
TEST_JDK_PATH: ${{ steps.testjdk-exportpath.outputs.path }}
LAUNCHER_ARGS: "${{ matrix.java.jvm_args && '-Ptest.jdk.launcher.args=' }}${{ matrix.java.jvm_args }}"
run: |
EXTRA_ARGS=()
if [ -n "$LAUNCHER_ARGS" ]; then
EXTRA_ARGS+=("$LAUNCHER_ARGS")
fi
./gradlew build -PshowStandardOutput -Ptest.jdk.version="$TEST_JDK_VERSION" \
-Porg.gradle.java.installations.paths="$MAIN_JDK_PATH,$TEST_JDK_PATH" \
"${EXTRA_ARGS[@]}"
- name: Upload reports (if build failed)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: failure()
with:
name: reports-java${{ matrix.java.name }}-${{ steps.current-branch-suffix.outputs.value }}-${{ strategy.job-index }}
path: './**/build/reports/'
- name: Upload Develocity build scan data
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-scan-data-jdk-${{ matrix.java.name }}-${{ steps.current-branch-suffix.outputs.value }}-${{ strategy.job-index }}
path: ~/.gradle/build-scan-data
retention-days: 1
continue-on-error: true
prepare-sonar-bundle:
name: Prepare build bundle for Sonar scanner
needs:
- run_examples
- test_dbs
if: |
always() && !cancelled()
&& needs.run_examples.result != 'cancelled'
&& needs.test_dbs.result != 'cancelled'
&& github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ inputs.branch }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.branch }}
- name: Sanitize the branch name
shell: bash
id: current-branch-suffix
env:
BRANCH_NAME: ${{ inputs.branch }}
run: |
echo "value=$(echo "$BRANCH_NAME" | sed -E 's/[^A-Za-z0-9._-]+/-/g')" >> "$GITHUB_OUTPUT"
- name: Set up JDK 17
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
java-version: '17'
distribution: 'temurin'
- name: Generate cache key
id: cache-key
env:
CURRENT_BRANCH: ${{ github.repository != 'hibernate/hibernate-reactive' && 'fork' || github.base_ref || github.ref_name }}
run: |
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
CURRENT_DAY=$(/bin/date -u "+%d")
ROOT_CACHE_KEY="buildtool-cache"
{
echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}"
echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}"
echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}"
} >> "$GITHUB_OUTPUT"
- name: Restore Maven/Gradle Dependency/Dist Caches
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.m2/repository/
~/.m2/wrapper/
~/.gradle/caches/
!~/.gradle/caches/build-cache-*
~/.gradle/wrapper/
key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
- name: Download coverage reports
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
with:
pattern: build-coverage-data*${{ steps.current-branch-suffix.outputs.value }}*
path: .
merge-multiple: 'true'
# Don't fail the build if there are no matching artifacts
continue-on-error: true
- name: Merge Jacoco Reports
run: ./gradlew mergeCodeCoverageReport copyDependenciesSonar --no-parallel
- name: Store build info for Sonar scanning
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-results-data
retention-days: 1
path: |
./**/build/jacoco/*.exec
./**/build/classes/
./**/build/generated/
./**/build/resources/
./**/build/reports/
./**/build/sonar-dependencies/