Skip to content

Commit

Permalink
Adapt workflow install step to use a single platform independent wrapper
Browse files Browse the repository at this point in the history
Single-step install and configure, make parameter file name an env var
  • Loading branch information
AljenU committed Nov 25, 2021
1 parent 3618b72 commit 3cbd320
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 79 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/aa_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,14 @@ jobs:
# MATLAB release to set up R2020a
release: R2020a

- name: Install tools under $HOME/tools (SPM, FaceMasking)
- name: Install tools and configure aa
run: |
source $GITHUB_WORKSPACE/.github/workflows/tools_install.sh
python trigger_install.py
working-directory: ${{github.workspace}}/.github/workflows
env:
LOAD_FSL: 0
LOAD_FREESURFER: 0

- name: Configure aa
run: |
echo "Free space:"
df -h
mkdir $HOME/.aa
cp $GITHUB_WORKSPACE/.github/workflows/aap_parameters_defaults_GitHub.xml $HOME/.aa/aap_parameters_user.xml
mkdir $HOME/projects
PARAMETER_XML: aap_parameters_defaults_GitHub.xml

- name: Run script
uses: matlab-actions/run-command@v1
Expand Down
98 changes: 31 additions & 67 deletions .github/workflows/aa_use_case_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v2

Expand All @@ -59,12 +59,14 @@ jobs:
# MATLAB release to set up R2020a
release: R2020a

- name: Install tools under $HOME/tools (SPM, FaceMasking, FSL)
- name: Install tools and configure aa
run: |
source $GITHUB_WORKSPACE/.github/workflows/tools_install.sh
python trigger_install.py
working-directory: ${{github.workspace}}/.github/workflows
env:
LOAD_FSL: 1
LOAD_FREESURFER: 0
PARAMETER_XML: aap_parameters_defaults_GitHub.xml

- name: Retrive test data under $HOME/data/aa_demo
run: |
Expand All @@ -77,14 +79,6 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true

- name: Configure aa
run: |
echo "Free space:"
df -h
mkdir $HOME/.aa
cp $GITHUB_WORKSPACE/.github/workflows/aap_parameters_defaults_GitHub.xml $HOME/.aa/aap_parameters_user.xml
mkdir $HOME/projects
- name: Run script
uses: matlab-actions/run-command@v1
with:
Expand All @@ -96,7 +90,7 @@ jobs:
name: aatest_ds000114_AROMA
path: |
~/projects/
aatest_ds000114_dartel:
name: Testing SPM DARTEL

Expand All @@ -118,7 +112,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v2

Expand All @@ -136,12 +130,14 @@ jobs:
# MATLAB release to set up R2020a
release: R2020a

- name: Install tools under $HOME/tools (SPM, FaceMasking, FSL standards)
- name: Install tools and configure aa
run: |
source $GITHUB_WORKSPACE/.github/workflows/tools_install.sh
python trigger_install.py
working-directory: ${{github.workspace}}/.github/workflows
env:
LOAD_FSL: 0
LOAD_FREESURFER: 0
PARAMETER_XML: aap_parameters_defaults_GitHub.xml

- name: Retrive test data under $HOME/data/aa_demo
run: |
Expand All @@ -154,14 +150,6 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true

- name: Configure aa
run: |
echo "Free space:"
df -h
mkdir $HOME/.aa
cp $GITHUB_WORKSPACE/.github/workflows/aap_parameters_defaults_GitHub.xml $HOME/.aa/aap_parameters_user.xml
mkdir $HOME/projects
- name: Run script
uses: matlab-actions/run-command@v1
with:
Expand Down Expand Up @@ -195,7 +183,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v2

Expand All @@ -213,12 +201,14 @@ jobs:
# MATLAB release to set up R2020a
release: R2020a

- name: Install tools under $HOME/tools (SPM, FSL, FaceMasking)
- name: Install tools and configure aa
run: |
source $GITHUB_WORKSPACE/.github/workflows/tools_install.sh
python trigger_install.py
working-directory: ${{github.workspace}}/.github/workflows
env:
LOAD_FSL: 1
LOAD_FREESURFER: 0
PARAMETER_XML: aap_parameters_defaults_GitHub.xml

- name: Retrive test data under $HOME/data/aa_demo
run: |
Expand All @@ -231,14 +221,6 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true

- name: Configure aa
run: |
echo "Free space:"
df -h
mkdir $HOME/.aa
cp $GITHUB_WORKSPACE/.github/workflows/aap_parameters_defaults_GitHub.xml $HOME/.aa/aap_parameters_user.xml
mkdir $HOME/projects
- name: Run script
uses: matlab-actions/run-command@v1
with:
Expand Down Expand Up @@ -272,7 +254,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v2

Expand All @@ -290,12 +272,14 @@ jobs:
# MATLAB release to set up R2020a
release: R2020a

- name: Install tools under $HOME/tools (SPM, FaceMasking, FSL standards)
- name: Install tools and configure aa
run: |
source $GITHUB_WORKSPACE/.github/workflows/tools_install.sh
python trigger_install.py
working-directory: ${{github.workspace}}/.github/workflows
env:
LOAD_FSL: 0
LOAD_FREESURFER: 0
PARAMETER_XML: aap_parameters_defaults_GitHub.xml

