diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..65fcf59 --- /dev/null +++ b/.circleci/config.yml @@ -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: /.*/ \ No newline at end of file diff --git a/Dockerfile_4circleci b/Dockerfile_4circleci new file mode 100644 index 0000000..c63e7e6 --- /dev/null +++ b/Dockerfile_4circleci @@ -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 / \ No newline at end of file diff --git a/Dockerfile_4circleci_run.sh b/Dockerfile_4circleci_run.sh new file mode 100644 index 0000000..2d7a211 --- /dev/null +++ b/Dockerfile_4circleci_run.sh @@ -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 diff --git a/acpcdetect b/acpcdetect new file mode 100644 index 0000000..283290f Binary files /dev/null and b/acpcdetect differ diff --git a/fsub_extractor/__pycache__/__init__.cpython-39.pyc b/fsub_extractor/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..aa2566e Binary files /dev/null and b/fsub_extractor/__pycache__/__init__.cpython-39.pyc differ diff --git a/fsub_extractor/__pycache__/main.cpython-39.pyc b/fsub_extractor/__pycache__/main.cpython-39.pyc new file mode 100644 index 0000000..1ba0fb6 Binary files /dev/null and b/fsub_extractor/__pycache__/main.cpython-39.pyc differ