HHH-17237 Add Atlas workflow

This commit is contained in:
Christian Beikov 2023-09-21 15:42:43 +02:00
parent 5cdebfa59e
commit f181338d86
5 changed files with 216 additions and 2 deletions

88
.github/workflows/atlas.yml vendored Normal file
View File

@ -0,0 +1,88 @@
# The main CI of Hibernate ORM is https://ci.hibernate.org/job/hibernate-orm-pipeline/.
# However, Hibernate ORM builds run on GitHub actions regularly
# to check that it still works and can be used in GitHub forks.
# See https://docs.github.com/en/free-pro-team@latest/actions
# for more information about GitHub actions.
name: Hibernate ORM build-Atlas
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
permissions: {} # none
# 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") or pull request.
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
# 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-orm' }}
jobs:
build:
permissions:
contents: read
name: Java 11
# runs-on: ubuntu-latest
runs-on: [self-hosted, Linux, X64, OCI]
strategy:
fail-fast: false
matrix:
include:
- rdbms: oracle_atps
- rdbms: oracle_db19c
- rdbms: oracle_db21c
- rdbms: oracle_db23c
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Reclaim Disk Space
run: .github/ci-prerequisites.sh
- name: Start database
env:
RDBMS: ${{ matrix.rdbms }}
RUNID: ${{ github.run_number }}
run: ci/database-start.sh
- name: Set up Java 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Get year/month for cache key
id: get-date
run: echo "yearmonth=$(/bin/date -u "+%Y-%m")" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Maven local repository
uses: actions/cache@v3
id: cache-maven
with:
path: |
~/.m2/repository
~/.gradle/caches/
~/.gradle/wrapper/
# refresh cache every month to avoid unlimited growth
key: maven-localrepo-${{ steps.get-date.outputs.yearmonth }}
- name: Run build script
env:
RDBMS: ${{ matrix.rdbms }}
RUNID: ${{ github.run_number }}
run: ./ci/build-github.sh
shell: bash
- name: Upload test reports (if Gradle failed)
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-reports-java11-${{ matrix.rdbms }}
path: |
./**/target/reports/tests/
./**/target/reports/checkstyle/
- name: Omit produced artifacts from build cache
run: ./ci/before-cache.sh

View File

@ -18,6 +18,34 @@ elif [ "$RDBMS" == "edb" ] || [ "$RDBMS" == "edb_11" ]; then
goal="-Pdb=edb_ci -DdbHost=localhost:5444" goal="-Pdb=edb_ci -DdbHost=localhost:5444"
elif [ "$RDBMS" == "oracle" ]; then elif [ "$RDBMS" == "oracle" ]; then
goal="-Pdb=oracle_ci" goal="-Pdb=oracle_ci"
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=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_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"
elif [ "$RDBMS" == "oracle_11_2" ]; then elif [ "$RDBMS" == "oracle_11_2" ]; then
goal="-Pdb=oracle_legacy_ci" goal="-Pdb=oracle_legacy_ci"
elif [ "$RDBMS" == "db2" ]; then elif [ "$RDBMS" == "db2" ]; then

View File

@ -14,6 +14,14 @@ elif [ "$RDBMS" == 'db2' ]; then
bash $DIR/../docker_db.sh db2 bash $DIR/../docker_db.sh db2
elif [ "$RDBMS" == 'oracle' ]; then elif [ "$RDBMS" == 'oracle' ]; then
bash $DIR/../docker_db.sh oracle bash $DIR/../docker_db.sh oracle
elif [ "$RDBMS" == 'oracle_atps' ]; then
bash $DIR/../docker_db.sh oracle_atps
elif [ "$RDBMS" == 'oracle_db19c' ]; then
bash $DIR/../docker_db.sh oracle_db19c
elif [ "$RDBMS" == 'oracle_db21c' ]; then
bash $DIR/../docker_db.sh oracle_db21c
elif [ "$RDBMS" == 'oracle_db23c' ]; then
bash $DIR/../docker_db.sh oracle_db23c
elif [ "$RDBMS" == 'mssql' ]; then elif [ "$RDBMS" == 'mssql' ]; then
bash $DIR/../docker_db.sh mssql bash $DIR/../docker_db.sh mssql
elif [ "$RDBMS" == 'sybase' ]; then elif [ "$RDBMS" == 'sybase' ]; then

View File

