kszucs commented on a change in pull request #12320: URL: https://github.com/apache/arrow/pull/12320#discussion_r808164349
########## File path: dev/release/verify-release-candidate.sh ########## @@ -378,22 +342,253 @@ test_csharp() { fi fi - sourcelink test artifacts/Apache.Arrow/Release/netstandard1.3/Apache.Arrow.pdb - sourcelink test artifacts/Apache.Arrow/Release/netcoreapp2.1/Apache.Arrow.pdb + CSHARP_ALREADY_INSTALLED=1 +} + +install_go() { + # Install go + if [ "${GO_ALREADY_INSTALLED:-0}" -gt 0 ]; then + return 0 + fi + local version=1.16.12 + + local arch="$(uname -m)" + if [ "$arch" == "x86_64" ]; then + arch=amd64 + elif [ "$arch" == "aarch64" ]; then + arch=arm64 + fi + + if [ "$(uname)" == "Darwin" ]; then + local os=darwin + else + local os=linux + fi + + local archive="go${version}.${os}-${arch}.tar.gz" + curl -sLO https://dl.google.com/go/$archive + + local prefix=${ARROW_TMPDIR}/go + mkdir -p $prefix + tar -xzf $archive -C $prefix + rm -f $archive + + export GOROOT=${prefix}/go + export GOPATH=${prefix}/gopath + export PATH=$GOROOT/bin:$GOPATH/bin:$PATH + + GO_ALREADY_INSTALLED=1 +} + +mamba() { + # Helper to access mamba directly instead after activating base conda environment + $ARROW_TMPDIR/mambaforge/bin/mamba "$@" +} + +install_conda() { + # Setup short-lived miniconda for Python and integration tests + if [ "${CONDA_ALREADY_INSTALLED:-0}" -gt 0 ]; then + return 0 + fi + + local arch=$(uname -m) + local platform=$(uname) + local url="https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-${platform}-${arch}.sh" + local prefix=$ARROW_TMPDIR/mambaforge + + # Setup miniconda only if the directory doesn't exist yet + if [ ! -d "${prefix}" ]; then + curl -sL -o miniconda.sh $url + bash miniconda.sh -b -p $prefix + rm -f miniconda.sh + echo "Installed miniconda at ${prefix}" + else + echo "Miniconda already installed at ${prefix}" + fi + + # Creating a separate conda environment + . $prefix/etc/profile.d/conda.sh + conda activate base + + CONDA_ALREADY_INSTALLED=1 +} + +setup_conda() { + # Optionally setup conda environment with the passed dependencies + local env="conda-${ENV:-source}" + local pyver=${PYTHON_VERSION:-3} + + if [ "${USE_CONDA}" -gt 0 ]; then + # Deactivate previous env + if [ ! -z ${CONDA_PREFIX} ]; then + conda deactivate || : + fi + # Ensure that conda is installed + install_conda + # Create environment + if ! conda env list | grep $env; then + mamba create -y -n $env python=${pyver} + echo "Created conda environment ${CONDA_PREFIX}" + fi + # Install dependencies + if [ $# -gt 0 ]; then + mamba install -y -n $env $@ + fi + # Activate the environment + conda activate $env + elif [ ! -z ${CONDA_PREFIX} ]; then + echo "Conda environment is active despite that USE_CONDA is set to 0." + echo "Deactivate the environment before running the verification script." + exit 1 + fi +} + +setup_virtualenv() { + # Optionally setup pip virtualenv with the passed dependencies + local env="venv-${ENV:-source}" + local pyver=${PYTHON_VERSION:-3} + local python=${PYTHON:-"python${pyver}"} + local virtualenv="${ARROW_TMPDIR}/${env}" + local skip_missing_python=${SKIP_MISSING_PYTHON:-0} + + if [ "${USE_CONDA}" -eq 0 ]; then + if [ ! -z ${CONDA_PREFIX} ]; then + echo "Conda environment is active despite that USE_CONDA is set to 0." + echo "Deactivate the environment before running the verification script." + exit 1 + fi + # Deactivate previous env + deactivate || : + # Check that python interpreter exists + if ! command -v "${python}"; then + echo "Couldn't locate python interpreter with version ${pyver}" + echo "Call the script with USE_CONDA=1 to test all of the python versions." + if [ $skip_missing_python -gt 0 ]; then + continue + else + exit 1 + fi + fi + # Create environment + if [ ! -d "${virtualenv}" ]; then + $python -m pip install virtualenv + $python -m virtualenv ${virtualenv} + fi + # Activate the environment + source "${virtualenv}/bin/activate" + # Install dependencies + if [ $# -gt 0 ]; then + pip install $@ + fi + fi +} + +setup_go() { + if [ "${USE_CONDA}" -eq 0 ]; then + install_go + fi +} + +setup_nodejs() { + if [ "${USE_CONDA}" -eq 0 ]; then + install_nodejs + fi +} + +test_package_java() { + # Build and test Java (Requires newer Maven -- I used 3.3.9) + setup_conda maven + + pushd java + mvn test + mvn package popd } -# Build and test Python +test_and_install_cpp() { + # Build and test C++ + setup_virtualenv numpy + setup_conda \ + --file ci/conda_env_unix.txt \ + --file ci/conda_env_cpp.txt \ + --file ci/conda_env_gandiva.txt \ + ncurses \ + numpy \ + sqlite \ + compilers + + if [ "${USE_CONDA}" -gt 0 ]; then + DEFAULT_DEPENDENCY_SOURCE="CONDA" + else + DEFAULT_DEPENDENCY_SOURCE="AUTO" + fi + + mkdir -p $ARROW_TMPDIR/build + pushd $ARROW_TMPDIR/build + + if [ ! -z "$CMAKE_GENERATOR" ]; then + ARROW_CMAKE_OPTIONS="${ARROW_CMAKE_OPTIONS:-} -G Ninja" + fi + + cmake \ + -DARROW_BOOST_USE_SHARED=ON \ + -DARROW_BUILD_INTEGRATION=ON \ + -DARROW_BUILD_TESTS=ON \ Review comment: Updated. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org