HHH-14577 Add Jenkinsfiles for running TCKs

This commit is contained in:
Christian Beikov 2021-04-23 12:07:20 +02:00
parent ff9e9eebc9
commit c29b2d27ee
10 changed files with 295 additions and 191 deletions

View File

@ -0,0 +1,72 @@
@Library('hibernate-jenkins-pipeline-helpers@1.5') _
pipeline {
agent {
label 'LongDuration'
}
tools {
jdk 'OpenJDK 8 Latest'
}
stages {
stage('Build') {
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('openjdk:8-jdk').pull()
}
}
dir('hibernate') {
checkout scm
sh """ \
./gradlew publishToMavenLocal
"""
script {
env.HIBERNATE_VERSION = sh (
script: "grep hibernateVersion gradle/version.properties|cut -d'=' -f2",
returnStdout: true
).trim()
}
}
dir('tck') {
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/hibernate/jakarta-tck-runner.git']]]
sh """ \
cd jpa-2.2; docker build -t jakarta-tck-runner .
"""
}
}
}
stage('Run TCK') {
steps {
sh """ \
docker rm -f tck
docker run -v ~/.m2/repository/org/hibernate:/root/.m2/repository/org/hibernate:z -e NO_SLEEP=true -e HIBERNATE_VERSION=$HIBERNATE_VERSION --name tck jakarta-tck-runner
docker cp tck:/tck/persistence-tck/tmp/JTreport/ ./JTreport
"""
archiveArtifacts artifacts: 'JTreport/**'
script {
failures = sh (
script: """ \
while read line; do
if [[ "$line" != "*Passed." ]]; then
echo "$line"
fi
done <JTreport/text/summary.txt
""",
returnStdout: true
).trim()
if ( !failures.isEmpty() ) {
echo "Some TCK tests failed:"
echo failures
currentBuild.result = 'FAILURE'
}
}
}
}
}
post {
always {
// Space-separated
notifyBuildResult maintainers: 'christian.beikov@gmail.com'
}
}
}

View File

@ -0,0 +1,72 @@
@Library('hibernate-jenkins-pipeline-helpers@1.5') _
pipeline {
agent {
label 'LongDuration'
}
tools {
jdk 'OpenJDK 8 Latest'
}
stages {
stage('Build') {
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('openjdk:8-jdk').pull()
}
}
dir('hibernate') {
checkout scm
sh """ \
./gradlew publishToMavenLocal
"""
script {
env.HIBERNATE_VERSION = sh (
script: "grep hibernateVersion gradle/version.properties|cut -d'=' -f2",
returnStdout: true
).trim()
}
}
dir('tck') {
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/hibernate/jakarta-tck-runner.git']]]
sh """ \
cd jpa-3.0; docker build -t jakarta-tck-runner .
"""
}
}
}
stage('Run TCK') {
steps {
sh """ \
docker rm -f tck
docker run -v ~/.m2/repository/org/hibernate:/root/.m2/repository/org/hibernate:z -e NO_SLEEP=true -e HIBERNATE_VERSION=$HIBERNATE_VERSION --name tck jakarta-tck-runner
docker cp tck:/tck/persistence-tck/tmp/JTreport/ ./JTreport
"""
archiveArtifacts artifacts: 'JTreport/**'
script {
failures = sh (
script: """ \
while read line; do
if [[ "$line" != "*Passed." ]]; then
echo "$line"
fi
done <JTreport/text/summary.txt
""",
returnStdout: true
).trim()
if ( !failures.isEmpty() ) {
echo "Some TCK tests failed:"
echo failures
currentBuild.result = 'FAILURE'
}
}
}
}
}
post {
always {
// Space-separated
notifyBuildResult maintainers: 'christian.beikov@gmail.com'
}
}
}

View File

