From e4b9bea9df706b68af54afe0ec9ad7d5e80db64b Mon Sep 17 00:00:00 2001 From: Aljen Uitbeijerse Date: Thu, 25 Nov 2021 11:11:56 +0100 Subject: [PATCH] Try python as trigger script language --- .github/workflows/aa_unittest.yml | 6 ++-- .github/workflows/tools_install_b.sh | 2 ++ .github/workflows/trigger_install.py | 50 ++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/trigger_install.py diff --git a/.github/workflows/aa_unittest.yml b/.github/workflows/aa_unittest.yml index 74e2f4d3e..a40c49efa 100644 --- a/.github/workflows/aa_unittest.yml +++ b/.github/workflows/aa_unittest.yml @@ -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 diff --git a/.github/workflows/tools_install_b.sh b/.github/workflows/tools_install_b.sh index 410a13d4a..d86cad0de 100644 --- a/.github/workflows/tools_install_b.sh +++ b/.github/workflows/tools_install_b.sh @@ -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 "tibor.auer@gmail.com\n7061\n *Ccpi6x7PAIeQ\n FS96pPK5vW.0g" $TEMPLATEDIR fi + +whatwhat \ No newline at end of file diff --git a/.github/workflows/trigger_install.py b/.github/workflows/trigger_install.py new file mode 100644 index 000000000..d2abcc3e3 --- /dev/null +++ b/.github/workflows/trigger_install.py @@ -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() \ No newline at end of file