Skip to content

Commit

Permalink
Merge pull request #13 from raydouglass/bld-gpuci-scripts
Browse files Browse the repository at this point in the history
[REVIEW] Add ci scripts & conda recipe
  • Loading branch information
raydouglass authored Mar 15, 2019
2 parents 4ef3635 + c51ab47 commit a0b523b
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 2 deletions.
27 changes: 27 additions & 0 deletions ci/checks/style.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
# Copyright (c) 2019, NVIDIA CORPORATION.
################################################################################
# dask-cuda Style Tester
################################################################################

# Ignore errors and set path
set +e
PATH=/conda/bin:$PATH

# Activate common conda env
source activate gdf

# Run flake8 and get results/return code
FLAKE=`flake8 python`
RETVAL=$?

# Output results if failure otherwise show pass
if [ "$FLAKE" != "" ]; then
echo -e "\n\n>>>> FAILED: flake8 style check; begin output\n\n"
echo -e "$FLAKE"
echo -e "\n\n>>>> FAILED: flake8 style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: flake8 style check\n\n"
fi

exit $RETVAL
56 changes: 56 additions & 0 deletions ci/cpu/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Copyright (c) 2019, NVIDIA CORPORATION.
################################################################################
# dask-cuda cpu build
################################################################################
set -e

# Logger function for build status output
function logger() {
echo -e "\n>>>> $@\n"
}

# Set path and build parallel level
export PATH=/conda/bin:/usr/local/cuda/bin:$PATH

# Set home to the job's workspace
export HOME=$WORKSPACE

# Switch to project root; also root of repo checkout
cd $WORKSPACE

# Get latest tag and number of commits since tag
export GIT_DESCRIBE_TAG=`git describe --abbrev=0 --tags`
export GIT_DESCRIBE_NUMBER=`git rev-list ${GIT_DESCRIBE_TAG}..HEAD --count`

################################################################################
# SETUP - Check environment
################################################################################

logger "Get env..."
env

logger "Activate conda env..."
source activate gdf

logger "Check versions..."
python --version
gcc --version
g++ --version
conda list

# FIX Added to deal with Anancoda SSL verification issues during conda builds
conda config --set ssl_verify False

################################################################################
# BUILD - Conda package build
################################################################################

conda build conda/recipes/dask-cuda --python=${PYTHON}

################################################################################
# UPLOAD - Conda package
################################################################################

logger "Upload conda pkg..."
source ci/cpu/upload-anaconda.sh
36 changes: 36 additions & 0 deletions ci/cpu/upload-anaconda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
#
# Adopted from https://github.com/tmcdonell/travis-scripts/blob/dfaac280ac2082cd6bcaba3217428347899f2975/update-accelerate-buildbot.sh

set -e

export UPLOADFILE=`conda build conda/recipes/dask-cuda --python=$PYTHON --output`
CUDA_REL=${CUDA:0:3}
if [ "${CUDA:0:2}" == '10' ]; then
# CUDA 10 release
CUDA_REL=${CUDA:0:4}
fi

SOURCE_BRANCH=master

if [ "$LABEL_MAIN" == "1" ]; then
LABEL_OPTION="--label main --label cuda${CUDA_REL}"
else
LABEL_OPTION="--label dev --label cuda${CUDA_REL}"
fi
echo "LABEL_OPTION=${LABEL_OPTION}"

# Restrict uploads to master branch
if [ ${GIT_BRANCH} != ${SOURCE_BRANCH} ]; then
echo "Skipping upload"
return 0
fi

if [ -z "$MY_UPLOAD_KEY" ]; then
echo "No upload key"
return 0
fi

echo "Upload"
echo ${UPLOADFILE}
anaconda -t ${MY_UPLOAD_KEY} upload -u ${CONDA_USERNAME:-rapidsai} ${LABEL_OPTION} --force ${UPLOADFILE}
47 changes: 47 additions & 0 deletions ci/gpu/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -e

# Logger function for build status output
function logger() {
echo -e "\n>>>> $@\n"
}

# Set path and build parallel level
export PATH=/conda/bin:/usr/local/cuda/bin:$PATH

# Set home to the job's workspace
export HOME=$WORKSPACE

# Switch to project root; also root of repo checkout
cd $WORKSPACE

# Get latest tag and number of commits since tag
export GIT_DESCRIBE_TAG=`git describe --abbrev=0 --tags`
export GIT_DESCRIBE_NUMBER=`git rev-list ${GIT_DESCRIBE_TAG}..HEAD --count`

################################################################################
# SETUP - Check environment
################################################################################