@ -641,6 +641,59 @@ disable_userland_proxy() {
fi fi
} }
oracle_atps() {
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')
export PASSWORD=$(echo $INFO | jq -r '.database' | jq -r '.password')
curl -s -X POST "https://${HOST}.oraclecloudapps.com/ords/admin/_/sql" -H 'content-type: application/sql' -H 'accept: application/json' -basic -u admin:${PASSWORD} --data-ascii "create user hibernate_orm_test_$RUNID identified by \"Oracle_19_Password\" DEFAULT TABLESPACE DATA TEMPORARY TABLESPACE TEMP;alter user hibernate_orm_test_$RUNID quota unlimited on data;grant pdb_dba to hibernate_orm_test_$RUNID;BEGIN ords_admin.enable_schema(p_enabled => TRUE, p_schema => 'hibernate_orm_test_$RUNID', p_url_mapping_type => 'BASE_PATH', p_url_mapping_pattern => 'hibernate_orm_test_$RUNID', p_auto_rest_auth => TRUE); END;"
}
oracle_db19c() {
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')
export PASSWORD=$(echo $INFO | jq -r '.database' | jq -r '.password')
/home/opc/sqlcl/bin/sql -s system/$PASSWORD@$HOST:1521/$SERVICE <<EOF
create user hibernate_orm_test_$RUNID identified by "Oracle_19_Password" DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
alter user hibernate_orm_test_$RUNID quota unlimited on users;
grant all privileges to hibernate_orm_test_$RUNID;
EOF
}
oracle_db21c() {
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')
export PASSWORD=$(echo $INFO | jq -r '.database' | jq -r '.password')
/home/opc/sqlcl/bin/sql -s system/$PASSWORD@$HOST:1521/$SERVICE <<EOF
create user hibernate_orm_test_$RUNID identified by "Oracle_21_Password" DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
alter user hibernate_orm_test_$RUNID quota unlimited on users;
grant all privileges to hibernate_orm_test_$RUNID;
EOF
}
oracle_db23c() {
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')
export PASSWORD=$(echo $INFO | jq -r '.database' | jq -r '.password')
/home/opc/sqlcl/bin/sql -s system/$PASSWORD@$HOST:1521/$SERVICE <<EOF
create user hibernate_orm_test_$RUNID identified by "Oracle_23_Password" DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
alter user hibernate_orm_test_$RUNID quota unlimited on users;
grant all privileges to hibernate_orm_test_$RUNID;
EOF
}
oracle() { oracle() {
oracle_21 oracle_21
} }

View File

@ -12,6 +12,7 @@ ext {
db = project.hasProperty('db') ? project.getProperty('db') : 'h2' db = project.hasProperty('db') ? project.getProperty('db') : 'h2'
dbHost = System.getProperty( 'dbHost', 'localhost' ) dbHost = System.getProperty( 'dbHost', 'localhost' )
dbService = System.getProperty( 'dbService', '' ) dbService = System.getProperty( 'dbService', '' )
runID = System.getProperty( 'runID', '' )
dbBundle = [ dbBundle = [
h2 : [ h2 : [
'db.dialect' : 'org.hibernate.dialect.H2Dialect', 'db.dialect' : 'org.hibernate.dialect.H2Dialect',
@ -159,13 +160,49 @@ ext {
oracle_cloud_autonomous_tls : [ oracle_cloud_autonomous_tls : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect', 'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver', 'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test', 'jdbc.user' : 'hibernate_orm_test_' + runID,
'jdbc.pass' : 'Oracle_19_Password', 'jdbc.pass' : 'Oracle_19_Password',
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
// //
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
'jdbc.url' : 'jdbc:oracle:thin:@(description=(retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=' + dbHost + '.oraclecloud.com))(connect_data=(service_name=' + dbService + '_low.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))', 'jdbc.url' : 'jdbc:oracle:thin:@(description=(retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=' + dbHost + '.oraclecloud.com))(connect_data=(service_name=' + dbService + '_tp.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))',
'connection.init_sql' : ''
],
oracle_cloud_db19c : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test_' + runID,
'jdbc.pass' : 'Oracle_19_Password',
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
//
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService,
'connection.init_sql' : ''
],
oracle_cloud_db21c : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test_' + runID,
'jdbc.pass' : 'Oracle_21_Password',
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
//
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService,
'connection.init_sql' : ''
],
oracle_cloud_db23c : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test_' + runID,
'jdbc.pass' : 'Oracle_23_Password',
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
//
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService,
'connection.init_sql' : '' 'connection.init_sql' : ''
], ],
mssql : [ mssql : [