@ -142,6 +142,7 @@ ext {
informix: 'com.ibm.informix:jdbc:4.10.12',
jboss_jta: "org.jboss.narayana.jta:narayana-jta:5.11.1.Final",
// todo: update the version when the parent pom is published
jboss_tx_spi: "org.jboss:jboss-transaction-spi:7.6.0.Final",
// todo (jakarta): update the version when it is released
jboss_jta_jakarta: "org.jboss.narayana.jta:narayana-jta-jakarta:5.11.2.Final",

View File

@ -47,47 +47,49 @@ dependencies {
'org.slf4j:slf4j-api:1.7.26',
'org.eclipse.transformer:org.eclipse.transformer:0.2.0',
'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0'
testCompile( project(':hibernate-testing-jakarta') )
testCompile fileTree(dir: 'libs', include: '*.jar')
testCompile( libraries.shrinkwrap_api )
testCompile( libraries.shrinkwrap )
testCompile( libraries.jakarta_jacc )
testCompile( libraries.jakarta_validation )
testCompile( libraries.jandex )
testCompile( libraries.classmate )
testCompile( libraries.mockito )
testCompile( libraries.mockito_inline )
testCompile( libraries.jodaTime )
testCompile( libraries.assertj )
testCompile( libraries.jakarta_cdi )
testCompile( libraries.jakarta_validator ) {
// for test runtime
transitive = true
}
// for testing stored procedure support
testCompile( libraries.derby )
testRuntime( "org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:1.0.0.Final" )
testRuntime( libraries.jakarta_el )
testRuntime( 'jaxen:jaxen:1.1' )
testRuntime( libraries.javassist )
testRuntime( libraries.byteBuddy )
testRuntime( libraries.jakarta_weld )
testRuntime( libraries.atomikos )
testRuntime( libraries.atomikos_jta )
// todo (jakarta): replace this when the jakarta artifact is released
testRuntime( project(':hibernate-transaction-client') )
// testRuntime( libraries.wildfly_transaction_client_jakarta )
testCompile libraries.shrinkwrap_descriptors_api_javaee
testCompile libraries.shrinkwrap_descriptors_impl_javaee
testCompile libraries.jboss_ejb_spec_jar
testCompile libraries.jboss_annotation_spec_jar
// todo: enable again when we can finally use the Jakarta JARs from narayana
// testCompile( project(':hibernate-testing-jakarta') )
// testCompile fileTree(dir: 'libs', include: '*.jar')
//
// testCompile( libraries.shrinkwrap_api )
// testCompile( libraries.shrinkwrap )
// testCompile( libraries.jakarta_jacc )
// testCompile( libraries.jakarta_validation )
// testCompile( libraries.jandex )
// testCompile( libraries.classmate )
// testCompile( libraries.mockito )
// testCompile( libraries.mockito_inline )
// testCompile( libraries.jodaTime )
// testCompile( libraries.assertj )
//
// testCompile( libraries.jakarta_cdi )
//
// testCompile( libraries.jakarta_validator ) {
// // for test runtime
// transitive = true
// }
//
// // for testing stored procedure support
// testCompile( libraries.derby )
//
// testRuntime( "org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:1.0.0.Final" )
// testRuntime( libraries.jakarta_el )
// testRuntime( 'jaxen:jaxen:1.1' )
// testRuntime( libraries.javassist )
// testRuntime( libraries.byteBuddy )
// testRuntime( libraries.jakarta_weld )
// testRuntime( libraries.atomikos )
// testRuntime( libraries.atomikos_jta )
//// todo (jakarta): replace this when the jakarta artifact is released
// testRuntime( project(':hibernate-transaction-client') )
//// testRuntime( libraries.wildfly_transaction_client_jakarta )
//
// testCompile libraries.shrinkwrap_descriptors_api_javaee
// testCompile libraries.shrinkwrap_descriptors_impl_javaee
//
// testCompile libraries.jboss_ejb_spec_jar
// testCompile libraries.jboss_annotation_spec_jar
}
jar {
@ -132,51 +134,52 @@ jar {
}
}
task unpackTestJar(type: Copy) {
dependsOn jar
fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each {
def outputDir = file("${buildDir}/unpacked/" + it.name)
from zipTree(it)
into outputDir
}
}
task copyBundleResources (type: Copy) {
dependsOn unpackTestJar
File unpackedDir = new File(project.buildDir, "libs/hibernate-core-jakarta-${project.version}-test.jar")
ext {
bundlesTargetDir = file( "${buildDir}/bundles" )
bundleTokens = dbBundle[db]
ext.bundleTokens['buildDirName'] = buildDir.absolutePath
}
from file("${buildDir}/unpacked/${unpackedDir.name}/templates")
into ext.bundlesTargetDir
filter( ReplaceTokens, tokens: ext.bundleTokens)
doFirst {
ext.bundlesTargetDir.mkdirs()
}
}
processTestResources.dependsOn copyBundleResources
artifacts {
tests new File(project.buildDir, "libs/hibernate-core-jakarta-${project.version}-test.jar")
}
test {
fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each {
def outputDir = file("${buildDir}/unpacked/" + it.name)
testClassesDirs += files(outputDir)
classpath += files(outputDir)
}
systemProperty 'file.encoding', 'utf-8'
if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) {
// See org.hibernate.boot.model.naming.NamingHelperTest.DefaultCharset.set
jvmArgs( ['--add-opens', 'java.base/java.nio.charset=ALL-UNNAMED'] )
// Weld needs this to generate proxies
jvmArgs( ['--add-opens', 'java.base/java.security=ALL-UNNAMED'] )
jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
}
}
// todo: enable again when we can finally use the Jakarta JARs from narayana
//task unpackTestJar(type: Copy) {
// dependsOn jar
// fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each {
// def outputDir = file("${buildDir}/unpacked/" + it.name)
// from zipTree(it)
// into outputDir
// }
//}
//
//task copyBundleResources (type: Copy) {
// dependsOn unpackTestJar
// File unpackedDir = new File(project.buildDir, "libs/hibernate-core-jakarta-${project.version}-test.jar")
// ext {
// bundlesTargetDir = file( "${buildDir}/bundles" )
// bundleTokens = dbBundle[db]
// ext.bundleTokens['buildDirName'] = buildDir.absolutePath
// }
//
// from file("${buildDir}/unpacked/${unpackedDir.name}/templates")
// into ext.bundlesTargetDir
// filter( ReplaceTokens, tokens: ext.bundleTokens)
// doFirst {
// ext.bundlesTargetDir.mkdirs()
// }
//}
//
//processTestResources.dependsOn copyBundleResources
//
//artifacts {
// tests new File(project.buildDir, "libs/hibernate-core-jakarta-${project.version}-test.jar")
//}
//
//test {
// fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each {
// def outputDir = file("${buildDir}/unpacked/" + it.name)
// testClassesDirs += files(outputDir)
// classpath += files(outputDir)
// }
// systemProperty 'file.encoding', 'utf-8'
//
// if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) {
// // See org.hibernate.boot.model.naming.NamingHelperTest.DefaultCharset.set
// jvmArgs( ['--add-opens', 'java.base/java.nio.charset=ALL-UNNAMED'] )
// // Weld needs this to generate proxies
// jvmArgs( ['--add-opens', 'java.base/java.security=ALL-UNNAMED'] )
// jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
// }
//}

