Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests/circleci #17

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
57 changes: 57 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
version: 2.1

.dockersetup: &dockersetup
docker:
- image: chenyingzhao/fsub_extractor_deps:0.0.1
working_directory: /fsub_extractor


runinstall: &runinstall
name: Install fsub_extractor
command: |
VERSION=0+build
if [[ -n "$CIRCLE_TAG" ]]; then
VERSION="$CIRCLE_TAG"
fi
git checkout $CIRCLE_BRANCH
echo "${VERSION}" > /src/qsiprep/qsiprep/VERSION
echo "include qsiprep/VERSION" >> /src/qsiprep/MANIFEST.in
pip install . --progress-bar off
# Precaching fonts, set 'Agg' as default backend for matplotlib
python -c "from matplotlib import font_manager"
sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )

jobs:

build:
<<: *dockersetup
steps:
- checkout
- run: *runinstall
test_working:
<<: *dockersetup
steps:
- checkout
- run: *runinstall
- run:
name: Test command extrator is working
command: |
extractor
# can add more runs for different commands if needed

workflows:
version: 2
build_test_deploy:
jobs:

- build:
filters:
tags:
only: /.*/

- test_working:
requires:
- build
filters:
tags:
only: /.*/
77 changes: 77 additions & 0 deletions Dockerfile_4circleci
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# This Dockerfile is for CircleCI tests of this python package. Below we install necessary dependent packages.
# This Dockerfile is NOT for building the docker image of this python package.

# ref: https://github.com/PennLINC/qsiprep_build/blob/main/setup_build.sh
# ref: https://github.com/PennLINC/qsiprep_build/blob/main/Dockerfile

FROM pennbbl/qsiprep-freesurfer:22.2.0 as build_freesurfer
FROM pennbbl/qsiprep-mrtrix3:22.1.0 as build_mrtrix3
FROM pennbbl/qsiprep-miniconda:22.4.1 as build_miniconda
# seems MRTRIX3_DEPS requires cuda:
FROM nvidia/cuda:10.2-runtime-ubuntu18.04 as cuda10

FROM cuda10

## MRtrix3
COPY --from=build_mrtrix3 /opt/mrtrix3-latest /opt/mrtrix3-latest
ENV PATH="$PATH:/opt/mrtrix3-latest/bin" \
MRTRIX3_DEPS="bzip2 ca-certificates curl libpng16-16 libblas3 liblapack3 libtiff5"


## FreeSurfer
COPY --from=build_freesurfer /opt/freesurfer /opt/freesurfer
# Simulate SetUpFreeSurfer.sh
ENV FSL_DIR="/opt/fsl-6.0.5.1" \
OS="Linux" \
FS_OVERRIDE=0 \
FIX_VERTEX_AREA="" \
FSF_OUTPUT_FORMAT="nii.gz" \
FREESURFER_HOME="/opt/freesurfer"
ENV SUBJECTS_DIR="$FREESURFER_HOME/subjects" \
FUNCTIONALS_DIR="$FREESURFER_HOME/sessions" \
MNI_DIR="$FREESURFER_HOME/mni" \
LOCAL_DIR="$FREESURFER_HOME/local" \
MINC_BIN_DIR="$FREESURFER_HOME/mni/bin" \
MINC_LIB_DIR="$FREESURFER_HOME/mni/lib" \
MNI_DATAPATH="$FREESURFER_HOME/mni/data"
ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
PATH="$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH" \
FREESURFER_DEPS="bc ca-certificates curl libgomp1 libxmu6 libxt6 tcsh perl"



## Python, compiled dependencies
# if the last FROM is miniconda, we don't need to COPY it.
COPY --from=build_miniconda /usr/local/miniconda /usr/local/miniconda
COPY --from=build_miniconda /home/qsiprep/.dipy /home/qsiprep/.dipy
ENV PATH="/usr/local/miniconda/bin:$PATH"


## Install deps:
RUN apt-get update \
&& apt install -y --no-install-recommends \
${MRTRIX3_DEPS}

## Install fury:
RUN conda install -c conda-forge fury

## Install datalad etc:
RUN conda install -c conda-forge datalad git git-annex

## Install antspy:
# RUN pip install antspyx # is this correct ????????????

# ## Install the current python pacakge - this is not needed for Dockerfile for CIRCLECI !!!!!
# RUN apt-get update && apt-get install -y --no-install-recommends \
# git

# COPY . /fsub_extractor

# better not to git clone, but do `COPY`
# # RUN git clone https://github.com/smeisler/fsub_extractor.git
# WORKDIR fsub_extractor
# #RUN git checkout ${commitSHA_confixel}
# RUN pip install .
# # NOTE: there is something wrong in this installation: `extractor` wasn't installed successfully....
# WORKDIR /
15 changes: 15 additions & 0 deletions Dockerfile_4circleci_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Steps of preparing the Docker images:

# +++++++++++++++++++++++++++++++++++++++
tag_version="0.0.1.9000"
# +++++++++++++++++++++++++++++++++++++++


## build the dockerfile for fsub_extractor:
cmd="docker build -t chenyingzhao/fsub_extractor_deps:${tag_version} -f Dockerfile_4circleci ."
echo $cmd
$cmd

cmd="docker push chenyingzhao/fsub_extractor_deps:${tag_version}"
#echo $cmd
#$cmd
Binary file added acpcdetect
Binary file not shown.
Binary file added fsub_extractor/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added fsub_extractor/__pycache__/main.cpython-39.pyc
Binary file not shown.