Skip to content

Commit e02ec4e

Browse files
committed
ARROW-5466: [Java][CI] Dockerize Java CI, run all JDK builds in single Travis entry
Since OpenJDK9 has been superseded by OpenJDK11, it is not available in package repositories, so I'm not sure it's worth maintaining a build for this. I have pushed a pre-built Docker image for this to https://cloud.docker.com/u/ursalab/repository/docker/ursalab/arrow-ci-java-all-jdks Author: Wes McKinney <wesm+git@apache.org> Closes #4761 from wesm/java-dockerify and squashes the following commits: 8b81037 <Wes McKinney> Actually run Java unit tests cf568a2 <Wes McKinney> Code review feedback 6cb5e3f <Wes McKinney> Build Javadoc in docker-compose job d9c3900 <Wes McKinney> Run all Java builds in a single Dockerized Travis CI entry
1 parent 7adbe93 commit e02ec4e

File tree

5 files changed

+75
-31
lines changed

5 files changed

+75
-31
lines changed

.travis.yml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -199,32 +199,14 @@ matrix:
199199
- if [ $ARROW_CI_PYTHON_AFFECTED == "1" ]; then docker-compose pull python-manylinux1; fi
200200
script:
201201
- if [ $ARROW_CI_PYTHON_AFFECTED == "1" ]; then $TRAVIS_BUILD_DIR/ci/travis_script_manylinux.sh; fi
202-
- name: "Java w/ OpenJDK 8"
203-
language: java
204-
os: linux
205-
jdk: openjdk8
206-
before_script:
207-
- if [ $ARROW_CI_JAVA_AFFECTED != "1" ]; then exit; fi
208-
- $TRAVIS_BUILD_DIR/ci/travis_install_linux.sh
209-
script:
210-
- $TRAVIS_BUILD_DIR/ci/travis_script_java.sh
211-
- $TRAVIS_BUILD_DIR/ci/travis_script_javadoc.sh
212-
- name: "Java w/ OpenJDK 9"
213-
language: java
214-
os: linux
215-
jdk: openjdk9
216-
before_script:
217-
- if [ $ARROW_CI_JAVA_AFFECTED != "1" ]; then exit; fi
218-
script:
219-
- $TRAVIS_BUILD_DIR/ci/travis_script_java.sh
220-
- name: "Java w/ OpenJDK 11"
221-
language: java
202+
- name: "Java OpenJDK8 and OpenJDK11"
203+
language: cpp
222204
os: linux
223-
jdk: openjdk11
224205
before_script:
225206
- if [ $ARROW_CI_JAVA_AFFECTED != "1" ]; then exit; fi
207+
- docker-compose pull java-all-jdks
226208
script:
227-
- $TRAVIS_BUILD_DIR/ci/travis_script_java.sh
209+
- docker-compose run java-all-jdks
228210
- name: "Integration w/ OpenJDK 8, conda-forge toolchain"
229211
language: java
230212
os: linux

ci/docker_build_java.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,23 @@ mkdir -p /build/java
2525

2626
arrow_src=/build/java/arrow
2727

28+
# Remove any pre-existing artifacts
29+
rm -rf $arrow_src
30+
2831
pushd /arrow
29-
rsync -a header java format integration $arrow_src
32+
rsync -a header java format integration $arrow_src
3033
popd
3134

35+
JAVA_ARGS=
36+
if [ "$ARROW_JAVA_RUN_TESTS" != "1" ]; then
37+
JAVA_ARGS=-DskipTests
38+
fi
39+
3240
pushd $arrow_src/java
33-
mvn -B -DskipTests -Drat.skip=true install
41+
mvn -B $JAVA_ARGS -Drat.skip=true install
42+
43+
if [ "$ARROW_JAVADOC" == "1" ]; then
44+
export MAVEN_OPTS="$MAVEN_OPTS -Dorg.slf4j.simpleLogger.defaultLogLevel=warn"
45+
mvn -B site
46+
fi
3447
popd

ci/travis_script_javadoc.sh renamed to ci/docker_java_test_all.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env bash
2-
32
# Licensed to the Apache Software Foundation (ASF) under one
43
# or more contributor license agreements. See the NOTICE file
54
# distributed with this work for additional information
@@ -19,13 +18,16 @@
1918

2019
set -e
2120

22-
source $TRAVIS_BUILD_DIR/ci/travis_env_common.sh
21+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2322

24-
JAVA_DIR=${TRAVIS_BUILD_DIR}/java
23+
export ARROW_TEST_DATA=/arrow/testing/data
2524

26-
pushd $JAVA_DIR
25+
export ARROW_JAVA_RUN_TESTS=1
2726

28-
export MAVEN_OPTS="$MAVEN_OPTS -Dorg.slf4j.simpleLogger.defaultLogLevel=warn"
29-
$TRAVIS_MVN -B site
27+
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
28+
export ARROW_JAVADOC=1
29+
bash $SOURCE_DIR/docker_build_java.sh
3030

31-
popd
31+
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
32+
export ARROW_JAVADOC=0
33+
bash $SOURCE_DIR/docker_build_java.sh

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,18 @@ services:
292292
- .:/arrow:ro # ensures that docker won't contaminate the host directory
293293
- maven-cache:/root/.m2:delegated
294294

295+
java-all-jdks:
296+
# Usage:
297+
# docker-compose build java-all-jdks
298+
# docker-compose run java-all-jdks
299+
image: ursalab/arrow-ci-java-all-jdks:latest
300+
build:
301+
context: .
302+
dockerfile: java/Dockerfile.all-jdks
303+
volumes:
304+
- .:/arrow:ro # ensures that docker won't contaminate the host directory
305+
- maven-cache:/root/.m2:delegated
306+
295307
js:
296308
image: arrow:js
297309
build:

java/Dockerfile.all-jdks

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
18+
FROM ubuntu:18.04
19+
20+
# install build essentials
21+
RUN export DEBIAN_FRONTEND=noninteractive && \
22+
apt-get update -y -q && \
23+
apt-get install -y -q --no-install-recommends \
24+
wget \
25+
software-properties-common \
26+
ca-certificates \
27+
maven \
28+
rsync \
29+
tzdata \
30+
openjdk-8-jdk \
31+
openjdk-11-jdk && \
32+
apt-get clean && rm -rf /var/lib/apt/lists/*
33+
34+
# Test all supported JDKs
35+
CMD ["arrow/ci/docker_java_test_all.sh"]

0 commit comments

Comments
 (0)