Skip to content

Commit

Permalink
MAINT: Unify handling of env vars (mne-tools#8849)
Browse files Browse the repository at this point in the history
* MAINT: Unify handling of env vars [circle front]

* FIX: Try again [circle full]

* FIX: Try again [circle front]

* FIX: Again [circle front]

* FIX: Minimal [circle front]

* STY: Cleaner [circle front]
  • Loading branch information
larsoner authored Feb 9, 2021
1 parent d8ce897 commit 6a7d660
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 47 deletions.
5 changes: 2 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ jobs:
echo "set -e" >> $BASH_ENV
echo "export DISPLAY=:99" >> $BASH_ENV
echo "export OPENBLAS_NUM_THREADS=4" >> $BASH_ENV
echo "export XDG_RUNTIME_DIR=/tmp/runtime-circleci" >> $BASH_ENV
echo "export XDG_RUNTIME_DIR=/tmp/runtime-circleci" >> $BASH_ENV
source tools/get_minimal_commands.sh
echo "source ${PWD}/tools/get_minimal_commands.sh" >> $BASH_ENV
echo "export MNE_3D_BACKEND=pyvista" >> $BASH_ENV
echo "export PATH=~/.local/bin/:${MNE_ROOT}/bin:$PATH" >> $BASH_ENV
echo "export PATH=~/.local/bin/:$PATH" >> $BASH_ENV
echo "BASH_ENV:"
cat $BASH_ENV
mkdir -p ~/mne_data
Expand Down
102 changes: 58 additions & 44 deletions tools/get_minimal_commands.sh
Original file line number Diff line number Diff line change
@@ -1,50 +1,64 @@
#!/bin/bash -ef

if [ "${DEPS}" != "minimal" ]; then
pushd ~ > /dev/null
export MNE_ROOT="${PWD}/minimal_cmds"
export PATH=${MNE_ROOT}/bin:$PATH
if [ "${DEPS}" == "minimal" ]; then
return 0 2>/dev/null || exit "0"
fi;

pushd ~ > /dev/null
export MNE_ROOT="${PWD}/minimal_cmds"
export PATH=${MNE_ROOT}/bin:$PATH
if [ "${GITHUB_ACTIONS}" == "true" ]; then
echo "MNE_ROOT=${MNE_ROOT}" >> $GITHUB_ENV;
echo "${MNE_ROOT}/bin" >> $GITHUB_PATH;
fi;
if [ "${AZURE_CI}" == "true" ]; then
echo "##vso[task.setvariable variable=MNE_ROOT]${MNE_ROOT}"
echo "##vso[task.setvariable variable=PATH]${PATH}";
fi;
if [ "${CIRCLECI}" == "true" ]; then
echo "export MNE_ROOT=${MNE_ROOT}" >> "$BASH_ENV";
echo "export PATH=${MNE_ROOT}/bin:$PATH" >> "$BASH_ENV";
fi;
if [ "${CI_OS_NAME}" != "osx" ]; then
if [ ! -d "${PWD}/minimal_cmds" ]; then
curl -L https://osf.io/g7dzs/download | tar xz
fi;
export LD_LIBRARY_PATH=${MNE_ROOT}/lib:$LD_LIBRARY_PATH
export NEUROMAG2FT_ROOT="${PWD}/minimal_cmds/bin"
export FREESURFER_HOME="${MNE_ROOT}"
if [ "${GITHUB_ACTIONS}" == "true" ]; then
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> "$GITHUB_ENV";
echo "NEUROMAG2FT_ROOT=${NEUROMAG2FT_ROOT}" >> "$GITHUB_ENV";
echo "FREESURFER_HOME=${FREESURFER_HOME}" >> "$GITHUB_ENV";
fi;
if [ "${AZURE_CI}" == "true" ]; then
echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]${LD_LIBRARY_PATH}"
echo "##vso[task.setvariable variable=NEUROMAG2FT_ROOT]${NEUROMAG2FT_ROOT}"
echo "##vso[task.setvariable variable=FREESURFER_HOME]${FREESURFER_HOME}"
fi;
if [ "${CIRCLECI}" == "true" ]; then
echo "export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> "$BASH_ENV";
echo "export NEUROMAG2FT_ROOT=${NEUROMAG2FT_ROOT}" >> "$BASH_ENV";
echo "export FREESURFER_HOME=${FREESURFER_HOME}" >> "$BASH_ENV";
fi;
else
if [ ! -d "${PWD}/minimal_cmds" ]; then
curl -L https://osf.io/rjcz4/download | tar xz
fi;
export DYLD_LIBRARY_PATH=${MNE_ROOT}/lib:$DYLD_LIBRARY_PATH
if [ "${GITHUB_ACTIONS}" == "true" ]; then
echo "MNE_ROOT=${MNE_ROOT}" >> $GITHUB_ENV;
echo "${MNE_ROOT}/bin" >> $GITHUB_PATH;
echo "DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}" >> "$GITHUB_ENV";
wget https://dl.bintray.com/xquartz/downloads/XQuartz-2.7.11.dmg
sudo hdiutil attach XQuartz-2.7.11.dmg
sudo installer -package /Volumes/XQuartz-2.7.11/XQuartz.pkg -target /
sudo ln -s /opt/X11 /usr/X11
fi;
if [ "${AZURE_CI}" == "true" ]; then
echo "##vso[task.setvariable variable=MNE_ROOT]${MNE_ROOT}"
echo "##vso[task.setvariable variable=PATH]${PATH}";
fi;
if [ "${CI_OS_NAME}" != "osx" ]; then
if [ ! -d "${PWD}/minimal_cmds" ]; then
curl -L https://osf.io/g7dzs/download | tar xz
fi;
export LD_LIBRARY_PATH=${MNE_ROOT}/lib:$LD_LIBRARY_PATH
export NEUROMAG2FT_ROOT="${PWD}/minimal_cmds/bin"
export FREESURFER_HOME="${MNE_ROOT}"
if [ "${GITHUB_ACTIONS}" == "true" ]; then
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV;
echo "NEUROMAG2FT_ROOT=${NEUROMAG2FT_ROOT}" >> $GITHUB_ENV;
echo "FREESURFER_HOME=${FREESURFER_HOME}" >> $GITHUB_ENV;
fi;
if [ "${AZURE_CI}" == "true" ]; then
echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]${LD_LIBRARY_PATH}"
echo "##vso[task.setvariable variable=NEUROMAG2FT_ROOT]${NEUROMAG2FT_ROOT}"
echo "##vso[task.setvariable variable=FREESURFER_HOME]${FREESURFER_HOME}"
fi;
else
if [ ! -d "${PWD}/minimal_cmds" ]; then
curl -L https://osf.io/rjcz4/download | tar xz
fi;
export DYLD_LIBRARY_PATH=${MNE_ROOT}/lib:$DYLD_LIBRARY_PATH
if [ "${GITHUB_ACTIONS}" == "true" ]; then
echo "DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}" >> $GITHUB_ENV;
wget https://dl.bintray.com/xquartz/downloads/XQuartz-2.7.11.dmg
sudo hdiutil attach XQuartz-2.7.11.dmg
sudo installer -package /Volumes/XQuartz-2.7.11/XQuartz.pkg -target /
sudo ln -s /opt/X11 /usr/X11
fi;
if [ "${AZURE_CI}" == "true" ]; then
echo "##vso[task.setvariable variable=DYLD_LIBRARY_PATH]${DYLD_LIBRARY_PATH}"
fi;
fi
popd > /dev/null
mne_process_raw --version
echo "##vso[task.setvariable variable=DYLD_LIBRARY_PATH]${DYLD_LIBRARY_PATH}"
fi;
if [ "${CIRCLECI}" == "true" ]; then
echo "export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}" >> "$BASH_ENV";
fi;
fi
popd > /dev/null
mne_process_raw --version

0 comments on commit 6a7d660

Please sign in to comment.