From 4e341eb451150ec2da0cc3e0889328213c43348d Mon Sep 17 00:00:00 2001 From: Althea Denlinger Date: Fri, 2 May 2025 15:31:57 -0500 Subject: [PATCH 1/3] Switch build workflow to micromamba --- .github/workflows/build_workflow.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_workflow.yml b/.github/workflows/build_workflow.yml index 74218ba811..7593331504 100644 --- a/.github/workflows/build_workflow.yml +++ b/.github/workflows/build_workflow.yml @@ -74,15 +74,17 @@ jobs: - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} name: Set up Conda Environment - uses: conda-incubator/setup-miniconda@v3 + uses: mamba-org/setup-micromamba@v2 with: - activate-environment: "compass_ci" - miniforge-version: latest - channels: conda-forge,e3sm/label/compass - channel-priority: strict - use-mamba: false - auto-update-conda: true - python-version: ${{ matrix.python-version }} + environment-name: compass_test + init-shell: bash + condarc: | + channel_priority: strict + channels: + - conda-forge + - e3sm/label/compass + create-args: >- + python=${{ matrix.python-version }} - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} name: Install compass From 42b95e86dd71120da5c52fdb54dad3b1616e67d0 Mon Sep 17 00:00:00 2001 From: Althea Denlinger Date: Fri, 2 May 2025 15:45:32 -0500 Subject: [PATCH 2/3] Update conda.shared to use conda base --- conda/shared.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/conda/shared.py b/conda/shared.py index 702794ec13..27de88ce82 100644 --- a/conda/shared.py +++ b/conda/shared.py @@ -95,19 +95,19 @@ def get_conda_base(conda_base, config, shared=False, warn=False): if shared: conda_base = config.get('paths', 'compass_envs') elif conda_base is None: - if 'CONDA_EXE' in os.environ: - # if this is a test, assume we're the same base as the - # environment currently active - conda_exe = os.environ['CONDA_EXE'] - conda_base = os.path.abspath( - os.path.join(conda_exe, '..', '..')) + try: + conda_base = subprocess.check_output( + ['conda', 'info', '--base'], text=True + ).strip() if warn: print(f'\nWarning: --conda path not supplied. Using conda ' f'installed at:\n' f' {conda_base}\n') - else: - raise ValueError('No conda base provided with --conda and ' - 'none could be inferred.') + except subprocess.CalledProcessError as e: + raise ValueError( + 'No conda base provided with --conda and ' + 'none could be inferred.' + ) from e # handle "~" in the path conda_base = os.path.abspath(os.path.expanduser(conda_base)) return conda_base From e15406320f2a4b272caf4d0e27b261315a24a05b Mon Sep 17 00:00:00 2001 From: Althea Denlinger Date: Fri, 2 May 2025 16:08:17 -0500 Subject: [PATCH 3/3] Switch docs workflow to micromamba --- .github/workflows/docs_workflow.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docs_workflow.yml b/.github/workflows/docs_workflow.yml index dda8d900a3..20e4388f35 100644 --- a/.github/workflows/docs_workflow.yml +++ b/.github/workflows/docs_workflow.yml @@ -27,15 +27,17 @@ jobs: - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} name: Set up Conda Environment - uses: conda-incubator/setup-miniconda@v3 + uses: mamba-org/setup-micromamba@v2 with: - activate-environment: "compass_ci" - miniforge-version: latest - channels: conda-forge,e3sm/label/compass - channel-priority: strict - use-mamba: false - auto-update-conda: true - python-version: ${{ env.PYTHON_VERSION }} + environment-name: compass_test + init-shell: bash + condarc: | + channel_priority: strict + channels: + - conda-forge + - e3sm/label/compass + create-args: >- + python=${{ env.PYTHON_VERSION }} - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} name: Install compass