diff --git a/.maint/ci/activate.sh b/.maint/ci/activate.sh new file mode 100644 index 0000000..567e13a --- /dev/null +++ b/.maint/ci/activate.sh @@ -0,0 +1,9 @@ +if [ -e virtenv/bin/activate ]; then + source virtenv/bin/activate +elif [ -e virtenv/Scripts/activate ]; then + source virtenv/Scripts/activate +else + echo Cannot activate virtual environment + ls -R virtenv + false +fi diff --git a/.maint/ci/build_archive.sh b/.maint/ci/build_archive.sh new file mode 100755 index 0000000..6e8be6f --- /dev/null +++ b/.maint/ci/build_archive.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +echo "Building archive" + +source .maint/ci/activate.sh + +set -eu + +# Required dependencies +echo "INSTALL_TYPE = $INSTALL_TYPE" + +set -x + +if [ "$INSTALL_TYPE" = "sdist" -o "$INSTALL_TYPE" = "wheel" ]; then + python -m build +elif [ "$INSTALL_TYPE" = "archive" ]; then + ARCHIVE="/tmp/package.tar.gz" + git archive -o $ARCHIVE HEAD +fi + +if [ "$INSTALL_TYPE" = "sdist" ]; then + ARCHIVE=$( ls $PWD/dist/*.tar.gz ) +elif [ "$INSTALL_TYPE" = "wheel" ]; then + ARCHIVE=$( ls $PWD/dist/*.whl ) +elif [ "$INSTALL_TYPE" = "pip" ]; then + ARCHIVE="$PWD" +fi + +if [ "$INSTALL_TYPE" = "sdist" -o "$INSTALL_TYPE" = "wheel" ]; then + python -m pip install twine + python -m twine check $ARCHIVE +fi + +set +eux diff --git a/.maint/ci/check.sh b/.maint/ci/check.sh new file mode 100755 index 0000000..7b562ba --- /dev/null +++ b/.maint/ci/check.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +echo Running tests + +source .maint/ci/activate.sh + +set -eu + +# Required variables +echo CHECK_TYPE = $CHECK_TYPE + +set -x + +if [ "${CHECK_TYPE}" == "doc" ]; then + cd doc + make html && make doctest +elif [ "${CHECK_TYPE}" == "tests" ]; then + pytest --doctest-modules --cov fmripost_aroma --cov-report xml \ + --junitxml=test-results.xml -v fmripost_aroma +else + false +fi + +set +eux + +echo Done running tests diff --git a/.maint/ci/create_venv.sh b/.maint/ci/create_venv.sh new file mode 100755 index 0000000..6b6822e --- /dev/null +++ b/.maint/ci/create_venv.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +echo Creating isolated virtual environment + +source .maint/ci/env.sh + +set -eu + +# Required variables +echo SETUP_REQUIRES = $SETUP_REQUIRES + +set -x + +python -m pip install --upgrade pip virtualenv +virtualenv --python=python virtenv +source .maint/ci/activate.sh +python --version +python -m pip install -U $SETUP_REQUIRES +which python +which pip + +set +eux + +echo Done creating isolated virtual environment diff --git a/.maint/ci/env.sh b/.maint/ci/env.sh new file mode 100644 index 0000000..65e148b --- /dev/null +++ b/.maint/ci/env.sh @@ -0,0 +1,6 @@ +SETUP_REQUIRES="pip build" + +# Numpy and scipy upload nightly/weekly/intermittent wheels +NIGHTLY_WHEELS="https://pypi.anaconda.org/scipy-wheels-nightly/simple" +STAGING_WHEELS="https://pypi.anaconda.org/multibuild-wheels-staging/simple" +PRE_PIP_FLAGS="--pre --extra-index-url $NIGHTLY_WHEELS --extra-index-url $STAGING_WHEELS --prefer-binary" diff --git a/.maint/ci/install.sh b/.maint/ci/install.sh new file mode 100755 index 0000000..b9faf63 --- /dev/null +++ b/.maint/ci/install.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +echo Installing fmripost_aroma + +source .maint/ci/activate.sh +source .maint/ci/env.sh + +set -eu + +# Required variables +echo INSTALL_TYPE = $INSTALL_TYPE +echo CHECK_TYPE = $CHECK_TYPE +echo EXTRA_PIP_FLAGS = $EXTRA_PIP_FLAGS + +set -x + +if [ -n "$EXTRA_PIP_FLAGS" ]; then + EXTRA_PIP_FLAGS=${!EXTRA_PIP_FLAGS} +fi + +pip install $EXTRA_PIP_FLAGS $ARCHIVE + +# Basic import check +python -c 'import fmripost_aroma; print(fmripost_aroma.__version__)' + +if [ "$CHECK_TYPE" == "skiptests" ]; then + exit 0 +fi + +pip install $EXTRA_PIP_FLAGS "fmripost_aroma[$CHECK_TYPE]" + +set +eux + +echo Done installing fmripost_aroma diff --git a/.maint/ci/install_dependencies.sh b/.maint/ci/install_dependencies.sh new file mode 100755 index 0000000..7e0e33f --- /dev/null +++ b/.maint/ci/install_dependencies.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +echo "Installing dependencies" + +set -eu + +# Required variables +echo OS_TYPE = $OS_TYPE + +if [ "$OS_TYPE" = "ubuntu-latest" ]; then + sudo apt update + sudo apt install -y graphviz +elif [ "$OS_TYPE" = "macos-latest" ]; then + brew install graphviz +else + echo "Unknown OS_TYPE: $OS_TYPE" +fi + +set +eux + +echo Done installing dependencies diff --git a/.maint/ci/install_extras.sh b/.maint/ci/install_extras.sh new file mode 100755 index 0000000..19d4449 --- /dev/null +++ b/.maint/ci/install_extras.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +echo Installing dependencies + +source .maint/ci/activate.sh +source .maint/ci/env.sh + +set -eu + +# Required variables +echo EXTRA_PIP_FLAGS = $EXTRA_PIP_FLAGS +echo CHECK_TYPE = $CHECK_TYPE + +set -x + +if [ -n "$EXTRA_PIP_FLAGS" ]; then + EXTRA_PIP_FLAGS=${!EXTRA_PIP_FLAGS} +fi + +pip install $EXTRA_PIP_FLAGS "fmripost_aroma[$CHECK_TYPE]" + +set +eux + +echo Done installing dependencies