- name: Retrive test data under $HOME/data/aa_demo
run: |
Expand All @@ -310,14 +294,6 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true

- name: Configure aa
run: |
echo "Free space:"
df -h
mkdir $HOME/.aa
cp $GITHUB_WORKSPACE/.github/workflows/aap_parameters_defaults_GitHub.xml $HOME/.aa/aap_parameters_user.xml
mkdir $HOME/projects
- name: Run script
uses: matlab-actions/run-command@v1
with:
Expand Down Expand Up @@ -351,7 +327,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v2

Expand All @@ -369,12 +345,14 @@ jobs:
# MATLAB release to set up R2020a
release: R2020a

- name: Install tools under $HOME/tools (SPM, FaceMasking, FSL standards)
- name: Install tools and configure aa
run: |
source $GITHUB_WORKSPACE/.github/workflows/tools_install.sh
python trigger_install.py
working-directory: ${{github.workspace}}/.github/workflows
env:
LOAD_FSL: 0
LOAD_FREESURFER: 0
PARAMETER_XML: aap_parameters_defaults_GitHub.xml

- name: Retrive test data under $HOME/data/aa_demo
run: |
Expand All @@ -390,14 +368,6 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true

- name: Configure aa
run: |
echo "Free space:"
df -h
mkdir $HOME/.aa
cp $GITHUB_WORKSPACE/.github/workflows/aap_parameters_defaults_GitHub.xml $HOME/.aa/aap_parameters_user.xml
mkdir $HOME/projects
- name: Run script
uses: matlab-actions/run-command@v1
with:
Expand Down Expand Up @@ -431,7 +401,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v2

Expand All @@ -449,12 +419,14 @@ jobs:
# MATLAB release to set up R2020a
release: R2020a

- name: Install tools under $HOME/tools (SPM, FSL, FreeSurfer, FaceMasking)
- name: Install tools and configure aa
run: |
source $GITHUB_WORKSPACE/.github/workflows/tools_install.sh
python trigger_install.py
working-directory: ${{github.workspace}}/.github/workflows
env:
LOAD_FSL: 1
LOAD_FREESURFER: 1
PARAMETER_XML: aap_parameters_defaults_GitHub.xml

- name: Retrive test data under $HOME/data/aa_demo
run: |
Expand All @@ -465,14 +437,6 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true

- name: Configure aa
run: |
echo "Free space:"
df -h
mkdir $HOME/.aa
cp $GITHUB_WORKSPACE/.github/workflows/aap_parameters_defaults_GitHub.xml $HOME/.aa/aap_parameters_user.xml
mkdir $HOME/projects
- name: Run script
uses: matlab-actions/run-command@v1
with:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/tools_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ python $TOOLDIR/get-pip.py --force-reinstall

# All MATLAB tools MUST be installed referred by the parameterset
source $GITHUB_WORKSPACE/.github/workflows/tools_urls.sh
source $GITHUB_WORKSPACE/aa_tools/toolboxes/installation_scripts/install_tools.sh $GITHUB_WORKSPACE/.github/workflows/aap_parameters_defaults_GitHub.xml $TOOLDIR
source $GITHUB_WORKSPACE/aa_tools/toolboxes/installation_scripts/install_tools.sh $GITHUB_WORKSPACE/.github/workflows/$PARAMETER_XML $TOOLDIR

echo "FSL: ${LOAD_FSL}; FREESURFER: ${LOAD_FREESURFER}"

Expand All @@ -22,4 +22,10 @@ fi

if [[ "x${LOAD_FREESURFER}x" == "x1x" ]]; then
source $GITHUB_WORKSPACE/aa_tools/toolboxes/installation_scripts/install_freesurfer.sh $TOOLDIR 7.2.0 centos7 "[email protected]\n7061\n *Ccpi6x7PAIeQ\n FS96pPK5vW.0g" $TEMPLATEDIR
fi
fi

echo "Free space:"
df -h
mkdir $HOME/.aa
cp $GITHUB_WORKSPACE/.github/workflows/$PARAMETER_XML $HOME/.aa/aap_parameters_user.xml
mkdir $HOME/projects
34 changes: 34 additions & 0 deletions .github/workflows/trigger_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Note: Assume Python 2.7, since that will have been installed for facemasking requirements.
#
# Using python (instead of matlab) because using system() in matlab gives enormous amount of
# command window output, and there is some problem with the status code from system()

import sys
import subprocess
import platform

def main():
do_install()

def do_install():
plt = platform.system()
if plt == "Windows":
print("Your system is Windows")
sys.stdout.flush()
# do x y z
elif plt == "Linux":
print("Your system is Linux")
sys.stdout.flush()
subprocess.check_call('source $GITHUB_WORKSPACE/.github/workflows/tools_install.sh', shell=True, executable="/bin/bash")

elif plt == "Darwin":
print("Your system is MacOS")
sys.stdout.flush()
# do x y z
else:
print("Unidentified system:")
print(plt)
sys.stdout.flush()

if __name__=="__main__":
main()

0 comments on commit 3cbd320

Please sign in to comment.