diff --git a/.github/workflows/unix_impl.yml b/.github/workflows/unix_impl.yml index 7d04dde8e3..2d92006789 100644 --- a/.github/workflows/unix_impl.yml +++ b/.github/workflows/unix_impl.yml @@ -192,3 +192,49 @@ jobs: cd micromamba/test-server ./generate_gpg_keys.sh ./testserver_pkg_signing.sh + + mamba_conda_root_prefix_tests: + name: mamba-conda-root-prefix tests + runs-on: ${{ inputs.os }} + if: startsWith(inputs.os, 'ubuntu') + steps: + - name: Checkout mamba repository + uses: actions/checkout@v4 + - name: Create environment with conda + uses: mamba-org/setup-micromamba@v1 + with: + environment-name: conda_env + create-args: >- + conda + - name: Create conda environment containing mamba + shell: bash -l {0} -euo pipefail -x + run: | + # Get a recent version of mamba to have it tested (mamba 2.x) + conda create -n mamba_in_conda_env mamba=2.0.0rc5 -c conda-forge/label/mamba_dev -y + - name: Run tests using conda and a nested mamba + shell: bash -l {0} -euo pipefail -x + run: | + conda info + source "$(conda info --base)/etc/profile.d/conda.sh" # Initialize Conda + conda activate mamba_in_conda_env + # Testing with conda and mamba having the same root prefix + export MAMBA_ROOT_PREFIX="$(conda info --base)" + mamba create -n mamba_env_test xtensor -c conda-forge -y + mamba env list | grep mamba_env_test || { echo "mamba_env_test not found in env list"; exit 1; } + mamba info | grep "base environment" | grep "$(conda info --base)" || { echo "Expected base environment path not found in mamba info"; exit 1; } + mamba list -n mamba_env_test | grep xtensor || { echo "xtensor not found in mamba_env_test"; exit 1; } + eval "$(mamba shell hook --shell bash)" + mamba activate + # Since no target prefix has been specified, we should fall back on the root prefix + mamba info | grep "environment" | grep "base (active)" || { echo "Expected base environment not active"; exit 1; } + mamba info | grep "env location" | grep "$(conda info --base)" || { echo "Expected environment not active"; exit 1; } + # Activate another env - specified + mamba activate -n mamba_env_test + mamba info | grep "environment" | grep "mamba_env_test (active)" || { echo "Expected mamba_env_test environment not active"; exit 1; } + # Get back to use conda without changing the environment + conda info | grep "shell level" | grep "2" || { echo "Expected conda shell level = 2"; exit 1; } + conda info | grep "active environment" | grep "mamba_env_test" || { echo "Expected conda environment not active"; exit 1; } + # Activate another environment using conda + conda activate mamba_in_conda_env + conda info | grep "shell level" | grep "3" || { echo "Expected conda shell level = 3"; exit 1; } + conda info | grep "active environment" | grep "mamba_in_conda_env" || { echo "Expected nested conda environment not active"; exit 1; }