-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from jdgratz10/main
adding CI file
- Loading branch information
Showing
1 changed file
with
230 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
# Run Tests | ||
|
||
name: Aviary Tests | ||
|
||
on: | ||
# Trigger on push or pull request events for the main branch | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
pre_commit: | ||
if: github.repository_owner == 'OpenMDAO' | ||
# run pre-commit checks | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.11' | ||
- uses: pre-commit/[email protected] | ||
|
||
test_ubuntu: | ||
if: github.repository_owner == 'OpenMDAO' | ||
runs-on: ubuntu-latest | ||
|
||
timeout-minutes: 90 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
# oldest versions of openmdao/dymos | ||
- NAME: oldest | ||
PY: '3.9' | ||
NUMPY: '1.20' | ||
SCIPY: '1.6' | ||
PYOPTSPARSE: 'v2.9.1' | ||
SNOPT: '7.7' | ||
OPENMDAO: '3.27' | ||
DYMOS: '1.8.0' | ||
extend: 0 | ||
|
||
# development versions of openmdao/dymos | ||
- NAME: dev | ||
PY: 3 | ||
NUMPY: 1 | ||
SCIPY: 1 | ||
PYOPTSPARSE: 'v2.9.1' | ||
SNOPT: '7.7' | ||
OPENMDAO: 'dev' | ||
DYMOS: 'dev' | ||
extend: 1 | ||
|
||
# latest versions of openmdao/dymos | ||
- NAME: latest | ||
PY: '3.10' | ||
NUMPY: 1 | ||
SCIPY: 1 | ||
PYOPTSPARSE: 'v2.9.1' | ||
SNOPT: '7.7' | ||
OPENMDAO: 'latest' | ||
DYMOS: 'latest' | ||
extend: 0 | ||
|
||
steps: | ||
- name: Display run details | ||
run: | | ||
echo "=============================================================" | ||
echo "Run #${GITHUB_RUN_NUMBER}" | ||
echo "Run ID: ${GITHUB_RUN_ID}" | ||
echo "Testing: ${GITHUB_REPOSITORY}" | ||
echo "Triggered by: ${GITHUB_EVENT_NAME}" | ||
echo "Initiated by: ${GITHUB_ACTOR}" | ||
echo "=============================================================" | ||
- name: Create SSH key | ||
shell: bash | ||
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: Setup miniconda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
auto-update-conda: true | ||
python-version: ${{ matrix.PY }} | ||
|
||
- name: Install dependencies | ||
shell: bash -l {0} | ||
run: | | ||
echo "=============================================================" | ||
echo "Install dependencies" | ||
echo "=============================================================" | ||
conda install numpy=${{ matrix.NUMPY }} scipy=${{ matrix.SCIPY }} -q -y | ||
conda install matplotlib pandas panel hvplot -q -y | ||
pip install testflo pyxdsm -q | ||
- name: Install pyOptSparse | ||
if: matrix.PYOPTSPARSE | ||
shell: bash -l {0} | ||
run: | | ||
echo "=============================================================" | ||
echo "Install pyoptsparse" | ||
echo "=============================================================" | ||
if [[ "${{ matrix.SNOPT }}" == "7.7" && "${{ secrets.SNOPT_LOCATION_77 }}" ]]; then | ||
mkdir SNOPT | ||
echo " > Secure copying SNOPT 7.7 over SSH" | ||
scp -qr ${{ secrets.SNOPT_LOCATION_77 }} SNOPT | ||
SNOPT="-s SNOPT/src" | ||
elif [[ "${{ matrix.SNOPT }}" ]]; then | ||
echo "SNOPT version ${{ matrix.SNOPT }} was requested but source is not available" | ||
fi | ||
conda config --add channels conda-forge | ||
pip install git+https://github.com/OpenMDAO/build_pyoptsparse | ||
build_pyoptsparse -v -b ${{ matrix.PYOPTSPARSE }} $SNOPT | ||
- name: Install TeX Live | ||
shell: bash | ||
run: | | ||
echo "=============================================================" | ||
echo "Install TeX Live (for pyXDSM)" | ||
echo "=============================================================" | ||
sudo apt-get update | ||
sudo apt-get install texlive-pictures texlive-latex-extra -y | ||
- name: Install OpenMDAO | ||
if: matrix.OPENMDAO | ||
shell: bash -l {0} | ||
run: | | ||
echo "=============================================================" | ||
echo "Install OpenMDAO" | ||
echo "=============================================================" | ||
if [[ "${{ matrix.OPENMDAO }}" == "dev" ]]; then | ||
pip install git+https://github.com/OpenMDAO/OpenMDAO | ||
elif [[ "${{ matrix.OPENMDAO }}" == "latest" ]]; then | ||
pip install openmdao | ||
else | ||
pip install openmdao==${{ matrix.OPENMDAO }} | ||
fi | ||
- name: Install Dymos | ||
if: matrix.DYMOS | ||
shell: bash -l {0} | ||
run: | | ||
echo "=============================================================" | ||
echo "Install Dymos" | ||
echo "=============================================================" | ||
if [[ "${{ matrix.DYMOS }}" == "dev" ]]; then | ||
pip install git+https://github.com/OpenMDAO/Dymos | ||
elif [[ "${{ matrix.DYMOS }}" == "latest" ]]; then | ||
pip install dymos | ||
else | ||
pip install dymos==${{ matrix.DYMOS }} | ||
fi | ||
- name: Checkout Aviary | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Aviary | ||
shell: bash -l {0} | ||
run: | | ||
echo "=============================================================" | ||
echo "Install Aviary" | ||
echo "=============================================================" | ||
pip install -e .[all] | ||
- name: Display conda environment info | ||
shell: bash -l {0} | ||
run: | | ||
conda info | ||
conda list | ||
conda env export --name test --file ${{ matrix.NAME }}_environment.yml | ||
- name: 'Upload environment artifact' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.NAME }}_environment | ||
path: ${{ matrix.NAME }}_environment.yml | ||
retention-days: 5 | ||
|
||
- name: Generate specs | ||
shell: bash -l {0} | ||
run: | | ||
echo "=============================================================" | ||
echo "Generate specs" | ||
echo "=============================================================" | ||
cd aviary/xdsm | ||
python run_all.py | ||
cd ../.. | ||
- name: Run tests | ||
shell: bash -l {0} | ||
run: | | ||
echo "=============================================================" | ||
echo "Run Tests" | ||
echo "=============================================================" | ||
testflo . -n 1 --show_skipped --coverage --coverpkg aviary | ||
- name: Build docs | ||
if: matrix.extend | ||
shell: bash -l {0} | ||
run: | | ||
pip install -U jupyter-book | ||
cd aviary/docs | ||
echo "=============================================================" | ||
echo "Build the docs" | ||
echo "=============================================================" | ||
bash build_book.sh | ||
- name: Scan for security issues | ||
if: matrix.extend | ||
shell: bash -l {0} | ||
run: | | ||
python -m pip install bandit | ||
echo "=============================================================" | ||
echo "Run bandit scan for medium/high severity issues" | ||
echo "=============================================================" | ||
cd $GITHUB_WORKSPACE | ||
python -m bandit -r -ll aviary |