Skip to content

Commit

Permalink
Add maintenance scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed May 5, 2024
1 parent b8e66fd commit f84af43
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .maint/ci/activate.sh
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions .maint/ci/build_archive.sh
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions .maint/ci/check.sh
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions .maint/ci/create_venv.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions .maint/ci/env.sh
Original file line number Diff line number Diff line change
@@ -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"
34 changes: 34 additions & 0 deletions .maint/ci/install.sh
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions .maint/ci/install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions .maint/ci/install_extras.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f84af43

Please sign in to comment.