Skip to content

Commit

Permalink
Updated GitHub Workflows (#1111)
Browse files Browse the repository at this point in the history
* Updated GitHub Workflows

* move optional installs

* pip install playwright

---------

Co-authored-by: swryan <[email protected]>
  • Loading branch information
swryan and swryan authored Sep 24, 2024
1 parent dd09fc2 commit 7904439
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 35 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/dymos_docs_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,24 @@ jobs:
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Fetch tags
run: |
git fetch --prune --unshallow --tags
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.PY }}
conda-version: "*"
channels: conda-forge

- name: Install Numpy/Scipy
shell: bash -l {0}
run: |
echo "Make sure we are not using anaconda packages"
conda config --remove channels defaults
echo "============================================================="
echo "Install Numpy/Scipy"
echo "============================================================="
Expand Down
126 changes: 94 additions & 32 deletions .github/workflows/dymos_tests_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,56 @@ on:
pull_request:
branches: [ master, develop ]

# Trigger via workflow_dispatch event
# Allow running the workflow manually from the Actions tab
# All jobs are excluded by default, desired jobs must be selected
workflow_dispatch:

inputs:

run_name:
type: string
description: 'Name of workflow run as it will appear under Actions tab:'
required: false
default: ""

baseline:
type: boolean
description: "Include 'baseline' in test matrix"
required: false
default: false

no_pyoptsparse:
type: boolean
description: "Include 'no_pyoptsparse' in test matrix"
required: false
default: false

no_snopt:
type: boolean
description: "Include 'no_snopt' in test matrix"
required: false
default: false

no_mpi:
type: boolean
description: "Include 'no_mpi' Baseline in test matrix"
required: false
default: false

latest:
type: boolean
description: "Include 'latest' in test matrix"
required: false
default: false

oldest:
type: boolean
description: "Include 'oldest' in test matrix"
required: false
default: false

run-name: ${{ inputs.run_name }}

jobs:

test_ubuntu:
Expand All @@ -38,6 +85,7 @@ jobs:
PEP517: true
OPTIONAL: '[all]'
JAX: '0.4.28'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.baseline }}

# baseline versions except no pyoptsparse or SNOPT
- NAME: no_pyoptsparse
Expand All @@ -47,6 +95,7 @@ jobs:
PETSc: 3.21.0
OPENMDAO: 'latest'
OPTIONAL: '[test]'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.no_pyoptsparse }}

# baseline versions except with pyoptsparse but no SNOPT
- NAME: no_snopt
Expand All @@ -57,6 +106,7 @@ jobs:
PYOPTSPARSE: 'v2.11.0'
OPENMDAO: 'latest'
OPTIONAL: '[test]'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.no_snopt }}

# baseline versions except no MPI/PETSc
- NAME: no_mpi
Expand All @@ -66,6 +116,7 @@ jobs:
PYOPTSPARSE: 'v2.11.0'
OPENMDAO: 'latest'
OPTIONAL: '[test]'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.no_mpi }}

# try latest versions
- NAME: latest
Expand All @@ -78,6 +129,7 @@ jobs:
OPENMDAO: 'dev'
OPTIONAL: '[test]'
JAX: 'latest'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.latest }}

# oldest supported versions
- NAME: oldest
Expand All @@ -87,11 +139,12 @@ jobs:
OPENMPI: '4.0'
MPI4PY: '3.0'
PETSc: 3.13
PYOPTSPARSE: 'v2.6.1'
PYOPTSPARSE: 'v2.9.0'
SNOPT: 7.2
OPENMDAO: 3.28.0
MATPLOTLIB: 3.5
OPTIONAL: '[test]'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.oldest }}

steps:
- name: Display run details
Expand All @@ -103,21 +156,16 @@ jobs:
echo "Triggered by: ${GITHUB_EVENT_NAME}"
echo "Initiated by: ${GITHUB_ACTOR}"
echo "============================================================="
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ matrix.NAME }}" == "latest" ]]; then
echo "Triggered by 'workflow_dispatch' event, will run '${{ matrix.NAME }}' build."
echo "RUN_BUILD=true" >> $GITHUB_ENV
if [[ "${{ matrix.EXCLUDE }}" == "false" ]]; then
echo "Triggered by 'workflow_dispatch', '${{ matrix.NAME }}' build was selected and will run."
else
echo "Triggered by 'workflow_dispatch' event, will not run '${{ matrix.NAME }}' build."
echo "Triggered by 'workflow_dispatch', '${{ matrix.NAME }}' build not selected and will not run."
fi
else
echo "Triggered by '${{ github.event_name }}' event, running all builds."
echo "RUN_BUILD=true" >> $GITHUB_ENV
fi
- name: Create SSH key
if: env.RUN_BUILD
if: ${{ ! matrix.EXCLUDE }}
shell: bash
env:
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}}
Expand All @@ -129,28 +177,30 @@ jobs:
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- name: Checkout code
if: env.RUN_BUILD
uses: actions/checkout@v3
if: ${{ ! matrix.EXCLUDE }}
uses: actions/checkout@v4

