Skip to content

Commit

Permalink
Backport GH actions to 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
beikov committed Mar 4, 2021
1 parent 79bc79b commit f23e97f
Show file tree
Hide file tree
Showing 10 changed files with 533 additions and 18 deletions.
7 changes: 7 additions & 0 deletions .github/ci-prerequisites.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Reclaim disk space, otherwise we only have 13 GB free at the start of a job

docker rmi node:10 node:12 mcr.microsoft.com/azure-pipelines/node8-typescript:latest
# That is 18 GB
sudo rm -rf /usr/share/dotnet
# That is 1.2 GB
sudo rm -rf /usr/share/swift
118 changes: 118 additions & 0 deletions .github/workflows/contributor-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# The main CI of Hibernate ORM is https://ci.hibernate.org/job/hibernate-orm-6.0-h2-main/.
# 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

on:
push:
branches:
- '5.4'
pull_request:
branches:
- '5.4'
jobs:
build:
name: Java 8
runs-on: ubuntu-latest
# We want to know the test results of all matrix entries
continue-on-error: true
strategy:
fail-fast: false
matrix:
# When GitHub Actions supports it: https://github.com/actions/toolkit/issues/399
# We will use the experimental flag as indicator whether a failure should cause a workflow failure
include:
- rdbms: h2
experimental: false
# - rdbms: derby
# experimental: true
# - rdbms: mariadb
# experimental: true
- rdbms: postgresql
experimental: true
# - rdbms: oracle
# experimental: true
# - rdbms: db2
# experimental: true
# - rdbms: mssql
# experimental: true
steps:
- uses: actions/checkout@v2
- name: Reclaim Disk Space
run: .github/ci-prerequisites.sh
- name: Set up Java 8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Get year/month for cache key
id: get-date
run: |
echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
shell: bash
- name: Cache Maven local repository
uses: actions/cache@v2
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 }}
run: ./ci/build-github.sh
shell: bash
- name: Upload test reports (if Gradle failed)
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-reports-java8-${{ matrix.rdbms }}
path: |
./**/target/reports/tests/
./**/target/reports/checkstyle/
- name: Omit produced artifacts from build cache
run: ./ci/before-cache.sh
build11:
name: Java 11
runs-on: ubuntu-latest
# We want to know the test results of all matrix entries
continue-on-error: true
steps:
- uses: actions/checkout@v2
- name: Set up Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Get year/month for cache key
id: get-date
run: |
echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
shell: bash
- name: Cache Maven local repository
uses: actions/cache@v2
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
run: ./ci/build-github.sh
shell: bash
- name: Upload test reports (if Gradle failed)
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-reports-java11
path: |
./**/target/reports/tests/
./**/target/reports/checkstyle/
- name: Omit produced artifacts from build cache
run: ./ci/before-cache.sh
7 changes: 7 additions & 0 deletions ci/before-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/bash

rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
rm -fr $HOME/.gradle/caches/*/plugin-resolution/
rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
rm -fr $HOME/.m2/repository/org/hibernate
23 changes: 23 additions & 0 deletions ci/build-github.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

java -version

if [ "$RDBMS" == 'mysql' ]; then
bash $DIR/../docker_db.sh mysql_5_7
elif [ "$RDBMS" == 'mysql8' ]; then
bash $DIR/../docker_db.sh mysql_8_0
elif [ "$RDBMS" == 'mariadb' ]; then
bash $DIR/../docker_db.sh mariadb
elif [ "$RDBMS" == 'postgresql' ]; then
bash $DIR/../docker_db.sh postgresql_9_5
elif [ "$RDBMS" == 'db2' ]; then
bash $DIR/../docker_db.sh db2
elif [ "$RDBMS" == 'oracle' ]; then
bash $DIR/../docker_db.sh oracle
elif [ "$RDBMS" == 'mssql' ]; then
bash $DIR/../docker_db.sh mssql
fi

exec bash $DIR/build.sh
27 changes: 27 additions & 0 deletions ci/build-travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#! /bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

java -version

if [ "$RDBMS" == 'mysql' ]; then
sudo service mysql stop
bash $DIR/../docker_db.sh mysql_5_7
elif [ "$RDBMS" == 'mysql8' ]; then
sudo service mysql stop
bash $DIR/../docker_db.sh mysql_8_0
elif [ "$RDBMS" == 'mariadb' ]; then
sudo service mysql stop
bash $DIR/../docker_db.sh mariadb
elif [ "$RDBMS" == 'postgresql' ]; then
sudo service postgres stop
bash $DIR/../docker_db.sh postgresql_9_5
elif [ "$RDBMS" == 'db2' ]; then
bash $DIR/../docker_db.sh db2
elif [ "$RDBMS" == 'oracle' ]; then
bash $DIR/../docker_db.sh oracle
elif [ "$RDBMS" == 'mssql' ]; then
bash $DIR/../docker_db.sh mssql
fi

exec bash $DIR/build.sh
18 changes: 18 additions & 0 deletions ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /bin/bash

goal=
if [ "$RDBMS" == "derby" ]; then
goal="-Pdb=derby"
elif [ "$RDBMS" == "mariadb" ]; then
goal="-Pdb=mariadb_ci"
elif [ "$RDBMS" == "postgresql" ]; then
goal="-Pdb=pgsql_ci"
elif [ "$RDBMS" == "oracle" ]; then
goal="-Pdb=oracle_ci"
elif [ "$RDBMS" == "db2" ]; then
goal="-Pdb=db2_ci"
elif [ "$RDBMS" == "mssql" ]; then
goal="-Pdb=mssql_ci"
fi

exec ./gradlew check ${goal} -Plog-test-progress=true --stacktrace

0 comments on commit f23e97f

Please sign in to comment.