diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index ea91efa..baac645 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -13,7 +13,10 @@ jobs: fail-fast: false matrix: python-version: [3.12] - platform: [ubuntu-24.04] + platform: + - ubuntu-24.04 + - macos-14 # macOS ARM (M1/M2/M3/M4) + - macos-15-intel # macOS x86_64 runs-on: ${{ matrix.platform }} steps: @@ -21,17 +24,9 @@ jobs: - name: Test suite run: | - wget https://repo.anaconda.com/miniconda/Miniconda3-py312_24.9.2-0-Linux-x86_64.sh -O miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda - source $HOME/miniconda/etc/profile.d/conda.sh - - echo - echo "************************************" - echo ----------Conda Installed----------- - echo "************************************" - echo - - source setup.sh + # Use setup.sh to handle architecture detection automatically + # Provide input to auto-select Yes for conda installation if needed + source setup.sh <<< "1" echo echo "************************************" @@ -39,4 +34,5 @@ jobs: echo "************************************" echo - PYTEST_ADDOPTS=--color=yes HYPOTHESIS_PROFILE=travis-ci python -m pytest -v + PYTEST_ADDOPTS=--color=yes HYPOTHESIS_PROFILE=travis-ci \ + conda run -n MULE-3.12-10-24 python -m pytest -v diff --git a/setup.sh b/setup.sh index 9b264ad..19e97d6 100644 --- a/setup.sh +++ b/setup.sh @@ -17,8 +17,21 @@ function install_conda { exit 1;; esac - echo Installing conda for $CONDA_OS # This doesn't currently understand/recognise arm based architectures. Fix! - CONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-py${PYTHON_VERSION//.}_24.9.2-0-${CONDA_OS}-x86_64.sh" + # Setting architecture based on input + CONDA_ARCH=$(uname -m) + + case $CONDA_ARCH in + x86_64) : ;; + arm64) : ;; + aarch64) : ;; + *) + echo "Installation only supported on x86_64 and arm architectures" + exit 1 + ;; + esac + + echo Installing conda for $CONDA_OS on $CONDA_ARCH architecture + CONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-py${PYTHON_VERSION//.}_24.9.2-0-${CONDA_OS}-${CONDA_ARCH}.sh" if which wget; then wget ${CONDA_URL} -O miniconda.sh else @@ -26,9 +39,11 @@ function install_conda { fi bash miniconda.sh -b -p $HOME/miniconda CONDA_SH=$HOME/miniconda/etc/profile.d/conda.sh - source $CONDA_SH - echo Activated conda by sourcing $CONDA_SH -} + source $CONDA_SH + eval "$(conda shell.bash hook)" + conda init bash >/dev/null 2>&1 || true + echo Activated conda by sourcing $CONDA_SH +} @@ -52,6 +67,14 @@ echo "Identified directory: $MULE_DIR" if conda --version ; then echo Initialising Conda... + CONDA_BASE=$(conda info --base 2>/dev/null) + if [ -n "$CONDA_BASE" ] && [ -f "$CONDA_BASE/etc/profile.d/conda.sh" ]; then + source "$CONDA_BASE/etc/profile.d/conda.sh" + eval "$(conda shell.bash hook)" + conda init bash >/dev/null 2>&1 || true + else + conda init bash >/dev/null 2>&1 || true + fi else echo "No Conda installation detected, installing conda." echo 'Download conda? Select [1/2]:' @@ -67,11 +90,14 @@ fi if ! (conda env list | grep ${MULE_ENV_NAME}) >> /dev/null then echo "Couldn't find environment, creating environment..." - conda env create -f MULE_environment.yml python=$PYTHON_VERSION + conda env create -f MULE_environment.yml fi echo "Activating environment..." -conda activate ${MULE_ENV_NAME} - -cd ${MULE_DIR} +if [ -n "$CI" ]; then + echo "CI detected, skipping conda activate. Use 'conda run -n ${MULE_ENV_NAME} ...'" +else + conda activate ${MULE_ENV_NAME} +fi +cd ${MULE_DIR} \ No newline at end of file