diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 442c46f96a72..ffec6f05b638 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,9 +155,9 @@ jobs: matrix: include: - rdbms: oracle_atps - - rdbms: oracle_db19c - - rdbms: oracle_db21c - - rdbms: oracle_db23c + #- rdbms: oracle_db19c + #- rdbms: oracle_db21c + #- rdbms: oracle_db23c steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -249,6 +249,122 @@ jobs: - name: Omit produced artifacts from build cache run: ./ci/before-cache.sh + # Job for builds on Oracle TP infrastructure. + # This is untrusted, even for pushes, see below. + otp: + permissions: + contents: read + name: GraalVM 21 - ${{matrix.rdbms}} + runs-on: [ self-hosted, Linux, X64, OracleTestPilot ] + strategy: + fail-fast: false + matrix: + include: + #- rdbms: autonomous-transaction-processing-serverless + - rdbms: base-database-service-19c + - rdbms: base-database-service-21c + - rdbms: base-database-service-23ai + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - name: Set up Java 21 + uses: graalvm/setup-graalvm@aafbedb8d382ed0ca6167d3a051415f20c859274 # v1.2.8 + with: + distribution: 'graalvm' + java-version: '21' + - name: Generate cache key + id: cache-key + run: | + CURRENT_BRANCH="${{ github.repository != 'hibernate/hibernate-orm' && 'fork' || github.base_ref || github.ref_name }}" + CURRENT_MONTH=$(/bin/date -u "+%Y-%m") + CURRENT_DAY=$(/bin/date -u "+%d") + ROOT_CACHE_KEY="buildtool-cache-atlas" + echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT + echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT + 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@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + # 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@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + # if it is 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 }}- + + - id: create_database + uses: loiclefevre/test@v1.0.17 + with: + oci-service: ${{ matrix.rdbms }} + action: create + user: hibernate_orm_test + + - name: Run build script + env: + RDBMS: ${{ matrix.rdbms }} + RUNID: ${{ github.run_number }} + TESTPILOT_CONNECTION_STRING_SUFFIX: ${{ steps.create_database.outputs.connection_string_suffix }} + TESTPILOT_PASSWORD: ${{ steps.create_database.outputs.database_password }} + API_HOST: "" + TESTPILOT_CLIENT_ID: "" + TESTPILOT_TOKEN: "" + # Needed for TFO (TCP fast open) + LD_PRELOAD: /home/ubuntu/libtfojdbc1.so + LD_LIBRARY_PATH: /home/ubuntu + run: ./ci/build-github.sh + shell: bash + + - uses: loiclefevre/test@v1.0.17 + if: always() + with: + oci-service: ${{ matrix.rdbms }} + action: delete + user: hibernate_orm_test + + # 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. + # That's even on push, because we do not trust Atlas runners to hold secrets: they are shared infrastructure. + - name: Upload GitHub Actions artifact for the Develocity build scan + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + if: "${{ !cancelled() }}" + with: + name: build-scan-data-${{ matrix.rdbms }} + path: ~/.gradle/build-scan-data + - name: Upload test reports (if Gradle failed) + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + if: failure() + with: + name: test-reports-java11-${{ matrix.rdbms }} + path: | + ./**/target/reports/tests/ + - name: Omit produced artifacts from build cache + run: ./ci/before-cache.sh + # Static code analysis check format_checks: permissions: diff --git a/ci/build.sh b/ci/build.sh index caa70a93275d..3e9e54553baf 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -21,43 +21,41 @@ elif [ "$RDBMS" == "edb" ] || [ "$RDBMS" == "edb_13" ]; then elif [ "$RDBMS" == "oracle" ]; then goal="-Pdb=oracle_ci" elif [ "$RDBMS" == "oracle_xe" ] || [ "$RDBMS" == "oracle_21" ]; then - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_xe_ci" elif [ "$RDBMS" == "oracle_atps_tls" ]; then echo "Managing Oracle Autonomous Database..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=autonomous&hostname=`hostname`" -H 'accept: application/json') export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host') export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service') - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_cloud_autonomous_tls -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE" elif [ "$RDBMS" == "oracle_atps" ]; then echo "Managing Oracle Autonomous Database..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=autonomous2&hostname=`hostname`" -H 'accept: application/json') export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host') export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service') - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_cloud_autonomous -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE" elif [ "$RDBMS" == "oracle_db19c" ]; then echo "Managing Oracle Database 19c..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=db19c&hostname=`hostname`" -H 'accept: application/json') export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host') export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service') - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_cloud_db19c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE" elif [ "$RDBMS" == "oracle_db21c" ]; then echo "Managing Oracle Database 21c..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=db21c&hostname=`hostname`" -H 'accept: application/json') export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host') export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service') - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_cloud_db21c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE" elif [ "$RDBMS" == "oracle_db23c" ]; then echo "Managing Oracle Database 23c..." export INFO=$(curl -s -k -L -X GET "https://api.atlas-controller.oraclecloud.com/ords/atlas/admin/database?type=db23c&hostname=`hostname`" -H 'accept: application/json') export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host') export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service') - # I have no idea why, but these tests don't seem to work on CI... goal="-Pdb=oracle_cloud_db23c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE" +# OTP +elif [ "$RDBMS" == "autonomous-transaction-processing-serverless" ] || [ "$RDBMS" == "base-database-service-19c" ] || [ "$RDBMS" == "base-database-service-21c" ] || [ "$RDBMS" == "base-database-service-23ai" ]; then + echo "Managing OTP Database..." + goal="-Pdb=oracle_test_pilot_database -DrunID=$RUNID -DdbPassword=$TESTPILOT_PASSWORD -DdbConnectionStringSuffix=$TESTPILOT_CONNECTION_STRING_SUFFIX" elif [ "$RDBMS" == "db2" ] || [ "$RDBMS" == "db2_11_5" ]; then goal="-Pdb=db2_ci" elif [ "$RDBMS" == "mssql" ] || [ "$RDBMS" == "mssql_2017" ]; then diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/datasource/DataSourceTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/datasource/DataSourceTest.java index 4dca9176791d..a4f75b5c769d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/datasource/DataSourceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/datasource/DataSourceTest.java @@ -36,7 +36,7 @@ void test(EntityManagerFactoryScope scope) { scope.getEntityManagerFactory(); LogInspectionHelper.clearAllListeners( ConnectionInfoLogger.INSTANCE ); Dialect dialect = scope.getDialect(); - assertTrue( dialect instanceof OracleDialect od && od.isAutonomous() + assertTrue( dialect instanceof OracleDialect || dialect instanceof DB2Dialect || dialect instanceof InformixDialect // Informix metadata does not include the URL || listener.seen ); diff --git a/local-build-plugins/src/main/groovy/local.databases.gradle b/local-build-plugins/src/main/groovy/local.databases.gradle index 57bbda2dce3d..4d02861db6fe 100644 --- a/local-build-plugins/src/main/groovy/local.databases.gradle +++ b/local-build-plugins/src/main/groovy/local.databases.gradle @@ -9,6 +9,8 @@ ext { db = project.getProperty('db') dbHost = System.getProperty( 'dbHost', 'localhost' ) dbService = System.getProperty( 'dbService', '' ) + dbPassword = System.getProperty( 'dbPassword', '' ).replace('"', '') + dbConnectionStringSuffix = System.getProperty( 'dbConnectionStringSuffix', '' ).replace('"', '') runID = System.getProperty( 'runID', '' ) dbBundle = [ @@ -288,6 +290,15 @@ ext { // 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', 'connection.init_sql' : '' ], + oracle_test_pilot_database: [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test_' + runID, + 'jdbc.pass' : dbPassword, + 'jdbc.url' : 'jdbc:oracle:thin:@' + dbConnectionStringSuffix + '?oracle.jdbc.enableQueryResultCache=false', + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', + 'connection.init_sql' : '' + ], mssql : [ 'db.dialect' : 'org.hibernate.dialect.SQLServerDialect', 'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',