Skip to content

Commit 917457f

Browse files
committed
HHH-17237 Add Atlas workflow
1 parent 3398e4e commit 917457f

File tree

5 files changed

+216
-2
lines changed

5 files changed

+216
-2
lines changed

.github/workflows/atlas.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# The main CI of Hibernate ORM is https://ci.hibernate.org/job/hibernate-orm-pipeline/.
2+
# However, Hibernate ORM builds run on GitHub actions regularly
3+
# to check that it still works and can be used in GitHub forks.
4+
# See https://docs.github.com/en/free-pro-team@latest/actions
5+
# for more information about GitHub actions.
6+
7+
name: Hibernate ORM build-Atlas
8+
9+
on:
10+
push:
11+
branches:
12+
- '6.2'
13+
pull_request:
14+
branches:
15+
- '6.2'
16+
17+
permissions: {} # none
18+
19+
# See https://github.com/hibernate/hibernate-orm/pull/4615 for a description of the behavior we're getting.
20+
concurrency:
21+
# Consider that two builds are in the same concurrency group (cannot run concurrently)
22+
# if they use the same workflow and are about the same branch ("ref") or pull request.
23+
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
24+
# Cancel previous builds in the same concurrency group even if they are in process
25+
# for pull requests or pushes to forks (not the upstream repository).
26+
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'hibernate/hibernate-orm' }}
27+
28+
jobs:
29+
build:
30+
permissions:
31+
contents: read
32+
name: Java 11
33+
# runs-on: ubuntu-latest
34+
runs-on: [self-hosted, Linux, X64, OCI]
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
include:
39+
- rdbms: oracle_atps
40+
- rdbms: oracle_db19c
41+
- rdbms: oracle_db21c
42+
- rdbms: oracle_db23c
43+
steps:
44+
- uses: actions/checkout@v3
45+
with:
46+
persist-credentials: false
47+
- name: Reclaim Disk Space
48+
run: .github/ci-prerequisites.sh
49+
- name: Start database
50+
env:
51+
RDBMS: ${{ matrix.rdbms }}
52+
RUNID: ${{ github.run_number }}
53+
run: ci/database-start.sh
54+
- name: Set up Java 11
55+
uses: actions/setup-java@v3
56+
with:
57+
distribution: 'temurin'
58+
java-version: '11'
59+
- name: Get year/month for cache key
60+
id: get-date
61+
run: echo "yearmonth=$(/bin/date -u "+%Y-%m")" >> $GITHUB_OUTPUT
62+
shell: bash
63+
- name: Cache Maven local repository
64+
uses: actions/cache@v3
65+
id: cache-maven
66+
with:
67+
path: |
68+
~/.m2/repository
69+
~/.gradle/caches/
70+
~/.gradle/wrapper/
71+
# refresh cache every month to avoid unlimited growth
72+
key: maven-localrepo-${{ steps.get-date.outputs.yearmonth }}
73+
- name: Run build script
74+
env:
75+
RDBMS: ${{ matrix.rdbms }}
76+
RUNID: ${{ github.run_number }}
77+
run: ./ci/build-github.sh
78+
shell: bash
79+
- name: Upload test reports (if Gradle failed)
80+
uses: actions/upload-artifact@v3
81+
if: failure()
82+
with:
83+
name: test-reports-java11-${{ matrix.rdbms }}
84+
path: |
85+
./**/target/reports/tests/
86+
./**/target/reports/checkstyle/
87+
- name: Omit produced artifacts from build cache
88+
run: ./ci/before-cache.sh

ci/build.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,34 @@ elif [ "$RDBMS" == "edb" ] || [ "$RDBMS" == "edb_10" ]; then
2020
goal="-Pdb=edb_ci -DdbHost=localhost:5444"
2121
elif [ "$RDBMS" == "oracle" ]; then
2222
goal="-Pdb=oracle_ci"
23+
elif [ "$RDBMS" == "oracle_atps" ]; then
24+
echo "Managing Oracle Autonomous Database..."
25+
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')
26+
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
27+
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
28+
# I have no idea why, but these tests don't seem to work on CI...
29+
goal="-Pdb=oracle_cloud_autonomous_tls -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE"
30+
elif [ "$RDBMS" == "oracle_db19c" ]; then
31+
echo "Managing Oracle Database 19c..."
32+
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')
33+
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
34+
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
35+
# I have no idea why, but these tests don't seem to work on CI...
36+
goal="-Pdb=oracle_cloud_db19c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE"
37+
elif [ "$RDBMS" == "oracle_db21c" ]; then
38+
echo "Managing Oracle Database 21c..."
39+
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')
40+
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
41+
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
42+
# I have no idea why, but these tests don't seem to work on CI...
43+
goal="-Pdb=oracle_cloud_db21c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE"
44+
elif [ "$RDBMS" == "oracle_db23c" ]; then
45+
echo "Managing Oracle Database 23c..."
46+
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')
47+
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
48+
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
49+
# I have no idea why, but these tests don't seem to work on CI...
50+
goal="-Pdb=oracle_cloud_db23c -DrunID=$RUNID -DdbHost=$HOST -DdbService=$SERVICE"
2351
elif [ "$RDBMS" == "oracle_11_2" ]; then
2452
goal="-Pdb=oracle_legacy_ci"
2553
elif [ "$RDBMS" == "db2" ]; then

