Skip to content

Commit

Permalink
Merge pull request #67 from Shotgunosine/fs_7
Browse files Browse the repository at this point in the history
WIP: Add Freesurfer 7
  • Loading branch information
Remi-Gau authored Aug 30, 2023
2 parents 6b76873 + 765a747 commit 4663559
Show file tree
Hide file tree
Showing 10 changed files with 1,577 additions and 718 deletions.
160 changes: 112 additions & 48 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,39 @@ jobs:
build:
machine:
image: ubuntu-2204:2022.10.2
parameters:
version:
type: string
steps:
- checkout
- restore_cache:
keys:
- v_0-image_cache-{{ checksum "Dockerfile" }}
- v_0-image_cache_fs<< parameters.version >>-{{ checksum "Dockerfile_fs<< parameters.version >>" }}
- run:
name: load and build
command: |
wget https://raw.githubusercontent.com/bids-apps/maintenance-tools/main/circleci/build_docker.sh
bash build_docker.sh
tar_name=image_fs<< parameters.version >>.tar
if [[ -e ~/docker/${tar_name} ]]; then
docker load -i ~/docker/${tar_name}
fi
git describe --tags > version
docker build -t bids/${CIRCLE_PROJECT_REPONAME}_fs<< parameters.version >> -f Dockerfile_fs<< parameters.version >> .
mkdir -p ~/docker; docker save "bids/${CIRCLE_PROJECT_REPONAME}_fs<< parameters.version >>" > ~/docker/${tar_name}
mkdir -p ~/license_fs<< parameters.version >>
mkdir -p ~/license
echo "cHJpbnRmICJEeWxhbi5OaWVsc29uQGdtYWlsLmNvbVxuMzcwNjNcbiAqQ1lrZWhQYUNvRDlNXG4gRlM2N1BTWmRFV2lqb1xuIiA+IH4vbGljZW5zZS9saWNlbnNlLnR4dA==" | base64 -d | sh
no_output_timeout: 6h
cp ~/license/license.txt ~/license_fs<< parameters.version >>/license.txt
rm -r ~/license
- save_cache:
key: v_0-image_cache-{{ checksum "Dockerfile" }}-{{ .Revision }}-{{ epoch }}
key: v_0-image_cache_fs<< parameters.version >>-{{ checksum "Dockerfile_fs<< parameters.version >>" }}-{{ .Revision }}-{{ epoch }}
paths:
- ~/docker
- ~/license
- ~/license_fs<< parameters.version >>
- persist_to_workspace:
root: /home/circleci
paths:
- docker/image.tar
- license/license.txt
- docker/image_fs<< parameters.version >>.tar
- license_fs<< parameters.version >>/license.txt

get_data:
machine:
Expand Down Expand Up @@ -60,51 +70,65 @@ jobs:
test:
machine:
image: ubuntu-2204:2022.10.2
parameters:
version:
type: string
steps:
- checkout

- attach_workspace:
at: /tmp/workspace

- run:
command: |
docker load -i /tmp/workspace/docker/image.tar
docker load -i /tmp/workspace/docker/image_fs<< parameters.version >>.tar
- run:
name: print version
command: |
docker run -ti --rm --read-only \
-v /tmp/workspace/license/license.txt:/license.txt \
-v /tmp/workspace/license_fs<< parameters.version >>/license.txt:/license.txt \
-v /tmp/workspace/ds114_test1:/bids_dataset \
--tmpfs /tmp --tmpfs /var/tmp \
-v $PWD/ds114_test1:/bids_dataset \
bids/${CIRCLE_PROJECT_REPONAME} --version
bids/${CIRCLE_PROJECT_REPONAME}_fs<< parameters.version >> --version
- run:
name: print help
command: |
docker run -ti --rm --read-only \
-v /tmp/workspace/license/license.txt:/license.txt \
--tmpfs /tmp --tmpfs /var/tmp \
-v /tmp/workspace/license_fs<< parameters.version >>/license.txt:/license.txt \
-v /tmp/workspace/data/ds114_test1:/bids_dataset \
bids/${CIRCLE_PROJECT_REPONAME} -h
--tmpfs /tmp --tmpfs /var/tmp \
bids/${CIRCLE_PROJECT_REPONAME}_fs<< parameters.version >> -h
- run: mkdir -p ${HOME}/outputs1 ${HOME}/outputs2

