2023-09-21 09:42:43 -04:00
|
|
|
# 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:
|
2024-08-16 07:42:59 -04:00
|
|
|
- 'main'
|
2024-04-02 08:49:17 -04:00
|
|
|
# WARNING: Using pull_request_target to access secrets, but we check out the PR head commit.
|
|
|
|
# See checkout action for details.
|
|
|
|
pull_request_target:
|
2023-09-21 09:42:43 -04:00
|
|
|
branches:
|
2024-08-16 07:42:59 -04:00
|
|
|
- 'main'
|
2023-09-21 09:42:43 -04:00
|
|
|
|
|
|
|
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).
|
2024-04-02 08:49:17 -04:00
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request_target' || github.repository != 'hibernate/hibernate-orm' }}
|
2023-09-21 09:42:43 -04:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
permissions:
|
|
|
|
contents: read
|
2023-11-07 12:38:20 -05:00
|
|
|
name: ORM
|
2023-09-21 09:42:43 -04:00
|
|
|
# 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:
|
2024-04-02 08:49:17 -04:00
|
|
|
- name: Check out commit already pushed to branch
|
|
|
|
if: "! github.event.pull_request.number"
|
|
|
|
uses: actions/checkout@v4
|
2023-09-21 09:42:43 -04:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2024-04-02 08:49:17 -04:00
|
|
|
- name: Check out PR head
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
if: github.event.pull_request.number
|
|
|
|
with:
|
|
|
|
# WARNING: This is potentially dangerous since we're checking out unreviewed code,
|
|
|
|
# and since we're using the pull_request_target event we can use secrets.
|
|
|
|
# Thus, we must be extra careful to never expose secrets to steps that execute this code,
|
|
|
|
# and to strictly limit our of secrets to those that only pose minor security threats.
|
|
|
|
# This means in particular we won't expose Develocity credentials to the main gradle executions,
|
|
|
|
# but instead will execute gradle a second time just to push build scans to Develocity;
|
|
|
|
# see below.
|
|
|
|
ref: "refs/pull/${{ github.event.pull_request.number }}/head"
|
|
|
|
persist-credentials: false
|
2023-09-21 09:42:43 -04:00
|
|
|
- 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
|
2023-11-07 05:11:16 -05:00
|
|
|
- name: Set up Java 17
|
2024-01-31 08:03:54 -05:00
|
|
|
uses: graalvm/setup-graalvm@v1
|
2023-09-21 09:42:43 -04:00
|
|
|
with:
|
2024-01-31 08:03:54 -05:00
|
|
|
distribution: 'graalvm'
|
|
|
|
java-version: '21'
|
2023-09-21 09:42:43 -04:00
|
|
|
- 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
|
2024-01-18 00:11:08 -05:00
|
|
|
uses: actions/cache@v4
|
2023-09-21 09:42:43 -04:00
|
|
|
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 }}
|
2024-04-02 08:49:17 -04:00
|
|
|
# WARNING: exposes secrets, so must only be passed to a step that doesn't run unapproved code.
|
|
|
|
# WARNING: As this runs on untrusted nodes, we use the same access key as for PRs:
|
|
|
|
# it has limited access, essentially it can only push build scans.
|
2024-04-16 15:14:59 -04:00
|
|
|
DEVELOCITY_ACCESS_KEY: "${{ github.event_name == 'push' && secrets.GRADLE_ENTERPRISE_ACCESS_KEY_PR || '' }}"
|
2023-09-21 09:42:43 -04:00
|
|
|
run: ./ci/build-github.sh
|
|
|
|
shell: bash
|
2024-04-02 08:49:17 -04:00
|
|
|
- name: Publish Develocity build scan for previous build
|
2024-05-21 07:21:02 -04:00
|
|
|
# Don't fail a build if publishing fails
|
|
|
|
continue-on-error: true
|
2024-04-02 08:49:17 -04:00
|
|
|
if: "${{ !cancelled() && github.event_name == 'pull_request_target' && github.repository == 'hibernate/hibernate-orm' }}"
|
|
|
|
run: |
|
|
|
|
./gradlew buildScanPublishPrevious
|
|
|
|
env:
|
|
|
|
# WARNING: exposes secrets, so must only be passed to a step that doesn't run unapproved code.
|
2024-04-16 15:14:59 -04:00
|
|
|
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY_PR }}
|
2023-09-21 09:42:43 -04:00
|
|
|
- name: Upload test reports (if Gradle failed)
|
2023-12-15 00:59:40 -05:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-09-21 09:42:43 -04:00
|
|
|
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
|