View File

@ -28,9 +28,10 @@ dependencies {
'org.eclipse.transformer:org.eclipse.transformer:0.2.0',
'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0'
testCompile( project( ':hibernate-testing-jakarta' ) )
testCompile( project( ':hibernate-envers-jakarta' ) )
testCompile( project( path: ':hibernate-core-jakarta', configuration: 'tests' ) )
// todo: enable again when we can finally use the Jakarta JARs from narayana
// testCompile( project( ':hibernate-testing-jakarta' ) )
// testCompile( project( path: ':hibernate-core-jakarta', configuration: 'tests' ) )
}
jar {
@ -75,29 +76,30 @@ jar {
}
}
task unpackTestJar(type: Copy) {
dependsOn jar
fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each {
def outputDir = file("${buildDir}/unpacked/" + it.name)
from zipTree(it)
into outputDir
}
}
test {
dependsOn unpackTestJar
fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each {
def outputDir = file("${buildDir}/unpacked/" + it.name)
testClassesDirs += files(outputDir)
classpath += files(outputDir)
}
systemProperty 'file.encoding', 'utf-8'
if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) {
// See org.hibernate.boot.model.naming.NamingHelperTest.DefaultCharset.set
jvmArgs( ['--add-opens', 'java.base/java.nio.charset=ALL-UNNAMED'] )
// Weld needs this to generate proxies
jvmArgs( ['--add-opens', 'java.base/java.security=ALL-UNNAMED'] )
jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
}
}
// todo: enable again when we can finally use the Jakarta JARs from narayana
//task unpackTestJar(type: Copy) {
// dependsOn jar
// fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each {
// def outputDir = file("${buildDir}/unpacked/" + it.name)
// from zipTree(it)
// into outputDir
// }
//}
//
//test {
// dependsOn unpackTestJar
// fileTree(project.buildDir).matching { include 'libs/*-test.jar' }.each {
// def outputDir = file("${buildDir}/unpacked/" + it.name)
// testClassesDirs += files(outputDir)
// classpath += files(outputDir)
// }
// systemProperty 'file.encoding', 'utf-8'
//
// if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) {
// // See org.hibernate.boot.model.naming.NamingHelperTest.DefaultCharset.set
// jvmArgs( ['--add-opens', 'java.base/java.nio.charset=ALL-UNNAMED'] )
// // Weld needs this to generate proxies
// jvmArgs( ['--add-opens', 'java.base/java.security=ALL-UNNAMED'] )
// jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
// }
//}

View File

