From fbd9a342d641929029e21066615b189979fea8db Mon Sep 17 00:00:00 2001 From: Hyunsu Cho Date: Tue, 25 Jun 2024 14:39:09 -0700 Subject: [PATCH] [CI] Add CI pipeline to build libxgboost4j.so targeting Linux ARM64 --- tests/buildkite/build-jvm-linux-arm64.sh | 28 ++++++++++++++++++++++++ tests/buildkite/build-jvm-macos-m1.sh | 7 +++--- tests/buildkite/pipeline-mac-m1.yml | 2 +- tests/buildkite/pipeline.yml | 5 +++++ tests/ci_build/Dockerfile.aarch64 | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 tests/buildkite/build-jvm-linux-arm64.sh diff --git a/tests/buildkite/build-jvm-linux-arm64.sh b/tests/buildkite/build-jvm-linux-arm64.sh new file mode 100644 index 000000000000..6bad92e8df9c --- /dev/null +++ b/tests/buildkite/build-jvm-linux-arm64.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -euo pipefail + +source tests/buildkite/conftest.sh + +command_wrapper="tests/ci_build/ci_build.sh aarch64" + +# Build XGBoost4J binary +echo "--- Build libxgboost4j.so" +set -x +mkdir build +$command_wrapper bash -c \ + "cd build && cmake .. -GNinja -DJVM_BINDINGS=ON -DUSE_OPENMP=ON && ninja -v" +ldd lib/libxgboost4j.so + +echo "--- Upload libxgboost4j.dylib" +pushd lib +libname=libxgboost4j_linux_arm64_${BUILDKITE_COMMIT}.so +mv -v libxgboost4j.so ${libname} +buildkite-agent artifact upload ${libname} +#if [[ ($is_pull_request == 0) && ($is_release_branch == 1) ]] +#then + aws s3 cp ${libname} \ + s3://xgboost-nightly-builds/${BRANCH_NAME}/libxgboost4j/ \ + --acl public-read --no-progress +#fi +popd diff --git a/tests/buildkite/build-jvm-macos-m1.sh b/tests/buildkite/build-jvm-macos-m1.sh index b755ad323dc3..469b0786ee37 100644 --- a/tests/buildkite/build-jvm-macos-m1.sh +++ b/tests/buildkite/build-jvm-macos-m1.sh @@ -28,11 +28,12 @@ set +x echo "--- Upload libxgboost4j.dylib" set -x pushd lib -mv -v libxgboost4j.dylib libxgboost4j_m1_${BUILDKITE_COMMIT}.dylib -buildkite-agent artifact upload libxgboost4j_m1_${BUILDKITE_COMMIT}.dylib +libname=libxgboost4j_m1_${BUILDKITE_COMMIT}.dylib +mv -v libxgboost4j.dylib ${libname} +buildkite-agent artifact upload ${libname} #if [[ ($is_pull_request == 0) && ($is_release_branch == 1) ]] #then - aws s3 cp libxgboost4j_m1_${BUILDKITE_COMMIT}.dylib \ + aws s3 cp ${libname} \ s3://xgboost-nightly-builds/${BRANCH_NAME}/libxgboost4j/ \ --acl public-read --no-progress #fi diff --git a/tests/buildkite/pipeline-mac-m1.yml b/tests/buildkite/pipeline-mac-m1.yml index f48dad64b882..57b1b1d12010 100644 --- a/tests/buildkite/pipeline-mac-m1.yml +++ b/tests/buildkite/pipeline-mac-m1.yml @@ -1,7 +1,7 @@ steps: - block: ":rocket: Run this test job" if: build.pull_request.id != null || build.branch =~ /^dependabot\// - - label: ":macos: Build XGBoost4J for MacOS M1" + - label: ":macos: Build libxgboost4j.dylib for MacOS M1" command: "tests/buildkite/build-jvm-macos-m1.sh" key: mac-m1-jvm agents: diff --git a/tests/buildkite/pipeline.yml b/tests/buildkite/pipeline.yml index 73a60517a672..35f7c31caa6e 100644 --- a/tests/buildkite/pipeline.yml +++ b/tests/buildkite/pipeline.yml @@ -56,6 +56,11 @@ steps: key: build-jvm-packages agents: queue: linux-amd64-cpu + - label: ":console: Build libxgboost4j.so for Linux ARM64" + command: "tests/buildkite/build-jvm-linux-arm64.sh" + key: build-jvm-linux-arm64 + agents: + queue: linux-arm64-cpu - label: ":console: Build JVM package doc" command: "tests/buildkite/build-jvm-doc.sh" key: build-jvm-doc diff --git a/tests/ci_build/Dockerfile.aarch64 b/tests/ci_build/Dockerfile.aarch64 index 66d31cfd5d0e..91ee92147e04 100644 --- a/tests/ci_build/Dockerfile.aarch64 +++ b/tests/ci_build/Dockerfile.aarch64 @@ -7,7 +7,7 @@ RUN \ dnf -y update && \ dnf -y install dnf-plugins-core && \ dnf config-manager --set-enabled powertools && \ - dnf install -y tar unzip wget xz git which ninja-build gcc-toolset-10-gcc gcc-toolset-10-binutils gcc-toolset-10-gcc-c++ && \ + dnf install -y tar unzip wget xz git which ninja-build gcc-toolset-10-gcc gcc-toolset-10-binutils gcc-toolset-10-gcc-c++ java-1.8.0-openjdk-devel && \ # Python wget -nv -O conda.sh https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Miniforge3-24.3.0-0-Linux-aarch64.sh && \ bash conda.sh -b -p /opt/miniforge