Draft
Show file tree
Hide file tree
Changes from all commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Failed to load files.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
#!/bin/bash

docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py38" /usr/bin/run_pytests.sh
docker run --rm=false -t -v "$WORKDIR":/work -v "$HOME"/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py38" /usr/bin/run_pytests.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,21 +8,21 @@ arr=$@
tmp_var=$( IFS=$' '; echo "${arr[*]}" )
example_id=${tmp_var//[^A-Za-z0-9_-]/_}

mkdir -p ${HOME}/.nipype ${WORKDIR}/logs/example_${example_id} ${WORKDIR}/tests ${WORKDIR}/crashfiles
echo "[logging]" > ${HOME}/.nipype/nipype.cfg
echo "workflow_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
echo "interface_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
echo "utils_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
echo "log_to_file = true" >> ${HOME}/.nipype/nipype.cfg
echo "log_directory = ${WORKDIR}/logs/example_${example_id}" >> ${HOME}/.nipype/nipype.cfg
mkdir -p "${HOME}"/.nipype "${WORKDIR}"/logs/example_"${example_id}" "${WORKDIR}"/tests "${WORKDIR}"/crashfiles
echo "[logging]" > "${HOME}"/.nipype/nipype.cfg
echo "workflow_level = DEBUG" >> "${HOME}"/.nipype/nipype.cfg
echo "interface_level = DEBUG" >> "${HOME}"/.nipype/nipype.cfg
echo "utils_level = DEBUG" >> "${HOME}"/.nipype/nipype.cfg
echo "log_to_file = true" >> "${HOME}"/.nipype/nipype.cfg
echo "log_directory = ${WORKDIR}/logs/example_${example_id}" >> "${HOME}"/.nipype/nipype.cfg

echo '[execution]' >> ${HOME}/.nipype/nipype.cfg
echo 'crashfile_format = txt' >> ${HOME}/.nipype/nipype.cfg
echo '[execution]' >> "${HOME}"/.nipype/nipype.cfg
echo 'crashfile_format = txt' >> "${HOME}"/.nipype/nipype.cfg

if [[ "${NIPYPE_RESOURCE_MONITOR:-0}" == "1" ]]; then
echo '[monitoring]' >> ${HOME}/.nipype/nipype.cfg
echo 'enabled = true' >> ${HOME}/.nipype/nipype.cfg
echo 'sample_frequency = 3' >> ${HOME}/.nipype/nipype.cfg
echo '[monitoring]' >> "${HOME}"/.nipype/nipype.cfg
echo 'enabled = true' >> "${HOME}"/.nipype/nipype.cfg
echo 'sample_frequency = 3' >> "${HOME}"/.nipype/nipype.cfg
fi

# Set up coverage
Expand All@@ -35,9 +35,9 @@ coverage run /src/nipype/tools/run_examples.py $@
exit_code=$?

if [[ "${NIPYPE_RESOURCE_MONITOR:-0}" == "1" ]]; then
cp resource_monitor.json 2>/dev/null ${WORKDIR}/logs/example_${example_id}/ || :
cp resource_monitor.json 2>/dev/null "${WORKDIR}"/logs/example_"${example_id}"/ || :
fi
# Collect crashfiles and generate xml report
coverage xml -o ${WORKDIR}/tests/smoketest_${example_id}.xml
find /work -maxdepth 1 -name "crash-*" -exec mv {} ${WORKDIR}/crashfiles/ \;
coverage xml -o "${WORKDIR}"/tests/smoketest_"${example_id}".xml
find /work -maxdepth 1 -name "crash-*" -exec mv {} "${WORKDIR}"/crashfiles/ \;
exit $exit_code
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,32 +9,32 @@ WORKDIR=${WORK:-/work}
PYTHON_VERSION=$( python -c "import sys; print('{}{}'.format(sys.version_info[0], sys.version_info[1]))" )

# Create necessary directories
mkdir -p ${WORKDIR}/tests ${WORKDIR}/crashfiles ${WORKDIR}/logs/py${PYTHON_VERSION}
mkdir -p "${WORKDIR}"/tests "${WORKDIR}"/crashfiles "${WORKDIR}"/logs/py"${PYTHON_VERSION}"

# Create a nipype config file
mkdir -p ${HOME}/.nipype
echo '[logging]' > ${HOME}/.nipype/nipype.cfg
echo 'log_to_file = true' >> ${HOME}/.nipype/nipype.cfg
echo "log_directory = ${WORKDIR}/logs/py${PYTHON_VERSION}" >> ${HOME}/.nipype/nipype.cfg
mkdir -p "${HOME}"/.nipype
echo '[logging]' > "${HOME}"/.nipype/nipype.cfg
echo 'log_to_file = true' >> "${HOME}"/.nipype/nipype.cfg
echo "log_directory = ${WORKDIR}/logs/py${PYTHON_VERSION}" >> "${HOME}"/.nipype/nipype.cfg

echo '[execution]' >> ${HOME}/.nipype/nipype.cfg
echo 'crashfile_format = txt' >> ${HOME}/.nipype/nipype.cfg
echo '[execution]' >> "${HOME}"/.nipype/nipype.cfg
echo 'crashfile_format = txt' >> "${HOME}"/.nipype/nipype.cfg

if [[ "${NIPYPE_RESOURCE_MONITOR:-0}" == "1" ]]; then
echo 'resource_monitor = true' >> ${HOME}/.nipype/nipype.cfg
echo 'resource_monitor = true' >> "${HOME}"/.nipype/nipype.cfg
fi

# Run tests using pytest
export COVERAGE_FILE=${WORKDIR}/tests/.coverage.py${PYTHON_VERSION}
py.test -v --junitxml=${WORKDIR}/tests/pytests_py${PYTHON_VERSION}.xml \
py.test -v --junitxml="${WORKDIR}"/tests/pytests_py"${PYTHON_VERSION}".xml \
--cov nipype --cov-config /src/nipype/.coveragerc \
--cov-report xml:${WORKDIR}/tests/coverage_py${PYTHON_VERSION}.xml \
--cov-report xml:"${WORKDIR}"/tests/coverage_py"${PYTHON_VERSION}".xml \
-n auto \
-c ${TESTPATH}/pytest.ini ${TESTPATH}
-c "${TESTPATH}"/pytest.ini "${TESTPATH}"
exit_code=$?

# Collect crashfiles
find ${WORKDIR} -maxdepth 1 -name "crash-*" -exec mv {} ${WORKDIR}/crashfiles/ \;
find "${WORKDIR}" -maxdepth 1 -name "crash-*" -exec mv {} "${WORKDIR}"/crashfiles/ \;

echo "Unit tests finished with exit code ${exit_code}"
exit ${exit_code}
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,15 +4,15 @@

set -e

USAGE="usage: $(basename $0) [-h] [-b] [-m]"
USAGE="usage: $(basename "$0") [-h] [-b] [-m]"

function Help {
cat <<USAGE
Generate base and/or main Dockerfiles for Nipype.

Usage:

$(basename $0) [-h] [-b] [-m]
$(basename "$0") [-h] [-b] [-m]

Options:

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,7 @@ source tools/ci/env.sh
set -eu

# Required variables
echo CHECK_TYPE = $CHECK_TYPE
echo CHECK_TYPE = "$CHECK_TYPE"

set -x

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,15 +7,15 @@ source tools/ci/env.sh
set -eu

# Required variables
echo SETUP_REQUIRES = $SETUP_REQUIRES
echo SETUP_REQUIRES = "$SETUP_REQUIRES"

set -x

python -m pip install --upgrade pip virtualenv
virtualenv --python=python virtenv
source tools/ci/activate.sh
python --version
python -m pip install -U $SETUP_REQUIRES
python -m pip install -U "$SETUP_REQUIRES"
which python
which pip

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,8 +8,8 @@ source tools/ci/env.sh
set -eu

# Required variables
echo EXTRA_PIP_FLAGS = $EXTRA_PIP_FLAGS
echo DEPENDS = $DEPENDS
echo EXTRA_PIP_FLAGS = "$EXTRA_PIP_FLAGS"
echo DEPENDS = "$DEPENDS"

set -x

Expand All@@ -18,7 +18,7 @@ if [ -n "$EXTRA_PIP_FLAGS" ]; then
fi

if [ -n "$DEPENDS" ]; then
pip install ${EXTRA_PIP_FLAGS} --prefer-binary ${!DEPENDS}
pip install "${EXTRA_PIP_FLAGS}" --prefer-binary "${!DEPENDS}"
fi

set +eux
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,22 +51,22 @@ else
fi

# Clean working copy
TMP=`mktemp -d`
hub clone conda-forge/$FEEDSTOCK $TMP/$FEEDSTOCK
pushd $TMP/$FEEDSTOCK
TMP=$(mktemp -d)
hub clone conda-forge/"$FEEDSTOCK" "$TMP"/"$FEEDSTOCK"
pushd "$TMP"/"$FEEDSTOCK"

# Get user fork, move to a candidate release branch, detecting if new branch
hub fork
git fetch --all
if git checkout -t $_USER/$BRANCH; then
if git checkout -t "$_USER"/"$BRANCH"; then
NEW_PR=false
else
NEW_PR=true
git checkout -b $BRANCH origin/main
git checkout -b "$BRANCH" origin/main
fi

# Calculate hash
SHA256=`curl -sSL https://.com/$SRCREPO/archive/$REF.tar.gz | sha256sum | cut -d\ -f 1`
SHA256=$(curl -sSL https://.com/"$SRCREPO"/archive/"$REF".tar.gz | sha256sum | cut -d\ -f 1)

URL_BASE="https://.com/$CIRCLE_PROJECT_USERNAME/{{ name }}/archive"
if $RELEASE; then
Expand All@@ -87,7 +87,7 @@ sed -i \
# Bump branch
git add recipe/meta.yaml
git commit -m "$COMMIT_MSG"
git push -u $_USER $BRANCH
git push -u "$_USER" "$BRANCH"

if $NEW_PR; then
hub pull-request -b conda-forge:main -F - <<END
Expand DownExpand Up@@ -117,4 +117,4 @@ fi

# Remove working copy
popd
rm -rf $TMP/$FEEDSTOCK
rm -rf "$TMP"/"$FEEDSTOCK"
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,11 +26,11 @@ for ARG; do
done

RET=0
for i in `seq $NLOOPS`; do
for i in $(seq "$NLOOPS"); do
sh -c "$CMD"
RET="$?"
if [ "$RET" -eq 0 ]; then break; fi
if [ "$i" -ne "$NLOOPS" ]; then sleep $TOSLEEP; fi
if [ "$i" -ne "$NLOOPS" ]; then sleep "$TOSLEEP"; fi
done

exit $RET
Loading