Skip to content

Commit f23e97f

Browse files
committed
Backport GH actions to 5.4
1 parent 79bc79b commit f23e97f

File tree

10 files changed

+533
-18
lines changed

10 files changed

+533
-18
lines changed

.github/ci-prerequisites.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Reclaim disk space, otherwise we only have 13 GB free at the start of a job
2+
3+
docker rmi node:10 node:12 mcr.microsoft.com/azure-pipelines/node8-typescript:latest
4+
# That is 18 GB
5+
sudo rm -rf /usr/share/dotnet
6+
# That is 1.2 GB
7+
sudo rm -rf /usr/share/swift
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# The main CI of Hibernate ORM is https://ci.hibernate.org/job/hibernate-orm-6.0-h2-main/.
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
8+
9+
on:
10+
push:
11+
branches:
12+
- '5.4'
13+
pull_request:
14+
branches:
15+
- '5.4'
16+
jobs:
17+
build:
18+
name: Java 8
19+
runs-on: ubuntu-latest
20+
# We want to know the test results of all matrix entries
21+
continue-on-error: true
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
# When GitHub Actions supports it: https://github.com/actions/toolkit/issues/399
26+
# We will use the experimental flag as indicator whether a failure should cause a workflow failure
27+
include:
28+
- rdbms: h2
29+
experimental: false
30+
# - rdbms: derby
31+
# experimental: true
32+
# - rdbms: mariadb
33+
# experimental: true
34+
- rdbms: postgresql
35+
experimental: true
36+
# - rdbms: oracle
37+
# experimental: true
38+
# - rdbms: db2
39+
# experimental: true
40+
# - rdbms: mssql
41+
# experimental: true
42+
steps:
43+
- uses: actions/checkout@v2
44+
- name: Reclaim Disk Space
45+
run: .github/ci-prerequisites.sh
46+
- name: Set up Java 8
47+
uses: actions/setup-java@v1
48+
with:
49+
java-version: 1.8
50+
- name: Get year/month for cache key
51+
id: get-date
52+
run: |
53+
echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
54+
shell: bash
55+
- name: Cache Maven local repository
56+
uses: actions/cache@v2
57+
id: cache-maven
58+
with:
59+
path: |
60+
~/.m2/repository
61+
~/.gradle/caches/
62+
~/.gradle/wrapper/
63+
# refresh cache every month to avoid unlimited growth
64+
key: maven-localrepo-${{ steps.get-date.outputs.yearmonth }}
65+
- name: Run build script
66+
env:
67+
RDBMS: ${{ matrix.rdbms }}
68+
run: ./ci/build-github.sh
69+
shell: bash
70+
- name: Upload test reports (if Gradle failed)
71+
uses: actions/upload-artifact@v2
72+
if: failure()
73+
with:
74+
name: test-reports-java8-${{ matrix.rdbms }}
75+
path: |
76+
./**/target/reports/tests/
77+
./**/target/reports/checkstyle/
78+
- name: Omit produced artifacts from build cache
79+
run: ./ci/before-cache.sh
80+
build11:
81+
name: Java 11
82+
runs-on: ubuntu-latest
83+
# We want to know the test results of all matrix entries
84+
continue-on-error: true
85+
steps:
86+
- uses: actions/checkout@v2
87+
- name: Set up Java 11
88+
uses: actions/setup-java@v1
89+
with:
90+
java-version: 11
91+
- name: Get year/month for cache key
92+
id: get-date
93+
run: |
94+
echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
95+
shell: bash
96+
- name: Cache Maven local repository
97+
uses: actions/cache@v2
98+
id: cache-maven
99+
with:
100+
path: |
101+
~/.m2/repository
102+
~/.gradle/caches/
103+
~/.gradle/wrapper/
104+
# refresh cache every month to avoid unlimited growth
105+
key: maven-localrepo-${{ steps.get-date.outputs.yearmonth }}
106+
- name: Run build script
107+
run: ./ci/build-github.sh
108+
shell: bash
109+
- name: Upload test reports (if Gradle failed)
110+
uses: actions/upload-artifact@v2
111+
if: failure()
112+
with:
113+
name: test-reports-java11
114+
path: |
115+
./**/target/reports/tests/
116+
./**/target/reports/checkstyle/
117+
- name: Omit produced artifacts from build cache
118+
run: ./ci/before-cache.sh

ci/before-cache.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/bash
2+
3+
rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
4+
rm -fr $HOME/.gradle/caches/*/plugin-resolution/
5+
rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
6+
rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
7+
rm -fr $HOME/.m2/repository/org/hibernate

ci/build-github.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#! /bin/bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4+
5+
java -version
6+
7+
if [ "$RDBMS" == 'mysql' ]; then
8+
bash $DIR/../docker_db.sh mysql_5_7
9+
elif [ "$RDBMS" == 'mysql8' ]; then
10+
bash $DIR/../docker_db.sh mysql_8_0
11+
elif [ "$RDBMS" == 'mariadb' ]; then
12+
bash $DIR/../docker_db.sh mariadb
13+
elif [ "$RDBMS" == 'postgresql' ]; then
14+
bash $DIR/../docker_db.sh postgresql_9_5
15+
elif [ "$RDBMS" == 'db2' ]; then
16+
bash $DIR/../docker_db.sh db2
17+
elif [ "$RDBMS" == 'oracle' ]; then
18+
bash $DIR/../docker_db.sh oracle
19+
elif [ "$RDBMS" == 'mssql' ]; then
20+
bash $DIR/../docker_db.sh mssql
21+
fi
22+
23+
exec bash $DIR/build.sh

ci/build-travis.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#! /bin/bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4+
5+
java -version
6+
7+
if [ "$RDBMS" == 'mysql' ]; then
8+
sudo service mysql stop
9+
bash $DIR/../docker_db.sh mysql_5_7
10+
elif [ "$RDBMS" == 'mysql8' ]; then
11+
sudo service mysql stop
12+
bash $DIR/../docker_db.sh mysql_8_0
13+
elif [ "$RDBMS" == 'mariadb' ]; then
14+
sudo service mysql stop
15+
bash $DIR/../docker_db.sh mariadb
16+
elif [ "$RDBMS" == 'postgresql' ]; then
17+
sudo service postgres stop
18+
bash $DIR/../docker_db.sh postgresql_9_5
19+
elif [ "$RDBMS" == 'db2' ]; then
20+
bash $DIR/../docker_db.sh db2
21+
elif [ "$RDBMS" == 'oracle' ]; then
22+
bash $DIR/../docker_db.sh oracle
23+
elif [ "$RDBMS" == 'mssql' ]; then
24+
bash $DIR/../docker_db.sh mssql
25+
fi
26+
27+
exec bash $DIR/build.sh

ci/build.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /bin/bash
2+
3+
goal=
4+
if [ "$RDBMS" == "derby" ]; then
5+
goal="-Pdb=derby"
6+
elif [ "$RDBMS" == "mariadb" ]; then
7+
goal="-Pdb=mariadb_ci"
8+
elif [ "$RDBMS" == "postgresql" ]; then
9+
goal="-Pdb=pgsql_ci"
10+
elif [ "$RDBMS" == "oracle" ]; then
11+
goal="-Pdb=oracle_ci"
12+
elif [ "$RDBMS" == "db2" ]; then
13+
goal="-Pdb=db2_ci"
14+
elif [ "$RDBMS" == "mssql" ]; then
15+
goal="-Pdb=mssql_ci"
16+
fi
17+
18+
exec ./gradlew check ${goal} -Plog-test-progress=true --stacktrace

0 commit comments

Comments
 (0)