From fa275f1c007cf3cce60272367d7c952bc867570c Mon Sep 17 00:00:00 2001 From: Parth Chandra Date: Thu, 19 Sep 2024 12:24:08 -0700 Subject: [PATCH] feat: implement scripts for binary release build (#932) * feat: implement scripts for binary release build * Install to temp local maven repo and updates for MacOS * newline * Use independent docker images for different architectures instead of a multi-arch image * update docs and cleanup * remove unused code * fail build script on error * Build all profiles * remove duplicate target from makefile --------- Co-authored-by: Andy Grove --- Makefile | 16 ++ dev/release/README.md | 53 +++++ dev/release/build-release-comet.sh | 202 ++++++++++++++++++ dev/release/comet-rm/Dockerfile | 91 ++++++++ .../comet-rm/build-comet-native-libs.sh | 55 +++++ pom.xml | 5 + 6 files changed, 422 insertions(+) create mode 100755 dev/release/build-release-comet.sh create mode 100644 dev/release/comet-rm/Dockerfile create mode 100755 dev/release/comet-rm/build-comet-native-libs.sh diff --git a/Makefile b/Makefile index d4e2887f7..80f334a34 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,22 @@ format: ./mvnw compile test-compile scalafix:scalafix -Psemanticdb $(PROFILES) ./mvnw spotless:apply $(PROFILES) +# build native libs for amd64 architecture Linux/MacOS on a Linux/amd64 machine/container +core-amd64-libs: + cd native && cargo build -j 2 --release +ifdef HAS_OSXCROSS + rustup target add x86_64-apple-darwin + cd native && cargo build -j 2 --target x86_64-apple-darwin --release +endif + +# build native libs for arm64 architecture Linux/MacOS on a Linux/arm64 machine/container +core-arm64-libs: + cd native && cargo build -j 2 --release +ifdef HAS_OSXCROSS + rustup target add aarch64-apple-darwin + cd native && cargo build -j 2 --target aarch64-apple-darwin --release +endif + core-amd64: rustup target add x86_64-apple-darwin cd native && RUSTFLAGS="-Ctarget-cpu=skylake -Ctarget-feature=-prefer-256-bit" CC=o64-clang CXX=o64-clang++ cargo build --target x86_64-apple-darwin --release diff --git a/dev/release/README.md b/dev/release/README.md index 62291b51b..d11345294 100644 --- a/dev/release/README.md +++ b/dev/release/README.md @@ -81,6 +81,50 @@ python3 generate-changelog.py 0.0.0 HEAD 0.1.0 > ../changelog/0.1.0.md Create a PR against the _main_ branch to add this change log and once this is approved and merged, cherry-pick the commit into the release branch. +### Build the jars + +#### Setup to do the build + The build process requires Docker. Download the latest Docker Desktop from https://www.docker.com/products/docker-desktop/. + If you have multiple docker contexts running switch to the context of the Docker Desktop. For example - + + ```shell +$ docker context ls +NAME DESCRIPTION DOCKER ENDPOINT ERROR +default Current DOCKER_HOST based configuration unix:///var/run/docker.sock +desktop-linux Docker Desktop unix:///Users/parth/.docker/run/docker.sock +my_custom_context * tcp://192.168.64.2:2376 + +$ docker context use desktop-linux + ``` +#### Run the build script + The `build-release-comet.sh` script will create a docker image for each architecture and use the image +to build the platform specific binaries. These builder images are created every time this script is run. +The script optionally allows overriding of the repository and branch to build the binaries from (Note that + the local git repo is not used in the building of the binaries, but it is used to build the final uber jar). + +```shell +Usage: build-release-comet.sh [options] + +This script builds comet native binaries inside a docker image. The image is named +"comet-rm" and will be generated by this script + +Options are: + +-r [repo] : git repo (default: https://github.com/apache/datafusion-comet.git) +-b [branch] : git branch (default: release) +-t [tag] : tag for the spark-rm docker image to use for building (default: "latest"). +``` + +Example: + +```shell +cd dev/release && ./build-release-comet.sh && cd ../.. +``` + +#### Build output + The build output is installed to a temporary local maven repository. The build script will print the name of the repository +location at the end. This location will be required at the time of deploying the artifacts to a staging repository + ### Tag the Release Candidate Tag the release branch with `0.1.0-rc1` and push to the `apache` repo @@ -105,6 +149,15 @@ Run the create-tarball script on the release candidate tag (`0.1.0-rc1`) to crea GH_TOKEN= ./dev/release/create-tarball.sh 0.1.0 1 ``` +### Publish the maven artifacts +#### Setup maven +##### One time project setup +Setting up your project in the ASF Nexus Repository from here: https://infra.apache.org/publishing-maven-artifacts.html +##### Release Manager Setup +Set up your development environment from here: https://infra.apache.org/publishing-maven-artifacts.html + +TODO: build and publish a release candidate to nexus. + ### Start an Email Voting Thread Send the email that is generated in the previous step to `dev@datafusion.apache.org`. diff --git a/dev/release/build-release-comet.sh b/dev/release/build-release-comet.sh new file mode 100755 index 000000000..07466bf16 --- /dev/null +++ b/dev/release/build-release-comet.sh @@ -0,0 +1,202 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" +COMET_HOME_DIR=$SCRIPT_DIR/../.. + +function usage { + local NAME=$(basename $0) + cat </dev/null && pwd)" + +echo "Building architecture: ${ARCH} for ${REPO}/${BRANCH}" +rm -fr comet +git clone "$REPO" comet +cd comet +git checkout "$BRANCH" + +# build comet binaries + +make core-${ARCH}-libs diff --git a/pom.xml b/pom.xml index 4f3f39d14..2893b705d 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,11 @@ under the License. 4.0.0 + + org.apache + apache + 23 + org.apache.datafusion comet-parent-spark${spark.version.short}_${scala.binary.version} 0.3.0-SNAPSHOT