Skip to content

Commit 4807000

Browse files
committed
Add Maven project and CI
1 parent b32d4e8 commit 4807000

File tree

12 files changed

+826
-0
lines changed

12 files changed

+826
-0
lines changed

.github/workflows/build.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: GitHub Actions Build
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, synchronize, reopened, ready_for_review]
7+
8+
concurrency:
9+
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
10+
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'hibernate/hibernate-github-bot-playground' }}
11+
12+
defaults:
13+
run:
14+
shell: bash
15+
16+
env:
17+
MAVEN_ARGS: "-e -B --fail-at-end"
18+
19+
jobs:
20+
build:
21+
name: ${{matrix.os.name}}
22+
runs-on: ${{ matrix.os.runs-on }}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os:
27+
- {
28+
name: "Linux JDK 17",
29+
runs-on: 'ubuntu-latest',
30+
java: {
31+
version: 17
32+
}
33+
}
34+
# We can't start Linux containers on GitHub Actions' Windows VMs,
35+
# so we can't run Elasticsearch tests.
36+
# See https://github.com/actions/runner-images/issues/1143#issuecomment-972929995
37+
- {
38+
name: "Windows JDK 17",
39+
runs-on: 'windows-latest',
40+
java: {
41+
version: 17
42+
}
43+
}
44+
steps:
45+
- name: Support longpaths on Windows
46+
if: "startsWith(matrix.os.runs-on, 'windows')"
47+
run: git config --global core.longpaths true
48+
- uses: actions/checkout@v4
49+
with:
50+
# Fetch the whole history to make sure that gitflow incremental builder
51+
# can find the base commit.
52+
fetch-depth: 0
53+
- name: Set up Java ${{ matrix.os.java.version }}
54+
uses: actions/setup-java@v4
55+
with:
56+
java-version: ${{ matrix.os.java.version }}
57+
distribution: temurin
58+
- name: Set up Maven
59+
run: ./mvnw -v
60+
- name: Building code and running unit tests and basic checks
61+
run: |
62+
./mvnw $MAVEN_ARGS ${{ matrix.os.maven.args }} clean install \
63+
-Pjqassistant -Pdist -Pci-build -DskipITs
64+
env:
65+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
66+
- name: Running integration tests in the default environment
67+
run: |
68+
./mvnw $MAVEN_ARGS ${{ matrix.os.maven.args }} clean verify \
69+
-Pskip-checks \
70+
${{ github.event.pull_request.base.ref && format('-Dincremental -Dgib.referenceBranch=refs/remotes/origin/{0}', github.event.pull_request.base.ref) || '' }}
71+
env:
72+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ nb-configuration.xml
3737

3838
# Local environment
3939
.env
40+
41+
# Gradle Enterprise/Develocity
42+
/.mvn/.gradle-enterprise

.mvn/extensions.xml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<extensions>
2+
<extension>
3+
<groupId>com.gradle</groupId>
4+
<artifactId>gradle-enterprise-maven-extension</artifactId>
5+
<version>1.20.1</version>
6+
</extension>
7+
<extension>
8+
<groupId>com.gradle</groupId>
9+
<artifactId>common-custom-user-data-maven-extension</artifactId>
10+
<version>1.13</version>
11+
</extension>
12+
</extensions>