logger "Get env..."
env

logger "Activate conda env..."
source activate gdf

logger "Check versions..."
python --version
gcc --version
g++ --version
conda list

# FIX Added to deal with Anancoda SSL verification issues during conda builds
conda config --set ssl_verify False

################################################################################
# TEST - Run tests
################################################################################

pip install -e .
pip install pytest
pytest --cache-clear --junitxml=${WORKSPACE}/junit-libgdf.xml -v
52 changes: 52 additions & 0 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
# Copyright (c) 2019, NVIDIA CORPORATION.
################################################################################
# dask-cuda version updater
################################################################################

## Usage
# bash update-version.sh <type>
# where <type> is either `major`, `minor`, `patch`

set -e

# Grab argument for release type
RELEASE_TYPE=$1

# Get current version and calculate next versions
CURRENT_TAG=`git describe --abbrev=0 --tags | tr -d 'v'`
CURRENT_MAJOR=`echo $CURRENT_TAG | awk '{split($0, a, "."); print a[1]}'`
CURRENT_MINOR=`echo $CURRENT_TAG | awk '{split($0, a, "."); print a[2]}'`
CURRENT_PATCH=`echo $CURRENT_TAG | awk '{split($0, a, "."); print a[3]}'`
NEXT_MAJOR=$((CURRENT_MAJOR + 1))
NEXT_MINOR=$((CURRENT_MINOR + 1))
NEXT_PATCH=$((CURRENT_PATCH + 1))
NEXT_FULL_TAG=""
NEXT_SHORT_TAG=""

# Determine release type
if [ "$RELEASE_TYPE" == "major" ]; then
NEXT_FULL_TAG="${NEXT_MAJOR}.0.0"
NEXT_SHORT_TAG="${NEXT_MAJOR}.0"
elif [ "$RELEASE_TYPE" == "minor" ]; then
NEXT_FULL_TAG="${CURRENT_MAJOR}.${NEXT_MINOR}.0"
NEXT_SHORT_TAG="${CURRENT_MAJOR}.${NEXT_MINOR}"
elif [ "$RELEASE_TYPE" == "patch" ]; then
NEXT_FULL_TAG="${CURRENT_MAJOR}.${CURRENT_MINOR}.${NEXT_PATCH}"
NEXT_SHORT_TAG="${CURRENT_MAJOR}.${CURRENT_MINOR}"
else
echo "Incorrect release type; use 'major', 'minor', or 'patch' as an argument"
exit 1
fi

# Move to root of repo
cd ../..
echo "Preparing '$RELEASE_TYPE' release [$CURRENT_TAG -> $NEXT_FULL_TAG]"

# Inplace sed replace; workaround for Linux and Mac
function sed_runner() {
sed -i.bak ''"$1"'' $2 && rm -f ${2}.bak
}


# No-op
3 changes: 3 additions & 0 deletions conda/recipes/dask-cuda/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

python setup.py install
37 changes: 37 additions & 0 deletions conda/recipes/dask-cuda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2019, NVIDIA CORPORATION.

# Usage:
# conda build -c conda-forge -c defaults .
{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %}
{% set git_revision_count=environ.get('GIT_DESCRIBE_NUMBER', 0) %}
package:
name: dask-cuda
version: {{ version }}

source:
path: ../../..

build:
number: {{ git_revision_count }}
string: {{ git_revision_count }}

requirements:
build:
- python x.x
- dask-core>=1.1.4
- distributed>=1.25.2
run:
- python x.x
- dask-core>=1.1.4
- distributed>=1.25.2

test:
imports:
- dask_cuda


about:
home: http://rapids.ai/
license: Apache-2.0
license_file: ../../../LICENSE
summary: dask-cuda library
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dask
dask-core>=1.1.4
distributed>=1.25.2
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
with open(os.path.join(os.path.dirname(__file__), "README.md")) as f:
long_description = f.read()

version = os.environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev0').lstrip('v')
setup(
name="dask-cuda",
version=version,
description="Utilities for Dask and CUDA interactions",
long_description=long_description,
long_description_content_type='text/markdown',
url="https://github.com/rapidsai/dask-cuda",
author="RAPIDS development team",
author_email="[email protected]",
Expand All @@ -20,8 +23,8 @@
"Topic :: Database",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: Apache License",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
packages=find_packages(exclude=["docs", "tests", "tests.*", "docs.*"]),
install_requires=open('requirements.txt').read().strip().split('\n'),
Expand Down

0 comments on commit a0b523b

Please sign in to comment.