- run:
name: test 1
command: |
docker run -ti --rm --read-only \
-v /tmp/workspace/license/license.txt:/license.txt \
--tmpfs /tmp --tmpfs /var/tmp \
-v /tmp/workspace/license_fs<< parameters.version >>/license.txt:/license.txt \
-v /tmp/workspace/data/ds114_test1:/bids_dataset \
-v ${HOME}/outputs1:/outputs bids/${CIRCLE_PROJECT_REPONAME} \
/bids_dataset /outputs participant \
--participant_label 01 \
--license_file=/license.txt --stages autorecon1
-v ${HOME}/outputs1:/outputs \
--tmpfs /tmp --tmpfs /var/tmp \
bids/${CIRCLE_PROJECT_REPONAME}_fs<< parameters.version >> \
/bids_dataset \
/outputs \
participant \
--participant_label 01 \
--license_file=/license.txt \
--stages autorecon1
cat ${HOME}/outputs1/sub-01/scripts/recon-all.done
no_output_timeout: 6h
- run:
name: test 2
command: |
docker run -ti --rm --read-only \
-v /tmp/workspace/license/license.txt:/license.txt \
--tmpfs /tmp --tmpfs /var/tmp \
-v /tmp/workspace/license_fs<< parameters.version >>/license.txt:/license.txt \
-v /tmp/workspace/data/ds114_test2:/bids_dataset \
-v ${HOME}/outputs2:/outputs \
bids/${CIRCLE_PROJECT_REPONAME} \
--tmpfs /tmp --tmpfs /var/tmp \
bids/${CIRCLE_PROJECT_REPONAME}_fs<< parameters.version >> \
/bids_dataset \
/outputs \
participant \
Expand All @@ -115,41 +139,41 @@ jobs:
--stages autorecon1
cat ${HOME}/outputs2/sub-01_ses-test/scripts/recon-all.done
no_output_timeout: 6h
- run:
name: group2 test 1
command: |
docker run -ti --rm --read-only \
-v /tmp/workspace/license/license.txt:/license.txt \
--tmpfs /tmp --tmpfs /var/tmp \
-v /tmp/workspace/license_fs<< parameters.version >>/license.txt:/license.txt \
-v /tmp/workspace/data/ds114_test1:/bids_dataset \
-v /tmp/workspace/data/ds114_test1_freesurfer_precomp_v6.0.0:/outputs \
bids/${CIRCLE_PROJECT_REPONAME} \
--tmpfs /tmp --tmpfs /var/tmp \
bids/${CIRCLE_PROJECT_REPONAME}_fs<< parameters.version >> \
/bids_dataset \
/outputs \
group2 \
--license_file=/license.txt
mkdir -p ${HOME}/outputs1/
sudo mv ${HOME}/data/ds114_test1_freesurfer_precomp_v6.0.0/00_group* ${HOME}/outputs1/
cat ${HOME}/outputs1/00_group2_stats_tables/lh.aparc.thickness.tsv
cat ${HOME}/outputs1/00_group2_stats_tables/euler.tsv
no_output_timeout: 6h
--license_file=/license.txt
sudo mv /tmp/workspace/data/ds114_test1_freesurfer_precomp_v6.0.0/00_group* ${HOME}/outputs1/
cat ${HOME}/outputs1/00_group2_stats_tables/lh.aparc.thickness.tsv
cat ${HOME}/outputs1/00_group2_stats_tables/euler.tsv
- run:
name: group2 test 2
command: |
docker run -ti --rm --read-only \
-v ~/license/license.txt:/license.txt --tmpfs /tmp --tmpfs /var/tmp \
-v /tmp/workspace/license_fs<< parameters.version >>/license.txt:/license.txt \
-v /tmp/workspace/data/ds114_test2:/bids_dataset \
-v /tmp/workspace/data/ds114_test2_freesurfer_precomp_v6.0.0:/outputs \
bids/${CIRCLE_PROJECT_REPONAME} \
--tmpfs /tmp --tmpfs /var/tmp \
bids/${CIRCLE_PROJECT_REPONAME}_fs<< parameters.version >> \
/bids_dataset /outputs group2 \
--license_file=/license.txt
mkdir -p ${HOME}/outputs2/
sudo mv ${HOME}/data/ds114_test2_freesurfer_precomp_v6.0.0/00_group* ${HOME}/outputs2/
cat ${HOME}/outputs2/00_group2_stats_tables/lh.aparc.thickness.tsv
cat ${HOME}/outputs2/00_group2_stats_tables/euler.tsv
no_output_timeout: 6h
sudo mv /tmp/workspace/data/ds114_test2_freesurfer_precomp_v6.0.0/00_group* ${HOME}/outputs2/
cat ${HOME}/outputs2/00_group2_stats_tables/lh.aparc.thickness.tsv
cat ${HOME}/outputs2/00_group2_stats_tables/euler.tsv
- store_artifacts:
path: ~/outputs1
- store_artifacts:
Expand All @@ -158,44 +182,84 @@ jobs:
deploy:
machine:
image: ubuntu-2204:2022.10.2
parameters:
version:
type: string
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
command: |
docker load -i /tmp/workspace/docker/image.tar
docker load -i /tmp/workspace/docker/image_fs<< parameters.version >>.tar
- run:
command: |
wget https://raw.githubusercontent.com/bids-apps/maintenance-tools/main/circleci/push_docker.sh
bash push_docker.sh
no_output_timeout: 6h
if [[ -n "${DOCKER_TOKEN}" ]]; then
# make sure we have a lowercase repo
user_name="bids"
repo_name=$(echo "${CIRCLE_PROJECT_REPONAME}_fs<< parameters.version >>" | tr '[:upper:]' '[:lower:]')
if [[ -n "${DOCKER_TOKEN}" ]]; then
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_USER}" --password-stdin
: "Pushing to DockerHub ${user_name}/${repo_name}:unstable"
docker tag "${user_name}/${repo_name}" "${user_name}/${repo_name}:unstable"
docker push "${user_name}/${repo_name}:unstable"
if [[ -n "${CIRCLE_TAG}" ]]; then
: "Pushing to DockerHub ${user_name}/${repo_name}:${CIRCLE_TAG}"
docker push "${user_name}/${repo_name}:latest"
docker tag "${user_name}/${repo_name}" "${user_name}/${repo_name}:${CIRCLE_TAG}"
docker push "${user_name}/${repo_name}:${CIRCLE_TAG}"
fi
fi
else
: "No DOCKER_TOKEN, skipping push to DockerHub"
exit 1
fi
workflows:
build_test_deploy:
jobs:

- get_data:
filters:
tags:
only: /.*/
branches:
only: /.*/

- build:
name: build_<< matrix.version >>
matrix:
parameters:
version: ['6', '7']
filters:
tags:
only: /.*/
branches:
only: /.*/

- test:
matrix:
parameters:
version: ['6', '7']
requires:
- build
- build_<< matrix.version >>
- get_data
filters:
tags:
only: /.*/
branches:
only: /.*/

- deploy:
matrix:
parameters:
version: ['6', '7']
context:
- dockerhub
requires:
Expand Down
Loading

0 comments on commit 4663559

Please sign in to comment.