Skip to content

Commit

Permalink
Run github actions on mdolab docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
A-CGray committed Jul 15, 2024
1 parent 0448bff commit 613e608
Showing 1 changed file with 20 additions and 149 deletions.
169 changes: 20 additions & 149 deletions .github/workflows/oas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,160 +16,31 @@ on:
- cron: '23 19 2,17 * *'

jobs:
# --- run OAS unit and regression tests ---
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false # continue other jobs even if one of the jobs in matrix fails
fail-fast: false
matrix:
dep-versions: ["oldest", "latest"]
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set versions to test here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PYTHON_VERSION_OLDEST: ['3.8']
PYTHON_VERSION_LATEST: ['3.11']
WHEEL_VERSION_OLDEST: ['0.38.4'] # latest wheel cannot build the oldest OpenMDAO (3.17 or older)
NUMPY_VERSION_OLDEST: ['1.20'] # latest is most recent on PyPI
SCIPY_VERSION_OLDEST: ['1.6.0'] # latest is most recent on PyPI
OPENMDAO_VERSION_OLDEST: ['3.15'] # latest is most recent on PyPI
MPHYS_VERSION_OLDEST: ['1.0.0'] # latest is most recent on PyPI
PYGEO_VERSION_OLDEST: ['1.6.0'] # latest is pulled from main branch, for some reason anything after 1.12.2 seg faults on the old build
VSP_VERSION: ['3.27.1'] # used for both builds
PETSC_VERSION_LATEST: ['3.19.1']
CYTHON_VERSION: ['0.29.36'] # used for both builds
dockerImage: [stable, latest]

runs-on: ubuntu-latest
container: mdolab/public:u22-gcc-ompi-${{ matrix.dockerImage }}-amd64
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.PYTHON_VERSION_OLDEST }}
if: ${{ matrix.dep-versions == 'oldest' }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON_VERSION_OLDEST }}
- name: Set up Python ${{ matrix.PYTHON_VERSION_LATEST }}
if: ${{ matrix.dep-versions == 'latest' }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON_VERSION_LATEST }}