@ -7,7 +7,13 @@
description = 'JBoss JTA transformed to be JTA 2.0 compatible'
apply from: rootProject.file( 'gradle/java-module.gradle' )
apply from: rootProject.file( 'gradle/published-java-module.gradle' )
tasks.withType(PublishToMavenRepository) {
onlyIf {
repository == publishing.repositories.mavenLocal
}
}
configurations {
jakartaeeTransformJars
@ -16,7 +22,7 @@ configurations {
dependencies {
compile( libraries.jakarta_jta )
compile( libraries.jakarta_resource )
compile( project(':hibernate-transaction-spi') )
compile( libraries.jboss_tx_spi_jakarta )
jakartaeeTransformJars 'biz.aQute.bnd:biz.aQute.bnd.transform:5.1.1',
'commons-cli:commons-cli:1.4',

View File

@ -7,9 +7,13 @@
description = 'Support for testing Hibernate ORM Jakarta functionality'
// todo (jakarta): replace this when the jakarta artifact is released
apply from: rootProject.file( 'gradle/java-module.gradle' )
//apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/published-java-module.gradle' )
tasks.withType(PublishToMavenRepository) {
onlyIf {
repository == publishing.repositories.mavenLocal
}
}
configurations {
jakartaeeTransformJars
@ -26,9 +30,9 @@ dependencies {
compile( libraries.log4j )
// todo (jakarta): replace this when the jakarta artifacts are released
compile project( ':hibernate-jboss-jta' )
// compile( libraries.jboss_tx_spi_jakarta ) {
// transitive=false;
// }
compile( libraries.jboss_tx_spi_jakarta ) {
transitive=false;
}
// compile ( libraries.jboss_jta_jakarta ) {
// transitive=false;
// }

View File

@ -7,7 +7,13 @@
description = 'Wildfly Transaction Client transformed to be JTA 2.0 compatible'
apply from: rootProject.file( 'gradle/java-module.gradle' )
apply from: rootProject.file( 'gradle/published-java-module.gradle' )
tasks.withType(PublishToMavenRepository) {
onlyIf {
repository == publishing.repositories.mavenLocal
}
}
configurations {
jakartaeeTransformJars

View File

@ -1,62 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
description = 'Wildfly Transaction SPI transformed to be JTA 2.0 compatible'
apply from: rootProject.file( 'gradle/java-module.gradle' )
configurations {
jakartaeeTransformJars
}
dependencies {
compile( libraries.jakarta_jta )
jakartaeeTransformJars 'biz.aQute.bnd:biz.aQute.bnd.transform:5.1.1',
'commons-cli:commons-cli:1.4',
'org.slf4j:slf4j-simple:1.7.30',
'org.slf4j:slf4j-api:1.7.26',
'org.eclipse.transformer:org.eclipse.transformer:0.2.0',
'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0'
testCompile ( libraries.jboss_tx_spi ) {
transitive=false;
}
}
jar {
def sourceJarPath = project.configurations.testCompile.find { it.name.startsWith("jboss-transaction-spi-") }
inputs.files(sourceJarPath).skipWhenEmpty()
outputs.dir project.buildDir
doLast {
new File(project.buildDir, "libs").mkdirs()
fileTree(project.buildDir).matching { include 'libs/*.jar' }.each { delete it }
println 'Initial bundle jar name [ ' + sourceJarPath + ' ]'
def finalBundleJarName = project.buildDir.path + '/libs/hibernate-transaction-spi-' + project.version + ".jar"
println 'Default jakarta final bundle jar name [ ' + finalBundleJarName + ' ]'
def transformerArgs = [
sourceJarPath, finalBundleJarName,
'-q', // quiet output
'-tr', new File(getProjectDir().getParentFile(), 'rules/jakarta-renames.properties').path,
'-tv', new File(getProjectDir().getParentFile(), 'rules/jakarta-versions.properties').path,
'-td', new File(getProjectDir().getParentFile(), 'rules/jakarta-direct.properties').path,
]
println 'Transformer options:'
transformerArgs.each {
println ' [ ' + it + ' ]'
}
javaexec {
classpath configurations.jakartaeeTransformJars
main = 'org.eclipse.transformer.jakarta.JakartaTransformer'
args = transformerArgs
}
}
}

View File

@ -90,11 +90,11 @@ include 'hibernate-core'
include 'hibernate-core-jakarta'
include 'hibernate-entitymanager'
include 'hibernate-testing'
include 'hibernate-testing-jakarta'
// todo: enable again when we can finally use the Jakarta JARs from narayana
//include 'hibernate-testing-jakarta'
// todo (jakarta): remove these three when the jakarta artifacts are released
include 'hibernate-jboss-jta'
include 'hibernate-transaction-client'
include 'hibernate-transaction-spi'
//include 'hibernate-jboss-jta'
//include 'hibernate-transaction-client'
include 'hibernate-envers'
include 'hibernate-envers-jakarta'