Skip to content

Commit 8521e97

Browse files
authored
Merge pull request #291 from altheaden/ci-switch-to-micromamba
Switch CI from miniconda to micromamba
2 parents 6b6f0ae + 9f0067d commit 8521e97

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

.github/workflows/build_workflow.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,17 @@ jobs:
8585

8686
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
8787
name: Set up Conda Environment
88-
uses: conda-incubator/setup-miniconda@v3
88+
uses: mamba-org/setup-micromamba@v2
8989
with:
90-
activate-environment: "polaris_ci"
91-
miniforge-version: latest
92-
channels: conda-forge,e3sm/label/polaris
93-
channel-priority: strict
94-
auto-update-conda: true
95-
python-version: ${{ matrix.python-version }}
90+
environment-name: polaris_test
91+
init-shell: bash
92+
condarc: |
93+
channel_priority: strict
94+
channels:
95+
- conda-forge
96+
- e3sm/label/polaris
97+
create-args: >-
98+
python=${{ matrix.python-version }}
9699
97100
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
98101
name: Install polaris

.github/workflows/docs_workflow.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@ jobs:
3535

3636
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
3737
name: Set up Conda Environment
38-
uses: conda-incubator/setup-miniconda@v3
38+
uses: mamba-org/setup-micromamba@v2
3939
with:
40-
activate-environment: "polaris_ci"
41-
miniforge-version: latest
42-
channels: conda-forge,e3sm/label/polaris
43-
channel-priority: strict
44-
auto-update-conda: true
45-
python-version: ${{ env.PYTHON_VERSION }}
40+
environment-name: polaris_test
41+
init-shell: bash
42+
condarc: |
43+
channel_priority: strict
44+
channels:
45+
- conda-forge
46+
- e3sm/label/polaris
47+
create-args: >-
48+
python=${{ env.PYTHON_VERSION }}
4649
4750
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
4851
name: Install polaris

deploy/shared.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,22 +201,21 @@ def get_conda_base(conda_base, config, shared=False, warn=False):
201201
if shared:
202202
conda_base = config.get('paths', 'polaris_envs')
203203
elif conda_base is None:
204-
if 'CONDA_EXE' in os.environ:
205-
# if this is a test, assume we're the same base as the
206-
# environment currently active
207-
conda_exe = os.environ['CONDA_EXE']
208-
conda_base = os.path.abspath(os.path.join(conda_exe, '..', '..'))
204+
try:
205+
conda_base = subprocess.check_output(
206+
['conda', 'info', '--base'], text=True
207+
).strip()
209208
if warn:
210209
print(
211210
f'\nWarning: --conda path not supplied. Using conda '
212211
f'installed at:\n'
213212
f' {conda_base}\n'
214213
)
215-
else:
214+
except subprocess.CalledProcessError as e:
216215
raise ValueError(
217216
'No conda base provided with --conda and '
218217
'none could be inferred.'
219-
)
218+
) from e
220219
# handle "~" in the path
221220
conda_base = os.path.abspath(os.path.expanduser(conda_base))
222221
return conda_base

0 commit comments

Comments
 (0)