# we need OpenVSP to run vsp tests.
- name: Install OpenVSP
run: |
sudo apt-get update
export PYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")
export PYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
export INST_PREFIX=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('prefix'))")
cd ..
sudo apt-get install cmake libx11-dev libfltk1.3-dev libcpptest-dev libglm-dev libeigen3-dev libcminpack-dev \
libglew-dev doxygen graphviz texlive-latex-base
mkdir OpenVSP
cd OpenVSP
mkdir build buildlibs
# Download source code
wget -q https://github.com/OpenVSP/OpenVSP/archive/refs/tags/OpenVSP_${{ matrix.VSP_VERSION }}.tar.gz
tar -xf OpenVSP_${{ matrix.VSP_VERSION }}.tar.gz
mv OpenVSP-OpenVSP_${{ matrix.VSP_VERSION }} repo
# Build dependency libs
cd buildlibs
cmake -DVSP_USE_SYSTEM_LIBXML2=true -DVSP_USE_SYSTEM_FLTK=true -DVSP_USE_SYSTEM_GLM=true \
-DVSP_USE_SYSTEM_GLEW=true -DVSP_USE_SYSTEM_CMINPACK=true -DVSP_USE_SYSTEM_LIBIGES=false \
-DVSP_USE_SYSTEM_EIGEN=false -DVSP_USE_SYSTEM_CODEELI=false -DVSP_USE_SYSTEM_CPPTEST=false \
-DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR} -DPYTHON_LIBRARY=${PYTHON_LIBRARY} ../repo/Libraries -DCMAKE_BUILD_TYPE=Release
make -j8
# Build OpenVSP
cd ..
export BUILD_LIBS_PATH=`pwd`
cd build
cmake ../repo/src/ -DVSP_NO_GRAPHICS=true -DVSP_LIBRARY_PATH=${BUILD_LIBS_PATH}/buildlibs \
-DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR} -DPYTHON_LIBRARY=${PYTHON_LIBRARY} \
-DCMAKE_BUILD_TYPE=Release
make -j8
make package
# Install python interface
pushd _CPack_Packages/Linux/ZIP/OpenVSP-${{ matrix.VSP_VERSION }}-Linux/python
pip install -r requirements.txt
pushd ..
cp vspaero vspscript vspslicer $INST_PREFIX/bin
popd
popd
# OAS dependencies are specified in setup.py.
- name: Install OAS and its dependencies (oldest versions)
if: ${{ matrix.dep-versions == 'oldest' }}
run: |
python -m pip install wheel==${{ matrix.WHEEL_VERSION_OLDEST }}
pip install numpy==${{ matrix.NUMPY_VERSION_OLDEST }} scipy==${{ matrix.SCIPY_VERSION_OLDEST }} openmdao==${{ matrix.OPENMDAO_VERSION_OLDEST }} mphys==${{ matrix.MPHYS_VERSION_OLDEST }}
pip install -e .[test]
- name: Install OAS and its dependencies (latest versions)
if: ${{ matrix.dep-versions == 'latest' }}
run: |
python -m pip install --upgrade pip wheel
pip install -e .[test,mphys]
- name: Install MPI
run: |
sudo apt-get install openmpi-bin libopenmpi-dev
pip install mpi4py
# install PETSc on the latest for MPI tests
- name: Install PETSc
if: ${{ matrix.dep-versions == 'latest' }}
run: |
cd ..
pip download petsc==${{ matrix.PETSC_VERSION_LATEST }}
tar -xf petsc-${{ matrix.PETSC_VERSION_LATEST }}.tar.gz
cd petsc-${{ matrix.PETSC_VERSION_LATEST }}
export PETSC_ARCH=real-debug
export PETSC_DIR=`pwd`
./configure --PETSC_ARCH=$PETSC_ARCH --download-fblaslapack
make PETSC_DIR=$PETSC_DIR PETSC_ARCH=$PETSC_ARCH all
# Cython 3.0.0 break petsc4py install
pip install cython==${{ matrix.CYTHON_VERSION }}
pip install petsc4py==${{ matrix.PETSC_VERSION_LATEST }}
# We need pySpline/pyGeo to run FFD tests.
- name: Install pySpline
run: |
cd ..
git clone https://github.com/mdolab/pyspline.git
cd pyspline
cp config/defaults/config.LINUX_GFORTRAN.mk config/config.mk
make
pip install -e .
- name: Install pyGeo ${{ matrix.PYGEO_VERSION_OLDEST }}
if: ${{ matrix.dep-versions == 'oldest' }}
run: |
pip install "pygeo[testing] @ git+https://github.com/mdolab/pygeo.git@v${{ matrix.PYGEO_VERSION_OLDEST }}"
- name: Install pyGeo latest
if: ${{ matrix.dep-versions == 'latest' }}
run: |
pip install "pygeo[testing] @ git+https://github.com/mdolab/pygeo.git"
- name: List installed Python packages
run: |
pip list -v
- name: Run tests (latest)
env:
OMPI_MCA_btl: ^openib # prevent OpenMPI warning messages
if: ${{ matrix.dep-versions == 'latest' }}
run: |
testflo -n 2 -v openaerostruct --coverage --coverpkg openaerostruct
coverage xml
# skip MPI tests on the oldest
- name: Run tests (oldest)
env:
OMPI_MCA_btl: ^openib # prevent OpenMPI warning messages
if: ${{ matrix.dep-versions == 'oldest' }}
run: |
testflo -n 2 -v --exclude \*MPI\* openaerostruct --coverage --coverpkg openaerostruct
coverage xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- uses: actions/checkout@v4
- name: Install OAS
run: |
pip install -e .[test,mphys]
- name: Run tests (latest)
run: |
testflo -n 2 -v openaerostruct --coverage --coverpkg openaerostruct
coverage xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# --- linting and formatting ---
black:
Expand Down

0 comments on commit 613e608

Please sign in to comment.