Skip to content

Commit

Permalink
[Java] Deploy snapshort jars to maven repository in travis ci (ray-pr…
Browse files Browse the repository at this point in the history
  • Loading branch information
chaokunyang authored Sep 10, 2020
1 parent 504da45 commit bf71c0b
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 18 deletions.
25 changes: 19 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ matrix:
- . ./ci/travis/ci.sh test_wheels
- bash ./java/build-jar-multiplatform.sh darwin

# Build Linux wheels and multi-platform jars.
# Build Linux wheels and jars.
- os: linux
env:
- LINUX_WHEELS=1 MULTIPLATFORM_JARS=1
- LINUX_WHEELS=1 LINUX_JARS=1
- PYTHONWARNINGS=ignore
- RAY_INSTALL_JAVA=1
install:
Expand All @@ -190,8 +190,21 @@ matrix:
- . ./ci/travis/ci.sh test_wheels
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then . $TRAVIS_BUILD_DIR/ci/travis/build-docker-images.sh; fi
- bash ./java/build-jar-multiplatform.sh linux
#- bash ./java/build-jar-multiplatform.sh multiplatform
#- bash ./java/build-jar-multiplatform.sh deploy
cache: false

# Build and deploy multi-platform jars.
- os: linux
env:
- MULTIPLATFORM_JARS=1
- PYTHONWARNINGS=ignore
- RAY_INSTALL_JAVA=1
- secure: "Un2SGOCdD/RiqbO47vtkwn5dPbGbwHi/TKunyNJLKcGILwJc0sZL9uf8pkffyYGbt7ejnYwV9tPgoAlFxcuJYgbmkt84AxDF8oskJmFKYjkxOtEFkqskhTb0u9/usjq23OXrmGN4NqvzLEdbf7Z3wyMxXpzgDKPUgDAFUfB2Ya8OapXuPdt/5KDlDBS0Bj9sKqI+0keYovfRY8dO2/Vd0Ojqkmz1PWHTQP0TrC1X+juciDdoRnU1rO8mxhQW4HKICexwAr1rsAqALpuDlfyhG7I+aicVjK3uiQuviGJOoI813f00YlTOAoXW2YPpblExp0uoTQN2zaYvpp1zUx7V/rVaAoXmFI7ELQ+nr8oAJbImWe1bCNO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
- bash ./java/build-jar-multiplatform.sh multiplatform
- bash ./java/build-jar-multiplatform.sh deploy
cache: false

# RLlib: Learning tests (from rllib/tuned_examples/*.yaml).
Expand Down Expand Up @@ -486,7 +499,7 @@ deploy:
on:
repo: ray-project/ray
all_branches: true
condition: $MULTIPLATFORM_JARS = 1 || $MAC_JARS = 1
condition: $MULTIPLATFORM_JARS = 1 || $MAC_JARS = 1 || $LINUX_JARS = 1

- provider: s3
edge: true # This supposedly opts in to deploy v2.
Expand All @@ -502,5 +515,5 @@ deploy:
on:
repo: ray-project/ray
branch: master
condition: $MULTIPLATFORM_JARS = 1 || $MAC_JARS = 1
condition: $MULTIPLATFORM_JARS = 1 || $MAC_JARS = 1 || $LINUX_JARS = 1

51 changes: 51 additions & 0 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,57 @@ For example, here are the Ray 0.9.0.dev0 wheels for Python 3.5, MacOS for commit
pip install https://ray-wheels.s3-us-west-2.amazonaws.com/master/a0ba4499ac645c9d3e82e68f3a281e48ad57f873/ray-0.9.0.dev0-cp35-cp35m-macosx_10_13_intel.whl
Install Ray With Maven
----------------------

The latest Ray Java release can be found in `central repository <https://mvnrepository.com/artifact/io.ray>`__. To use the latest Ray Java release in your application, add the following entries in your ``pom.xml``:

.. code-block:: xml
<dependency>
<groupId>io.ray</groupId>
<artifactId>ray-api</artifactId>
<version>${ray.version}</version>
</dependency>
<dependency>
<groupId>io.ray</groupId>
<artifactId>ray-runtime</artifactId>
<version>${ray.version}</version>
</dependency>
The latest Ray Java snapshot can be found in `sonatype repository <https://oss.sonatype.org/#nexus-search;quick~io.ray>`__. To use the latest Ray Java snapshot in your application, add the following entries in your ``pom.xml``:

.. code-block:: xml
<!-- only needed for snapshot version of ray -->
<repositories>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.ray</groupId>
<artifactId>ray-api</artifactId>
<version>${ray.version}</version>
</dependency>
<dependency>
<groupId>io.ray</groupId>
<artifactId>ray-runtime</artifactId>
<version>${ray.version}</version>
</dependency>
</dependencies>
.. _windows-support:

Windows Support
Expand Down
2 changes: 1 addition & 1 deletion doc/source/walkthrough.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Installation

.. group-tab:: Java

To run this walkthrough, add `Ray API <https://mvnrepository.com/artifact/io.ray/ray-api>`_ and `Ray Runtime <https://mvnrepository.com/artifact/io.ray/ray-runtime>`_ as dependencies. We don't publish snapshot versions right now.
To run this walkthrough, add `Ray API <https://mvnrepository.com/artifact/io.ray/ray-api>`_ and `Ray Runtime <https://mvnrepository.com/artifact/io.ray/ray-runtime>`_ as dependencies. Snapshot versions can be found in `sonatype repository <https://oss.sonatype.org/#nexus-search;quick~io.ray>`_.

Starting Ray
------------
Expand Down
50 changes: 39 additions & 11 deletions java/build-jar-multiplatform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ build_jars_multiplatform() {
return
fi
fi
download_jars "ray-runtime-$version.jar" "streaming-runtime-$version.jar"
prepare_native
build_jars multiplatform false
if download_jars "ray-runtime-$version.jar" "streaming-runtime-$version.jar"; then
prepare_native
build_jars multiplatform false
else
echo "download_jars failed, skip building multiplatform jars"
fi
}

# Download darwin/windows ray-related jar from s3
Expand All @@ -101,9 +104,9 @@ download_jars() {
echo "Waiting $url to be ready for $wait_time seconds..."
sleep $sleep_time_units
wait_time=$((wait_time + sleep_time_units))
if [[ wait_time == $((60 * 120)) ]]; then
if [[ wait_time == $((sleep_time_units * 100)) ]]; then
echo "Download $url timeout"
exit 1
return 1
fi
else
echo "Download $url to $dest_file succeed"
Expand Down Expand Up @@ -131,9 +134,27 @@ prepare_native() {
done
}

# Return 0 if native bianries and libraries exist and 1 if not.
native_files_exist() {
local os
for os in 'darwin' 'linux'; do
native_dirs=()
native_dirs+=("$WORKSPACE_DIR/java/runtime/native_dependencies/native/$os")
native_dirs+=("$WORKSPACE_DIR/streaming/java/streaming-runtime/native_dependencies/native/$os")
for native_dir in "${native_dirs[@]}"; do
if [ ! -d "$native_dir" ]; then
echo "$native_dir doesn't exist"
return 1
fi
done
done
}

# This function assume all multiplatform binaries are prepared already.
deploy_jars() {
if [ "${TRAVIS-}" = true ]; then
mkdir -p ~/.m2
echo "<settings><servers><server><id>ossrh</id><username>${OSSRH_KEY}</username><password>${OSSRH_TOKEN}</password></server></servers></settings>" > ~/.m2/settings.xml
if [[ "$TRAVIS_REPO_SLUG" != "ray-project/ray" ||
"$TRAVIS_PULL_REQUEST" != "false" || "$TRAVIS_BRANCH" != "master" ]]; then
echo "Skip deploying jars when this build is from a pull request or
Expand All @@ -142,11 +163,19 @@ deploy_jars() {
fi
fi
echo "Start deploying jars"
cd "$WORKSPACE_DIR/java"
mvn -T16 deploy -Dmaven.test.skip=true -Dcheckstyle.skip -Prelease
cd "$WORKSPACE_DIR/streaming/java"
mvn -T16 deploy -Dmaven.test.skip=true -Dcheckstyle.skip -Prelease
echo "Finished deploying jars"
if native_files_exist; then
(
cd "$WORKSPACE_DIR/java"
mvn -T16 deploy -Dmaven.test.skip=true -Dcheckstyle.skip -Prelease
)
(
cd "$WORKSPACE_DIR/streaming/java"
mvn -T16 deploy -Dmaven.test.skip=true -Dcheckstyle.skip -Prelease
)
echo "Finished deploying jars"
else
echo "Native bianries/libraries are not ready, skip deploying jars."
fi
}

case "$1" in
Expand All @@ -167,4 +196,3 @@ deploy) # Deploy jars to maven repository.
"$@"
;;
esac

0 comments on commit bf71c0b

Please sign in to comment.