ci/database-start.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ elif [ "$RDBMS" == 'db2' ]; then
1414
bash $DIR/../docker_db.sh db2
1515
elif [ "$RDBMS" == 'oracle' ]; then
1616
bash $DIR/../docker_db.sh oracle
17+
elif [ "$RDBMS" == 'oracle_atps' ]; then
18+
bash $DIR/../docker_db.sh oracle_atps
19+
elif [ "$RDBMS" == 'oracle_db19c' ]; then
20+
bash $DIR/../docker_db.sh oracle_db19c
21+
elif [ "$RDBMS" == 'oracle_db21c' ]; then
22+
bash $DIR/../docker_db.sh oracle_db21c
23+
elif [ "$RDBMS" == 'oracle_db23c' ]; then
24+
bash $DIR/../docker_db.sh oracle_db23c
1725
elif [ "$RDBMS" == 'mssql' ]; then
1826
bash $DIR/../docker_db.sh mssql
1927
elif [ "$RDBMS" == 'sybase' ]; then

docker_db.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,59 @@ disable_userland_proxy() {
646646
fi
647647
}
648648

649+
oracle_atps() {
650+
echo "Managing Oracle Autonomous Database..."
651+
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')
652+
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
653+
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
654+
export PASSWORD=$(echo $INFO | jq -r '.database' | jq -r '.password')
655+
656+
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;"
657+
}
658+
659+
oracle_db19c() {
660+
echo "Managing Oracle Database 19c..."
661+
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')
662+
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
663+
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
664+
export PASSWORD=$(echo $INFO | jq -r '.database' | jq -r '.password')
665+
666+
/home/opc/sqlcl/bin/sql -s system/$PASSWORD@$HOST:1521/$SERVICE <<EOF
667+
create user hibernate_orm_test_$RUNID identified by "Oracle_19_Password" DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
668+
alter user hibernate_orm_test_$RUNID quota unlimited on users;
669+
grant all privileges to hibernate_orm_test_$RUNID;
670+
EOF
671+
672+
}
673+
674+
oracle_db21c() {
675+
echo "Managing Oracle Database 21c..."
676+
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')
677+
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
678+
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
679+
export PASSWORD=$(echo $INFO | jq -r '.database' | jq -r '.password')
680+
681+
/home/opc/sqlcl/bin/sql -s system/$PASSWORD@$HOST:1521/$SERVICE <<EOF
682+
create user hibernate_orm_test_$RUNID identified by "Oracle_21_Password" DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
683+
alter user hibernate_orm_test_$RUNID quota unlimited on users;
684+
grant all privileges to hibernate_orm_test_$RUNID;
685+
EOF
686+
}
687+
688+
oracle_db23c() {
689+
echo "Managing Oracle Database 23c..."
690+
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')
691+
export HOST=$(echo $INFO | jq -r '.database' | jq -r '.host')
692+
export SERVICE=$(echo $INFO | jq -r '.database' | jq -r '.service')
693+
export PASSWORD=$(echo $INFO | jq -r '.database' | jq -r '.password')
694+
695+
/home/opc/sqlcl/bin/sql -s system/$PASSWORD@$HOST:1521/$SERVICE <<EOF
696+
create user hibernate_orm_test_$RUNID identified by "Oracle_23_Password" DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
697+
alter user hibernate_orm_test_$RUNID quota unlimited on users;
698+
grant all privileges to hibernate_orm_test_$RUNID;
699+
EOF
700+
}
701+
649702
oracle() {
650703
oracle_21
651704
}

gradle/databases.gradle

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ext {
1212
db = project.hasProperty('db') ? project.getProperty('db') : 'h2'
1313
dbHost = System.getProperty( 'dbHost', 'localhost' )
1414
dbService = System.getProperty( 'dbService', '' )
15+
runID = System.getProperty( 'runID', '' )
1516
dbBundle = [
1617
h2 : [
1718
'db.dialect' : 'org.hibernate.dialect.H2Dialect',
@@ -159,13 +160,49 @@ ext {
159160
oracle_cloud_autonomous_tls : [
160161
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
161162
'jdbc.driver': 'oracle.jdbc.OracleDriver',
162-
'jdbc.user' : 'hibernate_orm_test',
163+
'jdbc.user' : 'hibernate_orm_test_' + runID,
163164
'jdbc.pass' : 'Oracle_19_Password',
164165
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
165166
//
166167
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
167168
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
168-
'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)))',
169+
'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)))',
170+
'connection.init_sql' : ''
171+
],
172+
oracle_cloud_db19c : [
173+
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
174+
'jdbc.driver': 'oracle.jdbc.OracleDriver',
175+
'jdbc.user' : 'hibernate_orm_test_' + runID,
176+
'jdbc.pass' : 'Oracle_19_Password',
177+
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
178+
//
179+
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
180+
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
181+
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService,
182+
'connection.init_sql' : ''
183+
],
184+
oracle_cloud_db21c : [
185+
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
186+
'jdbc.driver': 'oracle.jdbc.OracleDriver',
187+
'jdbc.user' : 'hibernate_orm_test_' + runID,
188+
'jdbc.pass' : 'Oracle_21_Password',
189+
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
190+
//
191+
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
192+
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
193+
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService,
194+
'connection.init_sql' : ''
195+
],
196+
oracle_cloud_db23c : [
197+
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
198+
'jdbc.driver': 'oracle.jdbc.OracleDriver',
199+
'jdbc.user' : 'hibernate_orm_test_' + runID,
200+
'jdbc.pass' : 'Oracle_23_Password',
201+
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
202+
//
203+
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
204+
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
205+
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService,
169206
'connection.init_sql' : ''
170207
],
171208
mssql : [

0 commit comments

Comments
 (0)