Skip to content

Commit

Permalink
Try python as trigger script language
Browse files Browse the repository at this point in the history
  • Loading branch information
AljenU committed Nov 25, 2021
1 parent c11d622 commit e4b9bea
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/aa_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ jobs:
release: R2020a

- name: Install tools and configure aa
uses: matlab-actions/run-command@v1
with:
command: addpath(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); trigger_install()
run: |
python trigger_install.py
working-directory: ${{github.workspace}}/.github/workflows
env:
LOAD_FSL: 0
LOAD_FREESURFER: 0
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tools_install_b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ 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

whatwhat
50 changes: 50 additions & 0 deletions .github/workflows/trigger_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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.

import sys
import subprocess
import platform

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")
#if status<0:
# # 0 if ok, non-zero if problem
# raise Exception('Problem while running tools_install')
#else:
# print(status)
# sys.stdout.flush()

subprocess.check_call('source $GITHUB_WORKSPACE/.github/workflows/tools_install_b.sh', shell=True, executable="/bin/bash")
#if status!=0:
# # 0 if ok, non-zero if problem
# raise Exception('Problem while running tools_install_b')
#else:
# print(status)
# sys.stdout.flush()

# Configure aa
subprocess.check_call('source $GITHUB_WORKSPACE/.github/workflows/configure_aa.sh', shell=True, executable="/bin/bash")
#if status!=0:
# # 0 if ok, non-zero if problem
# raise Exception('Problem while running configure_aa')
#else:
# print(status)
# sys.stdout.flush()

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

0 comments on commit e4b9bea

Please sign in to comment.