Skip to content

Commit 471d99a

Browse files
committed
Resetup miniconda or reinstall conda-build on failure in Conda package GH action
1 parent addd690 commit 471d99a

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/conda-package.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
fetch-depth: 0
5757

5858
- name: Setup miniconda
59+
id: setup_miniconda
5960
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
6061
with:
6162
miniforge-version: latest
@@ -65,9 +66,16 @@ jobs:
6566
python-version: ${{ env.CONDA_BUILD_INDEX_ENV_PY_VER}}
6667
activate-environment: 'build'
6768

68-
# Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
69-
- name: Disable speed limit check in mamba
70-
run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV
69+
- name: ReSetup miniconda
70+
if: steps.setup_miniconda.outcome == 'failure'
71+
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
72+
with:
73+
miniforge-version: latest
74+
use-mamba: 'true'
75+
channels: conda-forge
76+
conda-remove-defaults: 'true'
77+
python-version: ${{ matrix.python }}
78+
activate-environment: ${{ env.TEST_ENV_NAME }}
7179

7280
- name: Store conda paths as envs
7381
shell: bash -el {0}
@@ -76,6 +84,11 @@ jobs:
7684
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> $GITHUB_ENV
7785
7886
- name: Install conda-build
87+
id: install_conda_build
88+
run: mamba install conda-build=${{ env.CONDA_BUILD_VERSION}}
89+
90+
- name: ReInstall conda-build
91+
if: steps.install_conda_build.outcome == 'failure'
7992
run: mamba install conda-build=${{ env.CONDA_BUILD_VERSION}}
8093

8194
- name: Build conda package

0 commit comments

Comments
 (0)