Skip to content

OpenMDAO Latest

OpenMDAO Latest #27

# Run OpenMDAO tests on latest/pre-release versions
name: OpenMDAO Latest
on:
# Run the workflow Monday, Wednesday and Friday at 0400 UTC
schedule:
- cron: '0 4 * * 1,3,5'
# Allow running the workflow manually from the Actions tab
workflow_dispatch:
permissions: {}
jobs:
tests:
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
# test latest versions on ubuntu
- NAME: Ubuntu Latest
OS: ubuntu-latest
PY: 3
PETSc: 3
SNOPT: 7.7
runs-on: ${{ matrix.OS }}
name: ${{ matrix.NAME }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Display run details
run: |
echo "============================================================="
echo "Run #${GITHUB_RUN_NUMBER}"
echo "Run ID: ${GITHUB_RUN_ID}"
echo "Testing: ${GITHUB_REPOSITORY}"
echo "Branch: ${GITHUB_BASE_REF}"
echo "Triggered by: ${GITHUB_EVENT_NAME}"
echo "Initiated by: ${GITHUB_ACTOR}"
echo "============================================================="
- name: Create SSH key
if: (matrix.SNOPT || matrix.BUILD_DOCS)
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
run: |
mkdir -p ~/.ssh/
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- name: Checkout code
uses: actions/checkout@v3
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.PY }}
conda-version: "*"
channels: conda-forge
channel-priority: true
- name: Install OpenMDAO
run: |
echo "============================================================="
echo "Upgrade conda environment to latest"
echo "============================================================="
conda upgrade -c conda-forge --all
echo "============================================================="
echo "Define useful functions"
echo "============================================================="
function latest_version() {
local REPO_URL=$1/releases/latest
local LATEST_URL=`curl -fsSLI -o /dev/null -w %{url_effective} $REPO_URL`
local LATEST_VER=`echo $LATEST_URL | awk '{split($0,a,"/tag/"); print a[2]}'`
echo $LATEST_VER
}
function latest_branch() {
local LATEST_VER=$(latest_version $1)
echo git+$1@$LATEST_VER
}
echo "============================================================="
echo "Upgrade to latest pip"
echo "============================================================="
python -m pip install --upgrade pip
echo "============================================================="
echo "Install latest setuptools"
echo "============================================================="
python -m pip install --upgrade --pre setuptools
echo "============================================================="
echo "Install latest versions of NumPy/SciPy"
echo "============================================================="
python -m pip install --upgrade --pre numpy
python -m pip install --upgrade --pre scipy
# remember versions so we can check them later
NUMPY_VER=`python -c "import numpy; print(numpy.__version__)"`
SCIPY_VER=`python -c "import scipy; print(scipy.__version__)"`
echo "NUMPY_VER=$NUMPY_VER" >> $GITHUB_ENV
echo "SCIPY_VER=$SCIPY_VER" >> $GITHUB_ENV
echo "============================================================="
echo "Install latest versions of 'docs' dependencies"
echo "============================================================="
python -m pip install --upgrade --pre matplotlib
python -m pip install --upgrade --pre numpydoc
python -m pip install --upgrade --pre jupyter-book
python -m pip install --upgrade --pre sphinx-sitemap
python -m pip install --upgrade --pre ipyparallel
echo "============================================================="
echo "Install latest versions of 'doe' dependencies"
echo "============================================================="
python -m pip install --upgrade --pre pyDOE3
echo "============================================================="
echo "Install latest versions of 'notebooks' dependencies"
echo "============================================================="
python -m pip install --upgrade --pre notebook
python -m pip install --upgrade --pre ipympl
echo "============================================================="
echo "Install latest versions of 'visualization' dependencies"
echo "============================================================="
python -m pip install --upgrade --pre bokeh
python -m pip install --upgrade --pre colorama
echo "============================================================="
echo "Install latest versions of 'test' dependencies"
echo "============================================================="
python -m pip install --upgrade --pre parameterized
python -m pip install --upgrade --pre numpydoc
python -m pip install --upgrade --pre pycodestyle
python -m pip install --upgrade --pre pydocstyle
python -m pip install --upgrade --pre testflo
python -m pip install --upgrade --pre websockets
python -m pip install --upgrade --pre aiounittest
echo "the latest version of playwright (1.38.0) is pinned to"
echo "greenlet 2.0.2 which does not build properly for python 3.12"
echo "https://github.com/microsoft/playwright-python/issues/2096"
python -m pip install --upgrade --pre playwright || echo "Skipping playwright, no GUI testing!"
python -m pip install --upgrade --pre num2words
echo "============================================================="
echo "Install latest versions of other optional packages"
echo "============================================================="
python -m pip install --upgrade --pre pyparsing psutil objgraph pyxdsm
python -m pip install --upgrade --pre jax jaxlib
echo "============================================================="
echo "Install latest pyoptsparse"
echo "============================================================="
python -m pip install git+https://github.com/OpenMDAO/build_pyoptsparse
BRANCH="-b $(latest_version https://github.com/mdolab/pyoptsparse)"
if [[ "${{ secrets.SNOPT_LOCATION_77 }}" ]]; then
echo " > Secure copying SNOPT 7.7 over SSH"
mkdir SNOPT
scp -qr ${{ secrets.SNOPT_LOCATION_77 }} SNOPT
SNOPT="-s SNOPT/src"
else
echo "SNOPT source is not available"
fi
build_pyoptsparse $BRANCH $SNOPT
echo "============================================================="
echo "Install OpenMDAO"
echo "============================================================="
python -m pip install .
- name: Install PETSc
if: matrix.PETSc
run: |
echo "============================================================="
echo "Install latest PETSc"
echo "============================================================="
conda install mpi4py petsc petsc4py -q -y --freeze-installed
echo "============================================================="
echo "Check MPI and PETSc installation"
echo "============================================================="
export OMPI_MCA_rmaps_base_oversubscribe=1
echo "-----------------------"
echo "Quick test of mpi4py:"
mpirun -n 3 python -c "from mpi4py import MPI; print(f'Rank: {MPI.COMM_WORLD.rank}')"
echo "-----------------------"
echo "Quick test of petsc4py:"
mpirun -n 3 python -c "import numpy; from mpi4py import MPI; comm = MPI.COMM_WORLD; \
import petsc4py; petsc4py.init(); \
x = petsc4py.PETSc.Vec().createWithArray(numpy.ones(5)*comm.rank, comm=comm); \
print(x.getArray())"
echo "-----------------------"
echo "============================================================="
echo "Export MPI-related environment variables"
echo "============================================================="
echo "OMPI_MCA_rmaps_base_oversubscribe=1" >> $GITHUB_ENV
echo "Workaround for intermittent failures with OMPI https://github.com/open-mpi/ompi/issues/7393"
echo "TMPDIR=/tmp" >> $GITHUB_ENV
- name: Display environment info
id: env_info
continue-on-error: true
run: |
conda info
conda list
echo "============================================================="
echo "Check installed versions of Python, Numpy and Scipy"
echo "============================================================="
echo 'errors<<EOF' >> $GITHUB_OUTPUT
FINAL_VER=`python -c "import platform; print(platform.python_version())"`
if [[ ! "$FINAL_VER" == "${{ matrix.PY }}"* ]]; then
echo "Python version was changed from ${{ matrix.PY }} to $FINAL_VER" >> $GITHUB_OUTPUT
fi
FINAL_VER=`python -c "import numpy; print(numpy.__version__)"`
if [[ ! "$FINAL_VER" == "$NUMPY_VER"* ]]; then
echo "NumPy version was changed from $NUMPY_VER to $FINAL_VER" >> $GITHUB_OUTPUT
fi
FINAL_VER=`python -c "import scipy; print(scipy.__version__)"`
if [[ ! "$FINAL_VER" == "$SCIPY_VER"* ]]; then
echo "SciPy version was changed from $SCIPY_VER to $FINAL_VER" >> $GITHUB_OUTPUT
fi
echo 'EOF' >> $GITHUB_OUTPUT
grep changed $GITHUB_OUTPUT || echo ""
if: always()
- name: Run tests
id: run_tests
continue-on-error: true
run: |
echo "============================================================="
echo "Run tests (from directory other than repo root)"
echo "============================================================="
cd $HOME
RPT_FILE=`pwd`/deprecations.txt
echo "RPT_FILE=$RPT_FILE" >> $GITHUB_ENV
testflo -n 1 openmdao --timeout=240 --deprecations_report=$RPT_FILE --exclude=test_warnings_filters
- name: Build docs
id: build_docs
continue-on-error: true
run: |
export OPENMDAO_REPORTS=0
export PYDEVD_DISABLE_FILE_VALIDATION=1
cd openmdao/docs
if [[ "${{ secrets.SNOPT_LOCATION_77 }}" ]]; then
echo "============================================================="
echo "Building docs with SNOPT examples."
echo "============================================================="
else
echo "============================================================="
echo "Disabling SNOPT cells in notebooks."
echo "============================================================="
python openmdao_book/other/disable_snopt_cells.py
fi
echo "============================================================="
echo "Starting ipcluster to run MPI under notebooks"
echo "============================================================="
./ipcluster_start.sh
sleep 12
echo "============================================================="
echo "Building the docs"
echo "============================================================="
echo "building source docs..."
python build_source_docs.py
echo "building book..."
jupyter-book build -W --keep-going openmdao_book
echo "copying build artifacts..."
python copy_build_artifacts.py
- name: Display doc build reports
if: steps.build_docs.outcome == 'failure'
continue-on-error: true
run: |
for f in $(find /home/runner/work/OpenMDAO/OpenMDAO/openmdao/docs/openmdao_book/_build/html/reports -name '*.log'); do
echo "============================================================="
echo $f
echo "============================================================="
cat $f
done
- name: Deprecations Report
id: deprecations_report
continue-on-error: true
run: |
echo "============================================================="
echo "Display deprecations report"
echo "============================================================="
cat $RPT_FILE
echo 'summary<<EOF' >> $GITHUB_OUTPUT
head -n 6 $RPT_FILE | cut -d':' -f 1 >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
grep '^0 unique deprecation warnings' $RPT_FILE
- name: Slack env change
if: steps.env_info.outputs.errors != ''
uses: act10ns/slack@v2.0.0
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: 'warning'
message: |
Environment change detected on `Latest` build.
Python, NumPy or SciPy was not the requested version:
```${{steps.env_info.outputs.errors}}```
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Slack unit test failure
if: steps.run_tests.outcome == 'failure'
uses: act10ns/slack@v2.0.0
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: ${{ steps.run_tests.outcome }}
message:
Unit testing failed on `Latest` build.
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Slack doc build failure
if: steps.build_docs.outcome == 'failure'
uses: act10ns/slack@v2.0.0
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: ${{ steps.build_docs.outcome }}
message: |
Doc build failed on `Latest` build.
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Slack deprecation warnings
if: steps.deprecations_report.outcome == 'failure'
uses: act10ns/slack@v2.0.0
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: 'warning'
message: |
Deprecations were detected on `Latest` build.
```${{ steps.deprecations_report.outputs.summary }}```
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}