Skip to content

Build

Build #356

Workflow file for this run

name: Build
on:
pull_request:
push:
branches:
- main
tags:
- v*.*.*
schedule:
# Run the tests at 7:23pm UTC on the 9th and 24th of every month
- cron: '23 19 9,24 * *'
jobs:
black:
uses: mdolab/.github/.github/workflows/black.yaml@main
flake8:
uses: mdolab/.github/.github/workflows/flake8.yaml@main
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
dep-versions: ["oldest", "latest"]
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set versions to test here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PYTHON_VERSION_OLDEST: ['3.8']
PYTHON_VERSION_LATEST: ['3.11']
PIP_VERSION_OLDEST: ['23.0.1'] # pip>=23.1 cannot build the oldest OpenMDAO
SETUPTOOLS_VERSION_OLDEST: ['66.0.0'] # setuptools >= 67.0.0 can't build the oldest OpenMDAO
NUMPY_VERSION_OLDEST: ['1.21'] # latest is most recent on PyPI
SCIPY_VERSION_OLDEST: ['1.7.0'] # latest is most recent on PyPI
OPENMDAO_VERSION_OLDEST: ['3.21'] # latest is most recent on PyPI
fail-fast: false
env:
OMP_NUM_THREADS: 1
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.PYTHON_VERSION_OLDEST }}
if: ${{ matrix.dep-versions == 'oldest' }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.PYTHON_VERSION_OLDEST }}
- name: Setup Python ${{ matrix.PYTHON_VERSION_LATEST }}
if: ${{ matrix.dep-versions == 'latest' }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.PYTHON_VERSION_LATEST }}
- name: Install dependencies (oldest versions)
if: ${{ matrix.dep-versions == 'oldest' }}
run: |
conda config --set always_yes yes
python -m pip install pip==${{ matrix.PIP_VERSION_OLDEST }} setuptools==${{ matrix.SETUPTOOLS_VERSION_OLDEST }} --upgrade wheel
conda install -c conda-forge numpy=${{ matrix.NUMPY_VERSION_OLDEST }} scipy=${{ matrix.SCIPY_VERSION_OLDEST }}
pip install om-pycycle
- name: Install dependencies (latest versions)
if: ${{ matrix.dep-versions == 'latest' }}
run: |
conda config --set always_yes yes
pip install numpy scipy openmdao om-pycycle
- name: Install OpenConcept
run: |
pip install -e .[testing]
pip install -e .[docs]
- name: Install oldest OpenMDAO versions
if: ${{ matrix.dep-versions == 'oldest' }}
run: |
pip install openmdao==${{ matrix.OPENMDAO_VERSION_OLDEST }}
- name: List Python and package info
run: |
python --version
pip list
- name: Download engine deck surrogate model
run: |
curl -L -o engine_kriging_surrogate_model.tar.gz http://umich.edu/~mdolaboratory/repo_files/openconcept/engine_kriging_surrogate_model.tar.gz
- name: Move engine deck files to appropriate location
run: |
tar -xvf engine_kriging_surrogate_model.tar.gz
mv cfm56* ./openconcept/propulsion/empirical_data/cfm56
mv n3_hybrid* ./openconcept/propulsion/empirical_data/n+3_hybrid
mv n3* ./openconcept/propulsion/empirical_data/n+3
- name: Test
run: |
python -m pytest --cov-config=.coveragerc --cov=openconcept --cov-report=xml
- name: Upload coverage to Codecov
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# --- publish to PyPI
pypi:
needs: [build]
uses: mdolab/.github/.github/workflows/pypi.yaml@main
secrets: inherit