Skip to content

Commit

Permalink
feat(dev/release): add Rust release process
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Aug 28, 2024
1 parent 08ced8d commit c4c3eb3
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 7 deletions.
26 changes: 26 additions & 0 deletions ci/scripts/rust_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env 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 -euxo pipefail

source_dir="${1}/rust"

pushd "${source_dir}"
cargo build --all-features --all-targets --workspace
popd
30 changes: 30 additions & 0 deletions ci/scripts/rust_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env 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 -euxo pipefail

source_dir="${1}/rust"
cpp_libs_dir="${2}"

export LD_LIBRARY_PATH="${cpp_libs_dir}/lib:${LD_LIBRARY_PATH:-}"
export DYLD_LIBRARY_PATH="${cpp_libs_dir}/lib:${DYLD_LIBRARY_PATH:-}"

pushd "${source_dir}"
cargo test --all-features --workspace
popd
51 changes: 51 additions & 0 deletions dev/release/post-08-rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# -*- indent-tabs-mode: nil; sh-indentation: 2; sh-basic-offset: 2 -*-
#
# 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
set -u
set -o pipefail

SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SOURCE_DIR}/utils-common.sh"
source "${SOURCE_DIR}/utils-prepare.sh"

main() {
if [ "$#" -ne 0 ]; then
echo "Usage: $0"
exit
fi

local -r tag="apache-arrow-adbc-${RELEASE}"
# Ensure we are being run from the tag
if [[ $(git describe --exact-match --tags) != "${tag}" ]]; then
echo "This script must be run from the tag ${tag}"
exit 1
fi

pushd "${SOURCE_TOP_DIR}/rust"
cargo publish --all-features -p adbc_core
popd

echo "Success! The released Cargo crate is available here:"
echo " https://crates.io/crates/adbc_core"
}

main "$@"
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 20 additions & 5 deletions dev/release/verify-release-candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,9 @@ test_cpp() {
if [ "${USE_CONDA}" -gt 0 ]; then
export CMAKE_PREFIX_PATH="${CONDA_BACKUP_CMAKE_PREFIX_PATH}:${CMAKE_PREFIX_PATH}"
# The CMake setup forces RPATH to be the Conda prefix
local -r install_prefix="${CONDA_PREFIX}"
export CPP_INSTALL_PREFIX="${CONDA_PREFIX}"
else
local -r install_prefix="${ARROW_TMPDIR}/local"
export CPP_INSTALL_PREFIX="${ARROW_TMPDIR}/local"
fi

export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-${NPROC}}
Expand All @@ -486,14 +486,14 @@ test_cpp() {
export ADBC_CMAKE_ARGS="-DADBC_INSTALL_NAME_RPATH=OFF"
export ADBC_USE_ASAN=OFF
export ADBC_USE_UBSAN=OFF
"${ADBC_DIR}/ci/scripts/cpp_build.sh" "${ADBC_SOURCE_DIR}" "${ARROW_TMPDIR}/cpp-build" "${install_prefix}"
"${ADBC_DIR}/ci/scripts/cpp_build.sh" "${ADBC_SOURCE_DIR}" "${ARROW_TMPDIR}/cpp-build" "${CPP_INSTALL_PREFIX}"
# FlightSQL driver requires running database for testing
export BUILD_DRIVER_FLIGHTSQL=0
# PostgreSQL driver requires running database for testing
export BUILD_DRIVER_POSTGRESQL=0
# Snowflake driver requires snowflake creds for testing
export BUILD_DRIVER_SNOWFLAKE=0
"${ADBC_DIR}/ci/scripts/cpp_test.sh" "${ARROW_TMPDIR}/cpp-build" "${install_prefix}"
"${ADBC_DIR}/ci/scripts/cpp_test.sh" "${ARROW_TMPDIR}/cpp-build" "${CPP_INSTALL_PREFIX}"
export BUILD_DRIVER_FLIGHTSQL=1
export BUILD_DRIVER_POSTGRESQL=1
export BUILD_DRIVER_SNOWFLAKE=1
Expand Down Expand Up @@ -637,6 +637,17 @@ test_go() {
"${ADBC_DIR}/ci/scripts/go_test.sh" "${ADBC_SOURCE_DIR}" "${ARROW_TMPDIR}/go-build" "${install_prefix}"
}

test_rust() {
show_header "Build and test Rust libraries"

# TODO: setup rust
maybe_setup_conda rust || exit 1

# We expect the C++ libraries to exist.
"${ADBC_DIR}/ci/scripts/rust_build.sh" "${ADBC_SOURCE_DIR}"
"${ADBC_DIR}/ci/scripts/rust_test.sh" "${ADBC_SOURCE_DIR}" "${CPP_INSTALL_PREFIX}"
}

ensure_source_directory() {
show_header "Ensuring source directory"

Expand Down Expand Up @@ -722,6 +733,9 @@ test_source_distribution() {
if [ ${TEST_R} -gt 0 ]; then
test_r
fi
if [ ${TEST_RUST} -gt 0 ]; then
test_rust
fi

popd
}
Expand Down Expand Up @@ -874,9 +888,10 @@ test_jars() {
: ${TEST_JS:=${TEST_SOURCE}}
: ${TEST_GO:=${TEST_SOURCE}}
: ${TEST_R:=${TEST_SOURCE}}
: ${TEST_RUST:=${TEST_SOURCE}}

# Automatically test if its activated by a dependent
TEST_CPP=$((${TEST_CPP} + ${TEST_GO} + ${TEST_GLIB} + ${TEST_PYTHON}))
TEST_CPP=$((${TEST_CPP} + ${TEST_GO} + ${TEST_GLIB} + ${TEST_PYTHON} + ${TEST_RUST}))

# Execute tests in a conda enviroment
: ${USE_CONDA:=0}
Expand Down
4 changes: 2 additions & 2 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c4c3eb3

Please sign in to comment.