Skip to content

Commit

Permalink
Add JVM deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Nov 20, 2024
1 parent e148e29 commit 2d6bd52
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/jvm_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ jobs:
run: bash ops/pipeline/build-test-jvm-packages.sh
env:
SCALA_VERSION: 2.13
- name: Stash files
run: bash ops/stash_artifacts.sh lib/libxgboost4j.so
env:
COMMAND: upload
KEY: build-test-jvm-packages

build-test-jvm-packages-other-os:
name: Build and test JVM packages (${{ matrix.os }})
Expand Down Expand Up @@ -239,3 +244,41 @@ jobs:
COMMAND: download
KEY: build-jvm-gpu
- run: bash ops/pipeline/test-jvm-gpu.sh

deploy-jvm-packages:
name: Deploy JVM packages to S3 (${{ matrix.variant }})
needs: [build-jvm-gpu, build-test-jvm-packages, test-jvm-packages-gpu]
runs-on:
- runs-on=${{ github.run_id }}
- runner=linux-amd64-cpu
strategy:
fail-fast: false
matrix:
include:
- variant: cpu
container_id: xgb-ci.jvm
artifact_from: build-test-jvm-packages
- variant: gpu
container_id: xgb-ci.jvm_gpu_build
artifact_from: build-jvm-gpu
steps:
# Restart Docker daemon so that it recognizes the ephemeral disks
- run: sudo systemctl restart docker
- uses: actions/[email protected]
with:
submodules: "true"
- name: Fetch container from cache
run: bash ops/docker_build.sh
env:
CONTAINER_ID: ${{ matrix.container_id }}
- name: Unstash files
run: |
bash ops/stash_artifacts.sh lib/libxgboost4j.so
ls -lh lib/libxgboost4j.so
env:
COMMAND: download
KEY: ${{ matrix.artifact_from }}
- name: Deploy JVM packages to S3
run: >-
bash ops/pipeline/deploy-jvm-packages.sh ${{ matrix.variant }}
${{ matrix.container_id }}
45 changes: 45 additions & 0 deletions ops/pipeline/deploy-jvm-packages-impl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
## Deploy JVM packages to xgboost-maven-repo S3 bucket

set -euox pipefail

if [[ "$#" -lt 1 ]]
then
echo "Usage: $0 {cpu,gpu}"
exit 1
fi

variant="$1"

maven_options="-DskipTests -Dmaven.test.skip=true -Dskip.native.build=true"
case "$variant" in
cpu)
# CPU variant
for scala_version in 2.12 2.13
do
python dev/change_scala_version.py --scala-version ${scala_version} --purge-artifacts
pushd jvm-packages
mvn --no-transfer-progress deploy -Pdefault,release-to-s3 ${maven_options}
mvn clean
mvn clean -Pdefault,release-to-s3
popd
done
;;
gpu)
# GPU variant
for scala_version in 2.12 2.13
do
python dev/change_scala_version.py --scala-version ${scala_version} --purge-artifacts
pushd jvm-packages
mvn --no-transfer-progress install -Pgpu ${maven_options}
mvn --no-transfer-progress deploy -Pgpu,release-to-s3 -pl xgboost4j-spark-gpu ${maven_options}
mvn clean
mvn clean -Pgpu,release-to-s3
popd
done
;;
*)
echo "Unrecognized argument: $variant"
exit 2
;;
esac
21 changes: 21 additions & 0 deletions ops/pipeline/deploy-jvm-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -euox pipefail

source ops/pipeline/enforce-ci.sh

if [[ "$#" -lt 2 ]]
then
echo "Usage: $0 {cpu,gpu} {container_id}"
exit 1
fi

variant="$1"
container_id="$2"

# if [[ ($is_pull_request == 0) && ($is_release_branch == 1) ]]
# then
echo "--- Deploy JVM packages to xgboost-maven-repo S3 repo"
python3 ops/docker_run.py --container-id "${container_id}" \
-- ops/pipeline/deploy-jvm-packages-impl.sh "${variant}"
# fi

0 comments on commit 2d6bd52

Please sign in to comment.