Skip to content

Commit

Permalink
Helps if you touch the right file
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmundt committed Mar 4, 2025
1 parent a77b317 commit 2cc253c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
44 changes: 43 additions & 1 deletion .github/workflows/test_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,48 @@ jobs:
else
XPRESS='xpress'
fi
conda install -q -y 'cplex>=12.10' docplex gurobi "$XPRESS" cyipopt pymumps scip
PYVER=$(echo "py${{matrix.python}}" | sed 's/\.//g')
echo "Installing for $PYVER"
for PKG in 'cplex>=12.10' docplex gurobi "$XPRESS" cyipopt pymumps scip; do
echo ""
echo "*** Install $PKG ***"
echo ""
# conda can literally take an hour to determine that a
# package is not available. Perform a quick search to see
# if the package is available for this interpreter before
# attempting an install.
# NOTE: conda search will attempt approximate matches.
_PKGLIST=$(conda search -f "$PKG") || echo "Package $PKG not found"
echo "$_PKGLIST"
_BASE=$(echo "$PKG" | sed 's/[=<>].*//')
_BUILDS=$(echo "$_PKGLIST" | grep "^$_BASE " \
| sed -r 's/\s+/ /g' | cut -d\ -f3) || echo ""
if test -n "$_BUILDS"; then
_ISPY=$(echo "$_BUILDS" | grep "^py") \
|| echo "INFO: No python build detected."
_PYOK=$(echo "$_BUILDS" | grep -E "^($PYVER|pyh)") \
|| echo "INFO: No python build matching $PYVER detected."
if test -z "$_ISPY" -o -n "$_PYOK"; then
echo ""
echo "... INSTALLING $PKG"
# Because conda can occasionally hang
# indefinitely (lately while installing SCIP),
# we will run "conda install" in a subshell and
# kill it after 5-minutes.
(conda install -q -y $PKG) &
conda_pid=$!
(sleep 30 && kill -INT "$conda_pid" 2>/dev/null) &
timeout_pid=$!
wait "$conda_pid" || _BUILDS=""
kill "$timeout_pid" 2>/dev/null \
|| echo "TIMEOUT: killed conda install process"
fi
fi
echo ""
if test -z "$_BUILDS"; then
echo "WARNING: $PKG is not available"
fi
done
fi
# Re-try Pyomo (optional) dependencies with pip
echo ""
Expand Down Expand Up @@ -405,6 +446,7 @@ jobs:
echo "Final conda environment:"
conda list | sed 's/^/ /'
- name: Setup TPL package directories
run: |
TPL_DIR="${GITHUB_WORKSPACE}/cache/tpl"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ jobs:
fi
PYVER=$(echo "py${{matrix.python}}" | sed 's/\.//g')
echo "Installing for $PYVER"
for PKG in scip 'cplex>=12.10' docplex gurobi "$XPRESS" cyipopt pymumps; do
for PKG in 'cplex>=12.10' docplex gurobi "$XPRESS" cyipopt pymumps scip; do
echo ""
echo "*** Install $PKG ***"
echo ""
Expand Down Expand Up @@ -444,7 +444,7 @@ jobs:
# kill it after 5-minutes.
(conda install -q -y $PKG) &
conda_pid=$!
(sleep 300 && kill "$conda_pid" 2>/dev/null) &
(sleep 30 && kill -INT "$conda_pid" 2>/dev/null) &
timeout_pid=$!
wait "$conda_pid" || _BUILDS=""
kill "$timeout_pid" 2>/dev/null \
Expand Down Expand Up @@ -483,6 +483,7 @@ jobs:
echo "Final conda environment:"
conda list | sed 's/^/ /'
- name: Setup TPL package directories
run: |
TPL_DIR="${GITHUB_WORKSPACE}/cache/tpl"
Expand Down

0 comments on commit 2cc253c

Please sign in to comment.