Skip to content

Commit 8704b5d

Browse files
barchettatomas-langerromain-grecourt
authored
Add test-native-image.sh (helidon-io#3386)
* Add test-native-image.sh * Add test-native-image.sh to Jenkinsfile * Add agent to test-native-image * Use parallel instead of stages, fix GRAALVM_HOME export * go back to stages for now * Properly export GRAALVM_HOME * squashable Signed-off-by: Tomas Langer <tomas.langer@oracle.com> * squashable Signed-off-by: Tomas Langer <tomas.langer@oracle.com> * Test other packaging Signed-off-by: Tomas Langer <tomas.langer@oracle.com> * Removed mp-2 native build. Moved native as last test, to validate jar and jlink. Signed-off-by: Tomas Langer <tomas.langer@oracle.com> * Added -e to see stacktrace. Signed-off-by: Tomas Langer <tomas.langer@oracle.com> * Uptake latest build-tools Note that it's using the staging profile to pull build-tools 2.3.0 from the staging repository, this is only for testing and should be removed before merging. * fix staging profile Add the staging profile in pipeline-env.sh * fix bad version for jpa-api * remove staging profile Co-authored-by: Tomas Langer <tomas.langer@oracle.com> Co-authored-by: Romain Grecourt <romain.grecourt@oracle.com>
1 parent 85a4ee6 commit 8704b5d

7 files changed

Lines changed: 249 additions & 7 deletions

File tree

Jenkinsfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,30 @@ pipeline {
6565
junit testResults: '**/target/surefire-reports/*.xml'
6666
}
6767
}
68+
stage('test-packaging-jar'){
69+
agent {
70+
label "linux"
71+
}
72+
steps {
73+
sh 'etc/scripts/test-packaging-jar.sh'
74+
}
75+
}
76+
stage('test-packaging-jlink'){
77+
agent {
78+
label "linux"
79+
}
80+
steps {
81+
sh 'etc/scripts/test-packaging-jlink.sh'
82+
}
83+
}
84+
stage('test-packaging-native'){
85+
agent {
86+
label "linux"
87+
}
88+
steps {
89+
sh 'etc/scripts/test-packaging-native.sh'
90+
}
91+
}
6892
}
6993
}
7094
}

dependencies/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<version.lib.jandex>2.3.1.Final</version.lib.jandex>
7474
<version.lib.jaxb-api>2.3.3</version.lib.jaxb-api>
7575
<version.lib.jaxb-core>2.3.0.1</version.lib.jaxb-core>
76-
<version.lib.jaxb-impl>2.3.2</version.lib.jaxb-impl>
76+
<version.lib.jaxb-impl>2.3.5</version.lib.jaxb-impl>
7777
<version.lib.jaxrs-api>2.1.6</version.lib.jaxrs-api>
7878
<version.lib.jboss.classfilewriter>1.2.5.Final</version.lib.jboss.classfilewriter>
7979
<version.lib.jboss.logging>3.2.1.Final</version.lib.jboss.logging>

etc/scripts/includes/pipeline-env.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ if [ -z "${__PIPELINE_ENV_INCLUDED__}" ]; then
4646

4747
. ${WS_DIR}/etc/scripts/includes/error_handlers.sh
4848

