Skip to content
Merged
81 changes: 52 additions & 29 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ on:
type: choice
options:
- ''
- 'Ubuntu Baseline'
- 'Ubuntu Baseline, no MPI'
- 'MacOS Baseline'
- 'Ubuntu Default'
- 'Ubuntu Default, no MPI'
- 'Ubuntu Default, Numpy 2.x'
- 'MacOS Default'
- 'MacOS Default, Numpy 2.x'
- 'Ubuntu Latest'
- 'Ubuntu Oldest'
- 'Ubuntu Baseline, no MPI, forced build'
- 'MacOS Baseline, no MPI, forced build'
- 'Ubuntu Default, no MPI, forced build'
- 'MacOS Default, no MPI, forced build'
- 'Ubuntu Latest, no MPI, forced build'
- 'MacOS Baseline on ARM'
required: false
default: ''
debug_enabled:
Expand All @@ -53,8 +54,8 @@ jobs:
fail-fast: false
matrix:
include:
# test baseline versions on Ubuntu
- NAME: Ubuntu Baseline
# test default version on Ubuntu
- NAME: Ubuntu Default
OS: ubuntu-latest
PY: '3.12'
NUMPY: '1.26'
Expand All @@ -64,17 +65,28 @@ jobs:
# PAROPT: true
SNOPT: 7.7

# test baseline versions on Ubuntu without MPI
- NAME: Ubuntu Baseline, no MPI
# test default version on Ubuntu without MPI
- NAME: Ubuntu Default, no MPI
OS: ubuntu-latest
PY: '3.12'
NUMPY: '1.26'
SCIPY: '1.13'
PYOPTSPARSE: 'default'
SNOPT: 7.7

# test baseline versions on MacOS
- NAME: MacOS Baseline
# test default version on Ubuntu with NumPy 2.x
- NAME: Ubuntu Default, Numpy 2.x
OS: ubuntu-latest
PY: '3.13'
NUMPY: '2'
SCIPY: '1.15'
MPICC: 4
PYOPTSPARSE: 'default'
# PAROPT: true
SNOPT: 7.7

# test default version on MacOS
- NAME: MacOS Default
OS: macos-13
PY: '3.11'
NUMPY: '1.26'
Expand All @@ -84,7 +96,29 @@ jobs:
# PAROPT: true
SNOPT: 7.7

# test latest versions
# test default version on MacOS with NumPy 2.x
- NAME: MacOS Default, Numpy 2.x
OS: macos-13
PY: '3.13'
NUMPY: '2'
SCIPY: '1.15'
MPICC: 4
PYOPTSPARSE: 'default'
# PAROPT: true
SNOPT: 7.7

# test default version on MacOS latest (ARM64)
- NAME: MacOS Default on ARM
OS: macos-latest
PY: '3.12'
NUMPY: '1.26'
SCIPY: '1.13'
BREW: true
MPICC: 4
PYOPTSPARSE: 'default'
SNOPT: 7.7

# test latest release versions
- NAME: Ubuntu Latest
OS: ubuntu-latest
PY: 3
Expand All @@ -105,8 +139,8 @@ jobs:
NO_IPOPT: true
SNOPT: 7.2

# test baseline versions on Ubuntu without MPI with forced build
- NAME: Ubuntu Baseline, no MPI, forced build
# test default version on Ubuntu without MPI with forced build
- NAME: Ubuntu Default, no MPI, forced build
OS: ubuntu-latest
PY: '3.12'
NUMPY: '1.26'
Expand All @@ -115,8 +149,8 @@ jobs:
SNOPT: 7.7
FORCE_BUILD: true

# test baseline versions on MacOS without MPI with forced build
- NAME: MacOS Baseline, no MPI, forced build
# test default version on MacOS without MPI with forced build
- NAME: MacOS Default, no MPI, forced build
OS: macos-13
PY: '3.11'
NUMPY: '1.26'
Expand All @@ -126,7 +160,7 @@ jobs:
FORCE_BUILD: true
XCODE: '14.2'

# test latest versions without MPI with forced build
# test latest version without MPI with forced build
- NAME: Ubuntu Latest, no MPI, forced build
OS: ubuntu-latest
PY: 3
Expand All @@ -136,17 +170,6 @@ jobs:
SNOPT: 7.7
FORCE_BUILD: true

# test baseline versions on MacOS latest (ARM64)
- NAME: MacOS Baseline on ARM
OS: macos-latest
PY: '3.12'
NUMPY: '1.26'
SCIPY: '1.13'
BREW: true
MPICC: 4
PYOPTSPARSE: 'default'
SNOPT: 7.7

runs-on: ${{ matrix.OS }}

name: ${{ matrix.NAME }}
Expand Down
19 changes: 15 additions & 4 deletions build_pyoptsparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import tempfile
from colors import *
from shutil import which
from packaging.version import Version, parse
from packaging.version import parse
import numpy


# Default options that the user can change with command line switches
Expand Down Expand Up @@ -80,7 +81,7 @@
'include_file': 'IpoptConfig.h'
},
'pyoptsparse': {
'branch': 'v2.10.1',
'branch': 'v2.10.1' if parse(numpy.__version__) < parse('2.0') else 'v2.13.1',
'url': 'https://github.com/mdolab/pyoptsparse.git',
},
'hsl': {
Expand Down Expand Up @@ -504,7 +505,7 @@ def install_conda_pkg(pkg_name:str):
The name of the package to install.
"""
note(f'Installing {pkg_name.upper()} with conda')
install_args = ['install', '-y', pkg_name]
install_args = ['install', '-q', '-y', pkg_name]
run_conda_cmd(cmd_args=install_args)
note_ok()

Expand Down Expand Up @@ -718,7 +719,6 @@ def install_paropt_from_src():
Git clone the PAROPT repo, build the library, and install it and the include files.
"""
build_dir = git_clone('paropt')
pip_install(['Cython'], pkg_desc='Cython')

# Use build defaults as per ParOpt instructions:
Path('Makefile.in.info').rename('Makefile.in')
Expand Down Expand Up @@ -780,14 +780,23 @@ def install_ipopt(config_opts:list=None):
config_opts : list
Additional options to use with the IPOPT configure script if building.
"""
if opts['pyoptsparse_version'] >= parse('2.14'):
pkg_path = os.environ['PKG_CONFIG_PATH'] + ':' if 'PKG_CONFIG_PATH' in os.environ else ''
pkg_dir = Path(opts['prefix']) / 'lib' / 'pkgconfig'
os.environ['PKG_CONFIG_PATH'] = pkg_path + str(pkg_dir)

if allow_install_with_conda() and opts['force_build'] is False:
try:
install_conda_pkg('ipopt')
if opts['pyoptsparse_version'] >= parse('2.14'):
install_conda_pkg('cyipopt')
return
except Exception as e:
try_fallback('IPOPT', e)

install_ipopt_from_src(config_opts=config_opts)
if opts['pyoptsparse_version'] >= parse('2.14'):
pip_install(['cyipopt', '--use-pep517'], pkg_desc='cyipopt')

def install_mumps():
""" Install MUMPS either through conda or building. """
Expand Down Expand Up @@ -917,6 +926,8 @@ def patch_pyoptsparse_src():

def install_pyoptsparse_from_src():
""" Git clone the pyOptSparse repo and use pip to install it. """
pip_install(['Cython'], pkg_desc='Cython')

# First, build PAROPT if selected:
if opts['include_paropt'] is True:
install_paropt_from_src()
Expand Down
Loading