Skip to content

Commit

Permalink
Introduce PATH forcing
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmundt committed Jan 13, 2025
1 parent a625df6 commit 2a50773
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/test_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -428,13 +428,18 @@ jobs:
mkdir -p "$DOWNLOAD_DIR"
echo "TPL_DIR=$TPL_DIR" >> $GITHUB_ENV
echo "DOWNLOAD_DIR=$DOWNLOAD_DIR" >> $GITHUB_ENV
# Create a new PYOMO_PATH variable so we can ensure that we are actually
# getting the right PATH at the end
echo "PYOMO_PATH=$PATH" >> $GITHUB_ENV
- name: Install Ipopt
if: ${{ ! matrix.slim }}
run: |
IPOPT_DIR=$TPL_DIR/ipopt
echo "$IPOPT_DIR" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$IPOPT_DIR" >> $GITHUB_ENV
NEW_PYOMO_PATH="$IPOPT_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
mkdir -p $IPOPT_DIR
IPOPT_TAR=${DOWNLOAD_DIR}/ipopt.tar.gz
if test ! -e $IPOPT_TAR; then
Expand Down Expand Up @@ -511,7 +516,9 @@ jobs:
- name: Install GAMS Python bindings
if: ${{ ! matrix.slim }}
run: |
GAMS_DIR="${env:TPL_DIR}/gams"
GAMS_DIR="$TPL_DIR/gams"
NEW_PYOMO_PATH="$GAMS_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
py_ver=$($PYTHON_EXE -c 'import sys;v="_%s%s" % sys.version_info[:2] \
;print(v if v != "_27" else "")')
if test -e $GAMS_DIR/apifiles/Python/api$py_ver; then
Expand All @@ -528,6 +535,17 @@ jobs:
$BARON_DIR = "${env:TPL_DIR}/baron"
echo "$BARON_DIR" | `
Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$CURRENT_PYOMO_PATH="${env:PYOMO_PATH}"
# Prepend BARON_DIR with appropriate path separator
if ( "${{matrix.TARGET}}" -eq "win" ) {
$PATH_SEPARATOR = ";"
} else {
$PATH_SEPARATOR = ":"
}
$NEW_PYOMO_PATH = "$BARON_DIR$PATH_SEPARATOR$CURRENT_PYOMO_PATH"
echo "New PYOMO_PATH: $NEW_PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" | `
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$URL = "https://minlp-downloads.nyc3.cdn.digitaloceanspaces.com/xecs/baron/current/"
if ( "${{matrix.TARGET}}" -eq "win" ) {
$INSTALLER = "${env:DOWNLOAD_DIR}/baron_install.exe"
Expand Down Expand Up @@ -562,6 +580,8 @@ jobs:
run: |
GJH_DIR="$TPL_DIR/gjh"
echo "${GJH_DIR}" >> $GITHUB_PATH
NEW_PYOMO_PATH="$GJH_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
INSTALL_DIR="${DOWNLOAD_DIR}/gjh"
if test ! -e "$INSTALL_DIR/bin"; then
mkdir -p "$INSTALL_DIR"
Expand Down Expand Up @@ -637,6 +657,11 @@ jobs:
- name: Report pyomo plugin information
run: |
# MRM / Jan 9, 2025: We update the PATH manually to make sure we capture
# the all of our changes. This is necessary because of an
# issue with how the PATH rearranges on Windows.
# Issue: https://github.com/actions/runner-images/issues/11328
export PATH=$PYOMO_PATH
echo "$PATH"
pyomo help --solvers || exit 1
pyomo help --transformations || exit 1
Expand All @@ -645,6 +670,7 @@ jobs:
- name: Run Pyomo tests
if: matrix.mpi == 0
run: |
export PATH=$PYOMO_PATH
$PYTHON_EXE -m pytest -v \
-W ignore::Warning ${{matrix.category}} \
pyomo `pwd`/pyomo-model-libraries \
Expand Down
28 changes: 27 additions & 1 deletion .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,18 @@ jobs:
mkdir -p "$DOWNLOAD_DIR"
echo "TPL_DIR=$TPL_DIR" >> $GITHUB_ENV
echo "DOWNLOAD_DIR=$DOWNLOAD_DIR" >> $GITHUB_ENV
# Create a new PYOMO_PATH variable so we can ensure that we are actually
# getting the right PATH at the end
echo "PYOMO_PATH=$PATH" >> $GITHUB_ENV
- name: Install Ipopt
if: ${{ ! matrix.slim }}
run: |
IPOPT_DIR=$TPL_DIR/ipopt
echo "$IPOPT_DIR" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$IPOPT_DIR" >> $GITHUB_ENV
NEW_PYOMO_PATH="$IPOPT_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
mkdir -p $IPOPT_DIR
IPOPT_TAR=${DOWNLOAD_DIR}/ipopt.tar.gz
if test ! -e $IPOPT_TAR; then
Expand Down Expand Up @@ -543,7 +548,9 @@ jobs:
- name: Install GAMS Python bindings
if: ${{ ! matrix.slim }}
run: |
GAMS_DIR="${env:TPL_DIR}/gams"
GAMS_DIR="$TPL_DIR/gams"
NEW_PYOMO_PATH="$GAMS_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
py_ver=$($PYTHON_EXE -c 'import sys;v="_%s%s" % sys.version_info[:2] \
;print(v if v != "_27" else "")')
if test -e $GAMS_DIR/apifiles/Python/api$py_ver; then
Expand All @@ -560,6 +567,17 @@ jobs:
$BARON_DIR = "${env:TPL_DIR}/baron"
echo "$BARON_DIR" | `
Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$CURRENT_PYOMO_PATH="${env:PYOMO_PATH}"
# Prepend BARON_DIR with appropriate path separator
if ( "${{matrix.TARGET}}" -eq "win" ) {
$PATH_SEPARATOR = ";"
} else {
$PATH_SEPARATOR = ":"
}
$NEW_PYOMO_PATH = "$BARON_DIR$PATH_SEPARATOR$CURRENT_PYOMO_PATH"
echo "New PYOMO_PATH: $NEW_PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" | `
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$URL = "https://minlp-downloads.nyc3.cdn.digitaloceanspaces.com/xecs/baron/current/"
if ( "${{matrix.TARGET}}" -eq "win" ) {
$INSTALLER = "${env:DOWNLOAD_DIR}/baron_install.exe"
Expand Down Expand Up @@ -594,6 +612,8 @@ jobs:
run: |
GJH_DIR="$TPL_DIR/gjh"
echo "${GJH_DIR}" >> $GITHUB_PATH
NEW_PYOMO_PATH="$GJH_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
INSTALL_DIR="${DOWNLOAD_DIR}/gjh"
if test ! -e "$INSTALL_DIR/bin"; then
mkdir -p "$INSTALL_DIR"
Expand Down Expand Up @@ -670,6 +690,11 @@ jobs:
- name: Report pyomo plugin information
run: |
# MRM / Jan 9, 2025: We update the PATH manually to make sure we capture
# the all of our changes. This is necessary because of an
# issue with how the PATH rearranges on Windows.
# Issue: https://github.com/actions/runner-images/issues/11328
export PATH=$PYOMO_PATH
echo "$PATH"
pyomo help --solvers || exit 1
pyomo help --transformations || exit 1
Expand All @@ -678,6 +703,7 @@ jobs:
- name: Run Pyomo tests
if: matrix.mpi == 0
run: |
export PATH=$PYOMO_PATH
$PYTHON_EXE -m pytest -v \
-W ignore::Warning ${{matrix.category}} \
pyomo `pwd`/pyomo-model-libraries \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Pyomo is available under the BSD License - see the
Pyomo is currently tested with the following Python implementations:

* CPython: 3.9, 3.10, 3.11, 3.12, 3.13
* PyPy: 3.9
* PyPy: 3.10

_Testing and support policy_:

Expand Down

0 comments on commit 2a50773

Please sign in to comment.