[CI]: Improve CI #318

Merged
synchon merged 15 commits from chore/fix-ci into main 2024-06-21 08:59:42 +00:00
10 changed files with 41 additions and 24 deletions

View file

@ -66,36 +66,43 @@ jobs:
sudo tcsh @update.afni.binaries -package linux_ubuntu_16_64 -bindir /afni
echo "/afni" >> $GITHUB_PATH
if: matrix.python-version == 3.11
# Bypass AFNI installation failure
continue-on-error: true
- name: Check AFNI
run: |
echo "Using AFNI : $(afni --version)"
if: matrix.python-version == 3.11
# Bypass AFNI installation failure
continue-on-error: true
- name: Install ANTs
run: |
sudo apt-get install -y -qq unzip
curl -fsSL -o ants.zip https://github.com/ANTsX/ANTs/releases/download/v2.5.1/ants-2.5.1-ubuntu-22.04-X64-gcc.zip
curl -fsSL -o ants.zip https://github.com/ANTsX/ANTs/releases/download/v2.5.2/ants-2.5.2-ubuntu-22.04-X64-gcc.zip
unzip ants.zip -d /opt
mv /opt/ants-2.5.1/bin/* /opt/ants-2.5.1
mv /opt/ants-2.5.2/bin/* /opt/ants-2.5.2
rm ants.zip
echo "/opt/ants-2.5.1" >> $GITHUB_PATH
echo "/opt/ants-2.5.2" >> $GITHUB_PATH
if: matrix.python-version == 3.11
# Bypass ANTs installation failure
continue-on-error: true
- name: Check ANTs
run: |
echo "Using ANTs : $(antsRegistration --version)"
if: matrix.python-version == 3.11
# Bypass ANTs installation failure
continue-on-error: true
- name: Install FSL
run: |
sudo apt-get install -y -qq python3
curl -fsSL https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/releases/fslinstaller.py | python3 - -d /opt/fsl-6.0.6.4 -V 6.0.6.4
curl -fsSL https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/releases/fslinstaller.py | python - -d /opt/fsl/
FSLOUTPUTTYPE="NIFTI_GZ"
FSLMULTIFILEQUIT="TRUE"
FSLTCLSH="/opt/fsl-6.0.6.4/bin/fsltclsh"
FSLWISH="/opt/fsl-6.0.6.4/bin/fslwish"
FSLTCLSH="/opt/fsl/bin/fsltclsh"
FSLWISH="/opt/fsl/bin/fslwish"
FSLLOCKDIR=""
FSLMACHINELIST=""
FSLREMOTECALL=""
FSLGECUDAQ="cuda.q"
echo "/opt/fsl-6.0.6.4" >> $GITHUB_PATH
echo "/opt/fsl" >> $GITHUB_PATH
if: matrix.python-version == 3.11
# Bypass FSL installation failure
continue-on-error: true

View file

@ -0,0 +1 @@
Improve CI to allow external tool installation to fail gracefully and update necessary dependency version and conditional checks by `Synchon Mandal`_

View file

@ -4,6 +4,7 @@
# License: AGPL
import platform as pl
import sys
import pytest
@ -49,8 +50,7 @@ def test_get_dependency_information_short() -> None:
"looseversion",
]
python_minor_version = int(pl.python_version_tuple()[1])
if python_minor_version < 10:
if sys.version_info < (3, 11):
dependency_list.append("importlib_metadata")
assert frozenset(dependency_information.keys()) == frozenset(

View file

@ -3,10 +3,13 @@
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
# License: AGPL
try:
from importlib.metadata import packages_distributions
except ImportError: # pragma: no cover
import sys
if sys.version_info < (3, 11): # pragma: no cover
from importlib_metadata import packages_distributions
else:
from importlib.metadata import packages_distributions
import uuid
from copy import deepcopy

View file

@ -124,7 +124,7 @@ class AFNIALFF:
convert_alff_cmd = [
"3dAFNItoNIFTI",
f"-prefix {alff_afni_to_nifti_out_path.resolve()}",
f"{alff_falff_out_path_prefix}_ALFF+tlrc.BRIK",
f"{alff_falff_out_path_prefix}_ALFF+orig.BRIK",
]
# Call 3dAFNItoNIFTI
run_ext_cmd(name="3dAFNItoNIFTI", cmd=convert_alff_cmd)
@ -136,7 +136,7 @@ class AFNIALFF:
convert_falff_cmd = [
"3dAFNItoNIFTI",
f"-prefix {falff_afni_to_nifti_out_path.resolve()}",
f"{alff_falff_out_path_prefix}_fALFF+tlrc.BRIK",
f"{alff_falff_out_path_prefix}_fALFF+orig.BRIK",
]
# Call 3dAFNItoNIFTI
run_ext_cmd(name="3dAFNItoNIFTI", cmd=convert_falff_cmd)

View file

@ -181,7 +181,7 @@ class AFNIReHo:
convert_cmd = [
"3dAFNItoNIFTI",
f"-prefix {reho_afni_to_nifti_out_path.resolve()}",
f"{reho_out_path_prefix}+tlrc.BRIK",
f"{reho_out_path_prefix}+orig.BRIK",
]
# Call 3dAFNItoNIFTI
run_ext_cmd(name="3dAFNItoNIFTI", cmd=convert_cmd)

View file

@ -4,10 +4,14 @@
# Synchon Mandal <s.mandal@fz-juelich.de>
# License: AGPL
try:
from importlib.metadata import packages_distributions
except ImportError: # pragma: no cover
import sys
if sys.version_info < (3, 11): # pragma: no cover
from importlib_metadata import packages_distributions
else:
from importlib.metadata import packages_distributions
from importlib.util import find_spec
from itertools import chain

View file

@ -105,7 +105,7 @@ class AFNISmoothing:
convert_cmd = [
"3dAFNItoNIFTI",
f"-prefix {blur_afni_to_nifti_out_path.resolve()}",
f"{blur_out_path_prefix}+tlrc.BRIK",
f"{blur_out_path_prefix}+orig.BRIK",
]
# Call 3dAFNItoNIFTI
run_ext_cmd(name="3dAFNItoNIFTI", cmd=convert_cmd)

View file

@ -4,13 +4,15 @@
# Synchon Mandal <s.mandal@fz-juelich.de>
# License: AGPL
try:
import sys
if sys.version_info < (3, 12):
from distutils.version import LooseVersion
except ImportError: # pragma: no cover
else: # pragma: no cover
from looseversion import LooseVersion
import logging
import sys
from pathlib import Path
from subprocess import PIPE, Popen, TimeoutExpired
from typing import Dict, NoReturn, Optional, Type, Union

View file

@ -50,7 +50,7 @@ dependencies = [
"tqdm==4.66.1",
"templateflow>=23.0.0",
"lapy>=1.0.0,<2.0.0",
"importlib_metadata; python_version<'3.10'",
"importlib_metadata; python_version<'3.9'",
"looseversion==1.3.0; python_version>='3.12'",
]
dynamic = ["version"]