.mvn/gradle-enterprise.xml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<gradleEnterprise
2+
xmlns="https://www.gradle.com/gradle-enterprise-maven" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="https://www.gradle.com/gradle-enterprise-maven https://www.gradle.com/schema/gradle-enterprise-maven.xsd">
4+
<server>
5+
<url>https://ge.hibernate.org</url>
6+
<allowUntrusted>false</allowUntrusted>
7+
</server>
8+
<buildScan>
9+
<!-- adjust conditions ?
10+
mvn gradle-enterprise:provision-access-key
11+
https://docs.gradle.com/enterprise/maven-extension/#publishing_based_on_criteria
12+
-->
13+
<!-- build scan publication is configured in gradle-enterprise-custom-user-data.groovy
14+
to leverage options to disable build scan publication for test builds
15+
-->
16+
<!--
17+
Expression support is documented here: https://docs.gradle.com/enterprise/maven-extension/#expression_support
18+
-->
19+
<obfuscation>
20+
<!-- Don't share ip addresses-->
21+
<ipAddresses>#{{'0.0.0.0'}}</ipAddresses>
22+
</obfuscation>
23+
<capture>
24+
<goalInputFiles>true</goalInputFiles>
25+
</capture>
26+
<!-- https://docs.gradle.com/enterprise/maven-extension/#manual_access_key_configuration -->
27+
<backgroundBuildScanUpload>#{env['CI'] == null}</backgroundBuildScanUpload>
28+
</buildScan>
29+
<buildCache>
30+
<local>
31+
<enabled>#{properties['no-build-cache'] == null}</enabled>
32+
</local>
33+
<remote>
34+
<enabled>#{properties['no-build-cache'] == null}</enabled>
35+
<storeEnabled>#{env['CI'] != null and (env['CHANGE_ID']?:'').isBlank() and (env['GITHUB_BASE_REF']?:'').isBlank() and !(env['GRADLE_ENTERPRISE_ACCESS_KEY']?:'').isBlank()}</storeEnabled>
36+
<server>
37+
<url>https://ge.hibernate.org/cache/hsearchtest01/</url>
38+
</server>
39+
</remote>
40+
</buildCache>
41+
</gradleEnterprise>

.mvn/jvm.config

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED

.mvn/wrapper/maven-wrapper.jar

61.1 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

Jenkinsfile

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
def withMavenWorkspace(Closure body) {
2+
withMaven(jdk: 'OpenJDK 17 Latest', maven: 'Apache Maven 3.9',
3+
mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository',
4+
options: [
5+
artifactsPublisher(disabled: true),
6+
junitPublisher(disabled: true)
7+
]) {
8+
withCredentials([string(credentialsId: 'ge.hibernate.org-access-key',
9+
variable: 'GRADLE_ENTERPRISE_ACCESS_KEY')]) {
10+
withGradle { // withDevelocity, actually: https://plugins.jenkins.io/gradle/#plugin-content-capturing-build-scans-from-jenkins-pipeline
11+
body()
12+
}
13+
}
14+
}
15+
}
16+
17+
pipeline {
18+
agent none
19+
options {
20+
buildDiscarder logRotator(daysToKeepStr: '10', numToKeepStr: '3')
21+
disableConcurrentBuilds(abortPrevious: true)
22+
}
23+
stages {
24+
stage('Default build') {
25+
agent {
26+
label 'Worker&&Containers'
27+
}
28+
steps {
29+
timeout(time: 30, unit: 'MINUTES') {
30+
withMavenWorkspace {
31+
sh "mvn clean install -U -Pdist -DskipTests"
32+
dir(env.WORKSPACE_TMP + '/.m2repository') {
33+
stash name: 'original-build-result', includes: "org/hibernate/infra/"
34+
}
35+
}
36+
}
37+
}
38+
}
39+
stage('Non-default envs') {
40+
matrix {
41+
axes {
42+
axis {
43+
name 'ENV_NAME'
44+
values 'elasticsearch-7', 'postgresql', 'opensearch-2.12'
45+
}
46+
}
47+
stages {
48+
stage('Build') {
49+
agent {
50+
label 'Worker&&Containers'
51+
}
52+
steps {
53+
dir(env.WORKSPACE_TMP + '/.m2repository') {
54+
unstash name: 'original-build-result'
55+
}
56+
withMavenWorkspace {
57+
sh """ \
58+
mvn clean install -U -Pdependency-update -Pdist -Pci-build -Dscan.tag.${env.ENV_NAME} \
59+
--fail-at-end \
60+
"""
61+
}
62+
}
63+
}
64+
}
65+
}
66+
}
67+
}
68+
}

0 commit comments

Comments
 (0)