Skip to content

Commit

Permalink
Merge pull request #2701 from jsiirola/conda-mamba-solver
Browse files Browse the repository at this point in the history
Improve GHA conda setup performance
  • Loading branch information
jsiirola authored Jan 20, 2023
2 parents 1bce491 + 64b0e48 commit 517060e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 14 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/test_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ jobs:
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
channels: conda-forge
channels: conda-forge,gurobi,ibmdecisionoptimization,fico-xpress
channel-priority: strict

# GitHub actions is very fragile when it comes to setting up various
Expand Down Expand Up @@ -269,10 +269,19 @@ jobs:
- name: Install Python packages (conda)
if: matrix.PYENV == 'conda'
run: |
# Set up environment
mkdir -p $GITHUB_WORKSPACE/cache/conda
conda config --set always_yes yes
conda config --set auto_update_conda false
conda config --prepend pkgs_dirs $GITHUB_WORKSPACE/cache/conda
# Try to install mamba
conda install -q -y -n base conda-libmamba-solver || MAMBA_FAILED=1
if test -z "$MAMBA_FAILED"; then
echo "*** Activating the mamba environment solver ***"
conda config --set solver libmamba
fi
# Print environment info
echo "*** CONDA environment: ***"
conda info
conda config --show-sources
conda config --show channels
Expand Down Expand Up @@ -303,17 +312,21 @@ jobs:
CONDA_DEPENDENCIES="$CONDA_DEPENDENCIES $PKG"
fi
done
conda install -q -y -c conda-forge $CONDA_DEPENDENCIES
echo "*** Install Pyomo dependencies ***"
conda install -q -y $CONDA_DEPENDENCIES
if test -z "${{matrix.slim}}"; then
conda install -q -y -c ibmdecisionoptimization \
'cplex>=12.10' docplex \
echo "*** Install CPLEX ***"
conda install -q -y 'cplex>=12.10' docplex \
|| echo "WARNING: CPLEX Community Edition is not available"
conda install -q -y -c gurobi gurobi \
echo "*** Install Gurobi ***"
conda install -q -y gurobi \
|| echo "WARNING: Gurobi is not available"
conda install -q -y -c fico-xpress xpress \
echo "*** Install Xpress ***"
conda install -q -y xpress \
|| echo "WARNING: Xpress Community Edition is not available"
for PKG in cyipopt pymumps scip; do
conda install -q -y -c conda-forge $PKG \
echo "*** Install $PKG ***"
conda install -q -y $PKG \
|| echo "WARNING: $PKG is not available"
done
# TODO: This is a hack to stop test_qt.py from running until we
Expand Down
27 changes: 20 additions & 7 deletions .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ jobs:
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
channels: conda-forge
channels: conda-forge,gurobi,ibmdecisionoptimization,fico-xpress
channel-priority: strict

# GitHub actions is very fragile when it comes to setting up various
Expand Down Expand Up @@ -290,10 +290,19 @@ jobs:
- name: Install Python packages (conda)
if: matrix.PYENV == 'conda'
run: |
# Set up environment
mkdir -p $GITHUB_WORKSPACE/cache/conda
conda config --set always_yes yes
conda config --set auto_update_conda false
conda config --prepend pkgs_dirs $GITHUB_WORKSPACE/cache/conda
# Try to install mamba
conda install -q -y -n base conda-libmamba-solver || MAMBA_FAILED=1
if test -z "$MAMBA_FAILED"; then
echo "*** Activating the mamba environment solver ***"
conda config --set solver libmamba
fi
# Print environment info
echo "*** CONDA environment: ***"
conda info
conda config --show-sources
conda config --show channels
Expand Down Expand Up @@ -324,17 +333,21 @@ jobs:
CONDA_DEPENDENCIES="$CONDA_DEPENDENCIES $PKG"
fi
done
conda install -q -y -c conda-forge $CONDA_DEPENDENCIES
echo "*** Install Pyomo dependencies ***"
conda install -q -y $CONDA_DEPENDENCIES
if test -z "${{matrix.slim}}"; then
conda install -q -y -c ibmdecisionoptimization \
'cplex>=12.10' docplex \
echo "*** Install CPLEX ***"
conda install -q -y 'cplex>=12.10' docplex \
|| echo "WARNING: CPLEX Community Edition is not available"
conda install -q -y -c gurobi gurobi \
echo "*** Install Gurobi ***"
conda install -q -y gurobi \
|| echo "WARNING: Gurobi is not available"
conda install -q -y -c fico-xpress xpress \
echo "*** Install Xpress ***"
conda install -q -y xpress \
|| echo "WARNING: Xpress Community Edition is not available"
for PKG in cyipopt pymumps scip; do
conda install -q -y -c conda-forge $PKG \
echo "*** Install $PKG ***"
conda install -q -y $PKG \
|| echo "WARNING: $PKG is not available"
done
# TODO: This is a hack to stop test_qt.py from running until we
Expand Down

0 comments on commit 517060e

Please sign in to comment.