diff --git a/.github/workflows/atlas.yml b/.github/workflows/atlas.yml new file mode 100644 index 0000000000..b69a091541 --- /dev/null +++ b/.github/workflows/atlas.yml @@ -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 \ No newline at end of file diff --git a/ci/build.sh b/ci/build.sh index 8b6f01e227..7642d4ec17 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -18,6 +18,34 @@ elif [ "$RDBMS" == "edb" ] || [ "$RDBMS" == "edb_11" ]; then goal="-Pdb=edb_ci -DdbHost=localhost:5444" elif [ "$RDBMS" == "oracle" ]; then 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 goal="-Pdb=oracle_legacy_ci" elif [ "$RDBMS" == "db2" ]; then diff --git a/ci/database-start.sh b/ci/database-start.sh index a1baf2444b..433bd1f420 100755 --- a/ci/database-start.sh +++ b/ci/database-start.sh @@ -14,6 +14,14 @@ elif [ "$RDBMS" == 'db2' ]; then bash $DIR/../docker_db.sh db2 elif [ "$RDBMS" == 'oracle' ]; then 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 bash $DIR/../docker_db.sh mssql elif [ "$RDBMS" == 'sybase' ]; then diff --git a/docker_db.sh b/docker_db.sh index 8a906a410e..8cee205c19 100755 --- a/docker_db.sh +++ b/docker_db.sh @@ -641,6 +641,59 @@ disable_userland_proxy() { 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 <