49+
if [ -z "${GRAALVM_HOME}" ]; then
50+
export GRAALVM_HOME="/tools/graalvm-ce-java11-21.1.0"
51+
fi
52+
4953
require_env() {
5054
if [ -z "$(eval echo \$${1})" ] ; then
5155
echo "ERROR: ${1} not set in the environment"
@@ -57,7 +61,7 @@ if [ -z "${__PIPELINE_ENV_INCLUDED__}" ]; then
5761
# Modified shell variables: JAVA_HOME - JDK home directory
5862
# PATH - executables search path
5963
graalvm() {
60-
JAVA_HOME='/tools/graalvm-ce-java11-21.1.0'
64+
JAVA_HOME=${GRAALVM_HOME}
6165
PATH="${PATH}:${JAVA_HOME}/bin"
6266
}
6367

etc/scripts/test-packaging-jar.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash -ex
2+
#
3+
# Copyright (c) 2021 Oracle and/or its affiliates.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# 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, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# Path to this script
19+
[ -h "${0}" ] && readonly SCRIPT_PATH="$(readlink "${0}")" || readonly SCRIPT_PATH="${0}"
20+
21+
# Load pipeline environment setup and define WS_DIR
22+
. $(dirname -- "${SCRIPT_PATH}")/includes/pipeline-env.sh "${SCRIPT_PATH}" '../..'
23+
24+
# Setup error handling using default settings (defined in includes/error_handlers.sh)
25+
error_trap_setup
26+
27+
mvn ${MAVEN_ARGS} --version
28+
29+
# Temporary workaround until job stages will share maven repository
30+
mvn ${MAVEN_ARGS} -f ${WS_DIR}/pom.xml \
31+
install -e \
32+
-Dmaven.test.skip=true \
33+
-DskipTests \
34+
-Ppipeline
35+
36+
# Run native image tests
37+
cd ${WS_DIR}/tests/integration/native-image
38+
39+
# Prime build all native-image tests
40+
mvn ${MAVEN_ARGS} -e clean install
41+
42+
# Run tests with classpath and then module path
43+
44+
#
45+
# Run SE-1 (does not contain module-info.java)
46+
#
47+
cd ${WS_DIR}/tests/integration/native-image/se-1
48+
# Classpath
49+
java -Dexit.on.started=! -jar target/helidon-tests-native-image-se-1.jar
50+
51+
#
52+
# Run MP-1
53+
#
54+
cd ${WS_DIR}/tests/integration/native-image/mp-1
55+
# Classpath
56+
java -jar target/helidon-tests-native-image-mp-1.jar
57+
# Module Path
58+
java --module-path target/helidon-tests-native-image-mp-1.jar:target/libs \
59+
--module helidon.tests.nimage.mp/io.helidon.tests.integration.nativeimage.mp1.Mp1Main
60+
61+
#
62+
# Run MP-3 (just start and stop)
63+
#
64+
cd ${WS_DIR}/tests/integration/native-image/mp-3
65+
# Classpath
66+
java -Dexit.on.started=! -jar target/helidon-tests-native-image-mp-3.jar
67+
68+
# Module Path
69+
java -Dexit.on.started=! \
70+
--module-path target/helidon-tests-native-image-mp-3.jar:target/libs \
71+
--add-modules helidon.tests.nimage.quickstartmp \
72+
--module io.helidon.microprofile.cdi/io.helidon.microprofile.cdi.Main
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/bin/bash -ex
2+
#
3+
# Copyright (c) 2021 Oracle and/or its affiliates.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# 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, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# Path to this script
19+
[ -h "${0}" ] && readonly SCRIPT_PATH="$(readlink "${0}")" || readonly SCRIPT_PATH="${0}"
20+
21+
# Load pipeline environment setup and define WS_DIR
22+
. $(dirname -- "${SCRIPT_PATH}")/includes/pipeline-env.sh "${SCRIPT_PATH}" '../..'
23+
24+
# Setup error handling using default settings (defined in includes/error_handlers.sh)
25+
error_trap_setup
26+
27+
mvn ${MAVEN_ARGS} --version
28+
29+
# Temporary workaround until job stages will share maven repository
30+
mvn ${MAVEN_ARGS} -f ${WS_DIR}/pom.xml \
31+
install -e \
32+
-Dmaven.test.skip=true \
33+
-DskipTests \
34+
-Ppipeline
35+
36+
# Run native image tests
37+
cd ${WS_DIR}/tests/integration/native-image
38+
39+
# Prime build all native-image tests
40+
mvn ${MAVEN_ARGS} -e clean install
41+
42+
# Build jlink images
43+
# mp-2 fails because of https://github.com/oracle/helidon-build-tools/issues/478
44+
readonly native_image_tests="se-1 mp-1 mp-3"
45+
for native_test in ${native_image_tests}; do
46+
cd ${WS_DIR}/tests/integration/native-image/${native_test}
47+
mvn ${MAVEN_ARGS} package -e -Pjlink-image,staging -Djlink.image.addClassDataSharingArchive=false -Djlink.image.testImage=false
48+
done
49+
50+
# Run tests with classpath and then module path
51+
52+
# Run SE-1 (does not contain module-info.java)
53+
cd ${WS_DIR}/tests/integration/native-image/se-1
54+
jri_dir=${WS_DIR}/tests/integration/native-image/se-1/target/helidon-tests-native-image-se-1-jri
55+
56+
# Classpath
57+
${jri_dir}/bin/start --test
58+
59+
# Run MP-1
60+
cd ${WS_DIR}/tests/integration/native-image/mp-1
61+
jri_dir=${WS_DIR}/tests/integration/native-image/mp-1/target/helidon-tests-native-image-mp-1-jri
62+
63+
# Classpath
64+
${jri_dir}/bin/start
65+
66+
# Module Path
67+
${jri_dir}/bin/java \
68+
--module-path ${jri_dir}/app/helidon-tests-native-image-mp-1.jar:${jri_dir}/app/libs \
69+
--module helidon.tests.nimage.mp/io.helidon.tests.integration.nativeimage.mp1.Mp1Main
70+
71+
# Run MP-3 (just start and stop)
72+
cd ${WS_DIR}/tests/integration/native-image/mp-3
73+
jri_dir=${WS_DIR}/tests/integration/native-image/mp-3/target/helidon-tests-native-image-mp-3-jri
74+
75+
# Classpath
76+
${jri_dir}/bin/start --test
77+
78+
# Module Path
79+
${jri_dir}/bin/java -Dexit.on.started=! \
80+
--module-path ${jri_dir}/app/helidon-tests-native-image-mp-3.jar:${jri_dir}/app/libs \
81+
--add-modules helidon.tests.nimage.quickstartmp \
82+
--module io.helidon.microprofile.cdi/io.helidon.microprofile.cdi.Main
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash -ex
2+
#
3+
# Copyright (c) 2021 Oracle and/or its affiliates.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# 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, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# Path to this script
19+
[ -h "${0}" ] && readonly SCRIPT_PATH="$(readlink "${0}")" || readonly SCRIPT_PATH="${0}"
20+
21+
# Load pipeline environment setup and define WS_DIR
22+
. $(dirname -- "${SCRIPT_PATH}")/includes/pipeline-env.sh "${SCRIPT_PATH}" '../..'
23+
24+
# Setup error handling using default settings (defined in includes/error_handlers.sh)
25+
error_trap_setup
26+
27+
if [ -z "${GRAALVM_HOME}" ]; then
28+
echo "ERROR: GRAALVM_HOME is not set";
29+
exit 1
30+
fi
31+
32+
if [ ! -x "${GRAALVM_HOME}/bin/native-image" ]; then
33+
echo "ERROR: ${GRAALVM_HOME}/bin/native-image does not exist or is not executable";
34+
exit 1
35+
fi
36+
37+
mvn ${MAVEN_ARGS} --version
38+
echo "GRAALVM_HOME=${GRAALVM_HOME}";
39+
${GRAALVM_HOME}/bin/native-image --version;
40+
41+
# Temporary workaround until job stages will share maven repository
42+
mvn ${MAVEN_ARGS} -f ${WS_DIR}/pom.xml \
43+
install -e \
44+
-Dmaven.test.skip=true \
45+
-DskipTests \
46+
-Ppipeline
47+
48+
# Run native image tests
49+
cd ${WS_DIR}/tests/integration/native-image
50+
51+
# Prime build all native-image tests
52+
mvn ${MAVEN_ARGS} -e clean install
53+
54+
# Build native images
55+
# mp-2 is too big, waiting for more memory
56+
readonly native_image_tests="se-1 mp-1 mp-3"
57+
for native_test in ${native_image_tests}; do
58+
cd ${WS_DIR}/tests/integration/native-image/${native_test}
59+
mvn ${MAVEN_ARGS} -e clean package -Pnative-image
60+
done
61+
62+
# Run this one because it has no pre-reqs and self-tests
63+
# Uses relative path to read configuration
64+
cd ${WS_DIR}/tests/integration/native-image/mp-1
65+
${WS_DIR}/tests/integration/native-image/mp-1/target/helidon-tests-native-image-mp-1

integrations/cdi/jpa-cdi/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,6 @@
404404
<artifactId>jakarta.activation-api</artifactId>
405405
<scope>compile</scope>
406406
</dependency>
407-
<dependency>
408-
<groupId>com.sun.xml.bind</groupId>
409-
<artifactId>jaxb-core</artifactId>
410-
<scope>runtime</scope>
411-
</dependency>
412407
<dependency>
413408
<groupId>com.sun.xml.bind</groupId>
414409
<artifactId>jaxb-impl</artifactId>

0 commit comments

Comments
 (0)