- name: Setup conda
if: env.RUN_BUILD
uses: conda-incubator/setup-miniconda@v2
if: ${{ ! matrix.EXCLUDE }}
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.PY }}
conda-version: "*"
channels: conda-forge

- name: Install Numpy/Scipy
if: env.RUN_BUILD
if: ${{ ! matrix.EXCLUDE }}
shell: bash -l {0}
run: |
echo "Make sure we are not using anaconda packages"
conda config --remove channels defaults
echo "============================================================="
echo "Install Numpy/Scipy"
echo "============================================================="
conda install numpy=${{ matrix.NUMPY }} scipy=${{ matrix.SCIPY }} -q -y
- name: Install jax
if: env.RUN_BUILD && matrix.JAX
if: ${{ ! matrix.EXCLUDE && matrix.JAX }}
shell: bash -l {0}
run: |
echo "============================================================="
Expand All @@ -163,7 +213,7 @@ jobs:
fi
- name: Install PETSc
if: env.RUN_BUILD && matrix.PETSc
if: ${{ ! matrix.EXCLUDE && matrix.PETSc }}
shell: bash -l {0}
run: |
echo "============================================================="
Expand All @@ -190,7 +240,7 @@ jobs:
- name: Install pyOptSparse
id: build_pyoptsparse
if: env.RUN_BUILD && matrix.PYOPTSPARSE
if: ${{ ! matrix.EXCLUDE && matrix.PYOPTSPARSE }}
shell: bash -l {0}
run: |
echo "============================================================="
Expand Down Expand Up @@ -236,7 +286,7 @@ jobs:
fi
- name: Install OpenMDAO
if: env.RUN_BUILD && matrix.OPENMDAO
if: ${{ ! matrix.EXCLUDE && matrix.OPENMDAO }}
shell: bash -l {0}
run: |
echo "============================================================="
Expand All @@ -251,7 +301,7 @@ jobs:
fi
- name: Install Matplotlib
if: env.RUN_BUILD && matrix.MATPLOTLIB
if: ${{ ! matrix.EXCLUDE && matrix.MATPLOTLIB }}
shell: bash -l {0}
run: |
echo "============================================================="
Expand All @@ -260,7 +310,7 @@ jobs:
python -m pip install matplotlib==${{ matrix.MATPLOTLIB }}
- name: Install Dymos
if: env.RUN_BUILD
if: ${{ ! matrix.EXCLUDE }}
shell: bash -l {0}
run: |
echo "============================================================="
Expand All @@ -277,9 +327,19 @@ jobs:
python -m pip install .${{ matrix.OPTIONAL }}
fi
- name: Install optional dependencies
if: ${{ ! matrix.EXCLUDE && matrix.OPTIONAL == '[all]' }}
run: |
echo "============================================================="
echo "Install additional packages for testing/coverage"
echo "============================================================="
echo "Pre-install playwright dependencies to avoid 'Playwright Host validation warning'"
pip install playwright
playwright install --with-deps
- name: Display environment info
id: env_info
if: env.RUN_BUILD
if: ${{ ! matrix.EXCLUDE }}
shell: bash -l {0}
run: |
conda info
Expand All @@ -304,16 +364,16 @@ jobs:
pip install pipdeptree
pipdeptree
- name: 'Upload environment artifact'
if: env.RUN_BUILD
uses: actions/upload-artifact@v3
- name: Upload environment artifact
if: ${{ ! matrix.EXCLUDE }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.NAME }}_environment
path: ${{ matrix.NAME }}_environment.yml
retention-days: 5

- name: Check NumPy 2.0 Compatibility
if: env.RUN_BUILD
if: ${{ ! matrix.EXCLUDE }}
run: |
echo "============================================================="
echo "Check Dymos code for NumPy 2.0 compatibility"
Expand All @@ -323,7 +383,7 @@ jobs:
ruff check . --select NPY201
- name: Perform linting with Ruff
if: env.RUN_BUILD && matrix.NAME == 'baseline'
if: ${{ ! matrix.EXCLUDE && matrix.NAME == 'baseline' }}
run: |
echo "============================================================="
echo "Lint Dymos code per settings in pyproject.toml"
Expand All @@ -332,7 +392,7 @@ jobs:
ruff check . --config pyproject.toml
- name: Run tests
if: env.RUN_BUILD
if: ${{ ! matrix.EXCLUDE }}
env:
DYMOS_CHECK_PARTIALS: True
shell: bash -l {0}
Expand All @@ -353,7 +413,8 @@ jobs:
fi
- name: Submit coverage
if: ((github.event_name != 'workflow_dispatch') && (matrix.NAME != 'latest'))
if: github.event_name != 'workflow_dispatch'
continue-on-error: true
shell: bash -l {0}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -370,7 +431,8 @@ jobs:
coveralls:
name: Finish coveralls
if: (github.event_name != 'workflow_dispatch')
if: github.event_name != 'workflow_dispatch'
continue-on-error: true
needs: test_ubuntu
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 7904439

Please sign in to comment.