2022-04-06 12:52:56 -04:00
|
|
|
# The main CI of Hibernate ORM is https://ci.hibernate.org/job/hibernate-orm-pipeline/.
|
2020-11-19 09:50:16 -05:00
|
|
|
# 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.
|
|
|
|
|
2020-11-26 10:19:08 -05:00
|
|
|
name: Hibernate ORM build
|
2020-11-19 09:50:16 -05:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-03-19 11:59:03 -04:00
|
|
|
- 'main'
|
2024-03-28 12:22:54 -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:
|
2020-11-19 09:50:16 -05:00
|
|
|
branches:
|
2021-03-19 11:59:03 -04:00
|
|
|
- 'main'
|
2024-03-28 12:22:54 -04:00
|
|
|
|
2022-08-27 18:52:16 -04:00
|
|
|
permissions: {} # none
|
2022-01-10 07:46:54 -05:00
|
|
|
|
|
|
|
# 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-03-28 12:22:54 -04:00
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request_target' || github.repository != 'hibernate/hibernate-orm' }}
|
2022-01-10 07:46:54 -05:00
|
|
|
|
2020-11-19 09:50:16 -05:00
|
|
|
jobs:
|
|
|
|
build:
|
2022-08-27 18:52:16 -04:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2021-12-01 06:31:29 -05:00
|
|
|
name: Java 11
|
2020-11-19 09:50:16 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
2020-11-26 10:19:08 -05:00
|
|
|
fail-fast: false
|
2020-11-19 09:50:16 -05:00
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- rdbms: h2
|
2021-06-23 08:56:57 -04:00
|
|
|
- rdbms: hsqldb
|
2020-11-19 09:50:16 -05:00
|
|
|
- rdbms: derby
|
2022-09-20 03:26:06 -04:00
|
|
|
- rdbms: mysql
|
2020-11-19 09:50:16 -05:00
|
|
|
- rdbms: mariadb
|
2022-09-20 03:26:06 -04:00
|
|
|
- rdbms: postgresql
|
2022-10-19 13:25:16 -04:00
|
|
|
- rdbms: edb
|
2020-11-19 09:50:16 -05:00
|
|
|
- rdbms: oracle
|
|
|
|
- rdbms: db2
|
|
|
|
- rdbms: mssql
|
2021-06-23 08:56:57 -04:00
|
|
|
- rdbms: sybase
|
2022-09-23 11:43:11 -04:00
|
|
|
# Running with CockroachDB requires at least 2-4 vCPUs, which we don't have on GH Actions runners
|
|
|
|
# - rdbms: cockroachdb
|
2021-04-06 08:24:13 -04:00
|
|
|
# Running with HANA requires at least 8GB memory just for the database, which we don't have on GH Actions runners
|
|
|
|
# - rdbms: hana
|
2020-11-19 09:50:16 -05:00
|
|
|
steps:
|
2024-03-28 12:22:54 -04:00
|
|
|
- name: Check out commit already pushed to branch
|
|
|
|
if: "! github.event.pull_request.number"
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
- name: Check out PR head
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
if: github.event.pull_request.number
|
2021-04-06 08:24:13 -04:00
|
|
|
with:
|
2024-03-28 12:22:54 -04:00
|
|
|
# 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"
|
2021-04-06 08:24:13 -04:00
|
|
|
persist-credentials: false
|
2021-02-09 07:03:18 -05:00
|
|
|
- name: Reclaim Disk Space
|
|
|
|
run: .github/ci-prerequisites.sh
|
2021-04-06 08:24:13 -04:00
|
|
|
- name: Start database
|
|
|
|
env:
|
|
|
|
RDBMS: ${{ matrix.rdbms }}
|
|
|
|
run: ci/database-start.sh
|
2020-11-19 09:50:16 -05:00
|
|
|
- name: Set up Java 11
|
2023-11-30 00:06:17 -05:00
|
|
|
uses: actions/setup-java@v4
|
2020-11-19 09:50:16 -05:00
|
|
|
with:
|
2021-12-01 09:54:59 -05:00
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '11'
|
2020-11-19 09:50:16 -05:00
|
|
|
- name: Get year/month for cache key
|
|
|
|
id: get-date
|
2022-10-31 06:22:17 -04:00
|
|
|
run: echo "yearmonth=$(/bin/date -u "+%Y-%m")" >> $GITHUB_OUTPUT
|
2020-11-19 09:50:16 -05:00
|
|
|
shell: bash
|
|
|
|
- name: Cache Maven local repository
|
2024-01-18 00:11:08 -05:00
|
|
|
uses: actions/cache@v4
|
2020-11-19 09:50:16 -05: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
|
2021-12-01 06:31:29 -05:00
|
|
|
env:
|
|
|
|
RDBMS: ${{ matrix.rdbms }}
|
2024-03-28 12:29:29 -04:00
|
|
|
# Don't populate Develocity cache in pull requests as that's potentially dangerous
|
|
|
|
POPULATE_REMOTE_GRADLE_CACHE: "${{ github.event_name == 'push' }}"
|
2024-03-28 12:22:54 -04:00
|
|
|
# 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: "${{ github.event_name == 'push' && secrets.GRADLE_ENTERPRISE_ACCESS_KEY || '' }}"
|
2020-11-26 10:19:08 -05:00
|
|
|
run: ./ci/build-github.sh
|
2020-11-19 09:50:16 -05:00
|
|
|
shell: bash
|
2024-03-28 12:22:54 -04:00
|
|
|
- name: Publish Develocity build scan for previous build (pull request)
|
|
|
|
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 }}
|
2020-11-19 09:50:16 -05:00
|
|
|
- name: Upload test reports (if Gradle failed)
|
2023-12-15 00:59:40 -05:00
|
|
|
uses: actions/upload-artifact@v4
|
2020-11-19 09:50:16 -05:00
|
|
|
if: failure()
|
|
|
|
with:
|
2021-12-01 06:31:29 -05:00
|
|
|
name: test-reports-java11-${{ matrix.rdbms }}
|
2021-02-03 04:55:07 -05:00
|
|
|
path: |
|
|
|
|
./**/target/reports/tests/
|
|
|
|
./**/target/reports/checkstyle/
|
2020-11-19 09:50:16 -05:00
|
|
|
- name: Omit produced artifacts from build cache
|
2021-04-06 08:24:13 -04:00
|
|
|
run: ./ci/before-cache.sh
|