From 53a50d97d2a3094fe022c6c93fbed38fab60664f Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Fri, 9 Feb 2024 13:47:33 -0800 Subject: [PATCH 01/16] removed unnecessary portion of if statement --- .github/workflows/notify_teams.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/notify_teams.yml b/.github/workflows/notify_teams.yml index 235d0e915..118a1194a 100644 --- a/.github/workflows/notify_teams.yml +++ b/.github/workflows/notify_teams.yml @@ -16,7 +16,7 @@ env: jobs: send_email_on_opened_pr: - if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && (github.event.action == 'opened' || github.event.action == 'reopened') + if: github.event.action == 'opened' || github.event.action == 'reopened' runs-on: ubuntu-latest steps: - name: Get PR Data @@ -52,7 +52,7 @@ jobs: nodemailerdebug: true send_email_on_updated_assignees: - if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'assigned' + if: github.event.action == 'assigned' runs-on: ubuntu-latest steps: - name: Get Updated Assignees @@ -82,7 +82,7 @@ jobs: nodemailerdebug: true send_email_on_closed_pr: - if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'closed' + if: github.event.action == 'closed' runs-on: ubuntu-latest steps: - name: Get PR Data From 1ba5507001500475f1148ac530380b62a3d507ce Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Fri, 9 Feb 2024 13:51:39 -0800 Subject: [PATCH 02/16] Moving to reusable workflows to separate doc and bench tests --- ...{test_workflow.yml => old_workflow.backup} | 0 .github/workflows/prepare_environment.yml | 178 ++++++++++++++++++ .github/workflows/test_benchmarks.yml | 55 ++++++ .github/workflows/test_docs.yml | 89 +++++++++ .github/workflows/test_workflow2.yml | 80 ++++++++ 5 files changed, 402 insertions(+) rename .github/workflows/{test_workflow.yml => old_workflow.backup} (100%) create mode 100644 .github/workflows/prepare_environment.yml create mode 100644 .github/workflows/test_benchmarks.yml create mode 100644 .github/workflows/test_docs.yml create mode 100644 .github/workflows/test_workflow2.yml diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/old_workflow.backup similarity index 100% rename from .github/workflows/test_workflow.yml rename to .github/workflows/old_workflow.backup diff --git a/.github/workflows/prepare_environment.yml b/.github/workflows/prepare_environment.yml new file mode 100644 index 000000000..c89ce4e22 --- /dev/null +++ b/.github/workflows/prepare_environment.yml @@ -0,0 +1,178 @@ +# Run Tests + +name: Prepare Environment + +on: + workflow_call: + inputs: + NAME: + required: true + type: string + PY: + required: true + type: string + NUMPY: + required: true + type: string + SCIPY: + required: true + type: string + PYOPTSPARSE: + required: true + type: string + SNOPT: + required: true + type: string + OPENMDAO: + required: true + type: string + DYMOS: + required: true + type: string + Run_tests: + required: false + type: boolean + secrets: + SSH_PRIVATE_KEY: + required: true + SSH_KNOWN_HOSTS: + required: true + SNOPT_LOCATION_77: + required: true + + # Allow running the workflow manually from the Actions tab + workflow_dispatch: + +jobs: + + test_ubuntu: + runs-on: ubuntu-latest + + timeout-minutes: 90 + + strategy: + fail-fast: false + + 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: ${{ inputs.PY }} + channels: conda-forge + + - name: Install dependencies + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Install dependencies" + echo "=============================================================" + conda install numpy=${{ inputs.NUMPY }} scipy=${{ inputs.SCIPY }} -q -y + conda install matplotlib pandas panel hvplot -q -y + pip install testflo -q + + - name: Install pyOptSparse + if: inputs.PYOPTSPARSE + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Install pyoptsparse" + echo "=============================================================" + if [[ "${{ inputs.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 [[ "${{ inputs.SNOPT }}" ]]; then + echo "SNOPT version ${{ inputs.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 ${{ inputs.PYOPTSPARSE }} $SNOPT + + - name: Install OpenMDAO + if: inputs.OPENMDAO + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Install OpenMDAO" + echo "=============================================================" + if [[ "${{ inputs.OPENMDAO }}" == "dev" ]]; then + pip install git+https://github.com/OpenMDAO/OpenMDAO + elif [[ "${{ inputs.OPENMDAO }}" == "latest" ]]; then + pip install openmdao + else + pip install openmdao==${{ inputs.OPENMDAO }} + fi + + - name: Install Dymos + if: inputs.DYMOS + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Install Dymos" + echo "=============================================================" + if [[ "${{ inputs.DYMOS }}" == "dev" ]]; then + pip install git+https://github.com/OpenMDAO/Dymos + elif [[ "${{ inputs.DYMOS }}" == "latest" ]]; then + pip install dymos + else + pip install dymos==${{ inputs.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 ${{ inputs.NAME }}_env --file ${{ inputs.NAME }}_environment.yml + + - name: 'Upload environment artifact' + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.NAME }}_environment + path: ${{ inputs.NAME }}_environment.yml + retention-days: 5 + + - name: Run tests + if: inputs.Run_tests + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Run Tests" + echo "=============================================================" + testflo . -n 1 --show_skipped --coverage --coverpkg aviary \ No newline at end of file diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml new file mode 100644 index 000000000..81d052bb3 --- /dev/null +++ b/.github/workflows/test_benchmarks.yml @@ -0,0 +1,55 @@ +# Run Tests + +name: Aviary Tests + +on: + # Trigger on push or pull request events for the main branch + push: + branches: [ main ] + pull_request: + branches: [ main ] + merge_group: + branches: [ main ] + + # Allow running the workflow manually from the Actions tab + workflow_dispatch: + +env: + PY: 3 + NUMPY: 1 + SCIPY: 1 + PYOPTSPARSE: 'v2.9.1' + SNOPT: '7.7' + OPENMDAO: 'latest' + DYMOS: 'latest' + +jobs: + + prepare_environment: + uses: ./.github/workflows/prepare_environment.yml + with: + NAME: ${{ env.NAME }} + PY: ${{ env.PY }} + NUMPY: ${{ env.NUMPY }} + SCIPY: ${{ env.SCIPY }} + PYOPTSPARSE: ${{ env.PYOPTSPARSE }} + SNOPT: ${{ env.SNOPT }} + OPENMDAO: ${{ env.OPENMDAO }} + DYMOS: ${{ env.DYMOS }} + secrets: inherit + + test_benchmarks: + runs-on: ubuntu-latest + + timeout-minutes: 90 + + needs: prepare_environment + + steps: + - name: Run benchmarks + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Run Benchmarks" + echo "=============================================================" + testflo . --testmatch=bench_test* diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml new file mode 100644 index 000000000..3bfd91997 --- /dev/null +++ b/.github/workflows/test_docs.yml @@ -0,0 +1,89 @@ +# Run Tests + +name: Aviary Tests + +on: + # Trigger on push or pull request events for the main branch + push: + branches: [ main ] + pull_request: + branches: [ main ] + merge_group: + branches: [ main ] + + # Allow running the workflow manually from the Actions tab + workflow_dispatch: + +env: + PY: 3 + NUMPY: 1 + SCIPY: 1 + PYOPTSPARSE: 'v2.9.1' + SNOPT: '7.7' + OPENMDAO: 'dev' + DYMOS: 'latest' + +jobs: + prepare_environment: + uses: ./.github/workflows/prepare_environment.yml + with: + NAME: ${{ env.NAME }} + PY: ${{ env.PY }} + NUMPY: ${{ env.NUMPY }} + SCIPY: ${{ env.SCIPY }} + PYOPTSPARSE: ${{ env.PYOPTSPARSE }} + SNOPT: ${{ env.SNOPT }} + OPENMDAO: ${{ env.OPENMDAO }} + DYMOS: ${{ env.DYMOS }} + secrets: inherit + + test_ubuntu: + runs-on: ubuntu-latest + + timeout-minutes: 90 + + needs: prepare_environment + + steps: + - name: Build docs + shell: bash -l {0} + run: | + pip install -U jupyter-book + cd aviary/docs + echo "=============================================================" + echo "Build the docs" + echo "=============================================================" + bash build_book.sh + + - name: Display doc build reports + continue-on-error: True + shell: bash -l {0} + run: | + cd $HOME/work/Aviary/Aviary/aviary/docs + find _build/html/reports/ -type f -name '*.log' \ + -exec echo "#################################################################" \; \ + -exec echo {} \; \ + -exec echo "#################################################################" \; \ + -exec cat {} \; + + - name: Publish docs to github.io + if: | + github.event_name == 'push' && github.ref == 'refs/heads/main' + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Publishing Docs to github.io" + echo "=============================================================" + pip install ghp-import + cd $HOME/work/Aviary/Aviary/aviary + ghp-import -n -p -f docs/_build/html + + - name: Scan for security issues + 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 diff --git a/.github/workflows/test_workflow2.yml b/.github/workflows/test_workflow2.yml new file mode 100644 index 000000000..390cc1335 --- /dev/null +++ b/.github/workflows/test_workflow2.yml @@ -0,0 +1,80 @@ +# Run Tests + +name: Aviary Tests + +on: + # Trigger on push or pull request events for the main branch + push: + branches: [ main ] + pull_request: + branches: [ main ] + merge_group: + branches: [ main ] + + # Allow running the workflow manually from the Actions tab + workflow_dispatch: + +jobs: + + pre_commit: + # 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/action@v3.0.0 + + test_ubuntu: + 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: 'dev' + DYMOS: '1.8.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' + + # latest versions of openmdao/dymos + - NAME: latest + PY: '3.10' + NUMPY: 1 + SCIPY: 1 + PYOPTSPARSE: 'v2.9.1' + SNOPT: '7.7' + OPENMDAO: 'dev' + DYMOS: 'latest' + + uses: ./.github/workflows/prepare_environment.yml + with: + NAME: ${{ matrix.NAME }} + PY: ${{ matrix.PY }} + NUMPY: ${{ matrix.NUMPY }} + SCIPY: ${{ matrix.SCIPY }} + PYOPTSPARSE: ${{ matrix.PYOPTSPARSE }} + SNOPT: ${{ matrix.SNOPT }} + OPENMDAO: ${{ matrix.OPENMDAO }} + DYMOS: ${{ matrix.DYMOS }} + Run_tests: true + secrets: inherit From adc2a72f8451de603c7631baeff29ffe1fe24bdb Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Fri, 9 Feb 2024 13:54:15 -0800 Subject: [PATCH 03/16] added missing names --- .github/workflows/test_benchmarks.yml | 1 + .github/workflows/test_docs.yml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index 81d052bb3..d7716335e 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -15,6 +15,7 @@ on: workflow_dispatch: env: + Name: 'latest' PY: 3 NUMPY: 1 SCIPY: 1 diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index 3bfd91997..110fd8364 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -15,6 +15,7 @@ on: workflow_dispatch: env: + Name: 'latest' PY: 3 NUMPY: 1 SCIPY: 1 @@ -37,7 +38,7 @@ jobs: DYMOS: ${{ env.DYMOS }} secrets: inherit - test_ubuntu: + test_docs: runs-on: ubuntu-latest timeout-minutes: 90 From 2f08f7964347a4ea8f6a9cb947a8032de9420d09 Mon Sep 17 00:00:00 2001 From: crecine <51181861+crecine@users.noreply.github.com> Date: Fri, 9 Feb 2024 14:40:23 -0800 Subject: [PATCH 04/16] Update test_workflow2.yml --- .github/workflows/test_workflow2.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_workflow2.yml b/.github/workflows/test_workflow2.yml index 390cc1335..29419eb23 100644 --- a/.github/workflows/test_workflow2.yml +++ b/.github/workflows/test_workflow2.yml @@ -8,6 +8,8 @@ on: branches: [ main ] pull_request: branches: [ main ] + pull_request_target: + branches: [ main ] merge_group: branches: [ main ] From aca7284ea63b773e4edcf72c97d5f555be2f0851 Mon Sep 17 00:00:00 2001 From: crecine <51181861+crecine@users.noreply.github.com> Date: Fri, 9 Feb 2024 14:40:42 -0800 Subject: [PATCH 05/16] Update test_docs.yml --- .github/workflows/test_docs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index 110fd8364..de8eb0e0c 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -8,6 +8,8 @@ on: branches: [ main ] pull_request: branches: [ main ] + pull_request_target: + branches: [ main ] merge_group: branches: [ main ] From c4ae874debf53aff82027737f19ac0b13654f283 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Fri, 9 Feb 2024 15:11:33 -0800 Subject: [PATCH 06/16] moved variables from env to job and test_ubuntu --- .github/workflows/prepare_environment.yml | 2 -- .github/workflows/test_benchmarks.yml | 27 +++++++---------------- .github/workflows/test_docs.yml | 27 +++++++---------------- .github/workflows/test_workflow2.yml | 4 ---- 4 files changed, 16 insertions(+), 44 deletions(-) diff --git a/.github/workflows/prepare_environment.yml b/.github/workflows/prepare_environment.yml index c89ce4e22..9c21eb6a8 100644 --- a/.github/workflows/prepare_environment.yml +++ b/.github/workflows/prepare_environment.yml @@ -47,9 +47,7 @@ jobs: test_ubuntu: runs-on: ubuntu-latest - timeout-minutes: 90 - strategy: fail-fast: false diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index d7716335e..48e38237d 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -14,36 +14,25 @@ on: # Allow running the workflow manually from the Actions tab workflow_dispatch: -env: - Name: 'latest' - PY: 3 - NUMPY: 1 - SCIPY: 1 - PYOPTSPARSE: 'v2.9.1' - SNOPT: '7.7' - OPENMDAO: 'latest' - DYMOS: 'latest' jobs: prepare_environment: uses: ./.github/workflows/prepare_environment.yml with: - NAME: ${{ env.NAME }} - PY: ${{ env.PY }} - NUMPY: ${{ env.NUMPY }} - SCIPY: ${{ env.SCIPY }} - PYOPTSPARSE: ${{ env.PYOPTSPARSE }} - SNOPT: ${{ env.SNOPT }} - OPENMDAO: ${{ env.OPENMDAO }} - DYMOS: ${{ env.DYMOS }} + NAME: 'latest' + PY: 3 + NUMPY: 1 + SCIPY: 1 + PYOPTSPARSE: 'v2.9.1' + SNOPT: '7.7' + OPENMDAO: 'latest' + DYMOS: 'latest' secrets: inherit test_benchmarks: runs-on: ubuntu-latest - timeout-minutes: 90 - needs: prepare_environment steps: diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index de8eb0e0c..a80e42a37 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -16,35 +16,24 @@ on: # Allow running the workflow manually from the Actions tab workflow_dispatch: -env: - Name: 'latest' - PY: 3 - NUMPY: 1 - SCIPY: 1 - PYOPTSPARSE: 'v2.9.1' - SNOPT: '7.7' - OPENMDAO: 'dev' - DYMOS: 'latest' jobs: prepare_environment: uses: ./.github/workflows/prepare_environment.yml with: - NAME: ${{ env.NAME }} - PY: ${{ env.PY }} - NUMPY: ${{ env.NUMPY }} - SCIPY: ${{ env.SCIPY }} - PYOPTSPARSE: ${{ env.PYOPTSPARSE }} - SNOPT: ${{ env.SNOPT }} - OPENMDAO: ${{ env.OPENMDAO }} - DYMOS: ${{ env.DYMOS }} + NAME: 'latest' + PY: 3 + NUMPY: 1 + SCIPY: 1 + PYOPTSPARSE: 'v2.9.1' + SNOPT: '7.7' + OPENMDAO: 'dev' + DYMOS: 'latest' secrets: inherit test_docs: runs-on: ubuntu-latest - timeout-minutes: 90 - needs: prepare_environment steps: diff --git a/.github/workflows/test_workflow2.yml b/.github/workflows/test_workflow2.yml index 29419eb23..73b0bc442 100644 --- a/.github/workflows/test_workflow2.yml +++ b/.github/workflows/test_workflow2.yml @@ -30,10 +30,6 @@ jobs: - uses: pre-commit/action@v3.0.0 test_ubuntu: - runs-on: ubuntu-latest - - timeout-minutes: 90 - strategy: fail-fast: false matrix: From 1bb6e35dc81b6aa6d2239cc7c666cb7d577d0333 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Fri, 9 Feb 2024 15:48:04 -0800 Subject: [PATCH 07/16] renamed jobs --- .github/workflows/test_benchmarks.yml | 4 ++-- .github/workflows/test_docs.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index 48e38237d..cce7fe820 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -17,7 +17,7 @@ on: jobs: - prepare_environment: + prepare_benchmarks_environment: uses: ./.github/workflows/prepare_environment.yml with: NAME: 'latest' @@ -33,7 +33,7 @@ jobs: test_benchmarks: runs-on: ubuntu-latest timeout-minutes: 90 - needs: prepare_environment + needs: prepare_benchmarks_environment steps: - name: Run benchmarks diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index a80e42a37..2ca855ae0 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -18,7 +18,7 @@ on: jobs: - prepare_environment: + prepare_docs_environment: uses: ./.github/workflows/prepare_environment.yml with: NAME: 'latest' @@ -34,7 +34,7 @@ jobs: test_docs: runs-on: ubuntu-latest timeout-minutes: 90 - needs: prepare_environment + needs: prepare_docs_environment steps: - name: Build docs From 72be49364cc62447d00ef4959c519bca773bb313 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Thu, 14 Mar 2024 13:03:14 -0700 Subject: [PATCH 08/16] testing --- .github/workflows/prepare_environment.yml | 7 ----- .github/workflows/test_benchmarks.yml | 26 +++++++++--------- .github/workflows/test_docs.yml | 27 +++++++++---------- .../{test_workflow2.yml => test_workflow.yml} | 0 4 files changed, 25 insertions(+), 35 deletions(-) rename .github/workflows/{test_workflow2.yml => test_workflow.yml} (100%) diff --git a/.github/workflows/prepare_environment.yml b/.github/workflows/prepare_environment.yml index 9c21eb6a8..4adb43d7e 100644 --- a/.github/workflows/prepare_environment.yml +++ b/.github/workflows/prepare_environment.yml @@ -32,13 +32,6 @@ on: Run_tests: required: false type: boolean - secrets: - SSH_PRIVATE_KEY: - required: true - SSH_KNOWN_HOSTS: - required: true - SNOPT_LOCATION_77: - required: true # Allow running the workflow manually from the Actions tab workflow_dispatch: diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index cce7fe820..20e25ed0d 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -17,25 +17,23 @@ on: jobs: - prepare_benchmarks_environment: - uses: ./.github/workflows/prepare_environment.yml - with: - NAME: 'latest' - PY: 3 - NUMPY: 1 - SCIPY: 1 - PYOPTSPARSE: 'v2.9.1' - SNOPT: '7.7' - OPENMDAO: 'latest' - DYMOS: 'latest' - secrets: inherit - test_benchmarks: runs-on: ubuntu-latest timeout-minutes: 90 - needs: prepare_benchmarks_environment steps: + - name: prepare_docs_environment + uses: ./.github/workflows/prepare_environment.yml + with: + NAME: 'latest' + PY: 3 + NUMPY: 1 + SCIPY: 1 + PYOPTSPARSE: 'v2.9.1' + SNOPT: '7.7' + OPENMDAO: 'dev' + DYMOS: 'latest' + - name: Run benchmarks shell: bash -l {0} run: | diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index 2ca855ae0..68803baba 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -18,25 +18,24 @@ on: jobs: - prepare_docs_environment: - uses: ./.github/workflows/prepare_environment.yml - with: - NAME: 'latest' - PY: 3 - NUMPY: 1 - SCIPY: 1 - PYOPTSPARSE: 'v2.9.1' - SNOPT: '7.7' - OPENMDAO: 'dev' - DYMOS: 'latest' - secrets: inherit - + test_docs: runs-on: ubuntu-latest timeout-minutes: 90 - needs: prepare_docs_environment steps: + - name: prepare_docs_environment + uses: ./.github/workflows/prepare_environment.yml + with: + NAME: 'latest' + PY: 3 + NUMPY: 1 + SCIPY: 1 + PYOPTSPARSE: 'v2.9.1' + SNOPT: '7.7' + OPENMDAO: 'dev' + DYMOS: 'latest' + - name: Build docs shell: bash -l {0} run: | diff --git a/.github/workflows/test_workflow2.yml b/.github/workflows/test_workflow.yml similarity index 100% rename from .github/workflows/test_workflow2.yml rename to .github/workflows/test_workflow.yml From ff9a0beba98c9067fcd853fd1e32caf43d4d8550 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Thu, 14 Mar 2024 14:08:58 -0700 Subject: [PATCH 09/16] moving from reusable workflow to composite actions --- .../actions/prepare_environment/action.yml | 162 +++++++++++++++++ .github/workflows/prepare_environment.yml | 169 ------------------ .github/workflows/test_benchmarks.yml | 12 +- .github/workflows/test_docs.yml | 14 +- .github/workflows/test_workflow.yml | 36 ++-- 5 files changed, 209 insertions(+), 184 deletions(-) create mode 100644 .github/actions/prepare_environment/action.yml delete mode 100644 .github/workflows/prepare_environment.yml diff --git a/.github/actions/prepare_environment/action.yml b/.github/actions/prepare_environment/action.yml new file mode 100644 index 000000000..8c4c64c8e --- /dev/null +++ b/.github/actions/prepare_environment/action.yml @@ -0,0 +1,162 @@ +name: Prepare Environment + +inputs: + NAME: + required: true + type: string + PY: + required: true + type: string + NUMPY: + required: true + type: string + SCIPY: + required: true + type: string + PYOPTSPARSE: + required: true + type: string + SNOPT: + required: true + type: string + OPENMDAO: + required: true + type: string + DYMOS: + required: true + type: string + Run_tests: + required: false + type: boolean + SSH_PRIVATE_KEY: + required: true + SSH_KNOWN_HOSTS: + required: true + SNOPT_LOCATION_77: + required: true + +runs: + using: "composite" + 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: ${{inputs.SSH_PRIVATE_KEY}} + SSH_KNOWN_HOSTS: ${{inputs.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: ${{ inputs.PY }} + channels: conda-forge + + - name: Install dependencies + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Install dependencies" + echo "=============================================================" + conda install numpy=${{ inputs.NUMPY }} scipy=${{ inputs.SCIPY }} -q -y + conda install matplotlib pandas panel hvplot -q -y + pip install testflo -q + + - name: Install pyOptSparse + if: inputs.PYOPTSPARSE + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Install pyoptsparse" + echo "=============================================================" + if [[ "${{ inputs.SNOPT }}" == "7.7" && "${{ inputs.SNOPT_LOCATION_77 }}" ]]; then + mkdir SNOPT + echo " > Secure copying SNOPT 7.7 over SSH" + scp -qr ${{ inputs.SNOPT_LOCATION_77 }} SNOPT + SNOPT="-s SNOPT/src" + elif [[ "${{ inputs.SNOPT }}" ]]; then + echo "SNOPT version ${{ inputs.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 ${{ inputs.PYOPTSPARSE }} $SNOPT + + - name: Install OpenMDAO + if: inputs.OPENMDAO + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Install OpenMDAO" + echo "=============================================================" + if [[ "${{ inputs.OPENMDAO }}" == "dev" ]]; then + pip install git+https://github.com/OpenMDAO/OpenMDAO + elif [[ "${{ inputs.OPENMDAO }}" == "latest" ]]; then + pip install openmdao + else + pip install openmdao==${{ inputs.OPENMDAO }} + fi + + - name: Install Dymos + if: inputs.DYMOS + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Install Dymos" + echo "=============================================================" + if [[ "${{ inputs.DYMOS }}" == "dev" ]]; then + pip install git+https://github.com/OpenMDAO/Dymos + elif [[ "${{ inputs.DYMOS }}" == "latest" ]]; then + pip install dymos + else + pip install dymos==${{ inputs.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 ${{ inputs.NAME }}_env --file ${{ inputs.NAME }}_environment.yml + + - name: 'Upload environment artifact' + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.NAME }}_environment + path: ${{ inputs.NAME }}_environment.yml + retention-days: 5 + + - name: Run tests + if: inputs.Run_tests + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Run Tests" + echo "=============================================================" + testflo . -n 1 --show_skipped --coverage --coverpkg aviary \ No newline at end of file diff --git a/.github/workflows/prepare_environment.yml b/.github/workflows/prepare_environment.yml deleted file mode 100644 index 4adb43d7e..000000000 --- a/.github/workflows/prepare_environment.yml +++ /dev/null @@ -1,169 +0,0 @@ -# Run Tests - -name: Prepare Environment - -on: - workflow_call: - inputs: - NAME: - required: true - type: string - PY: - required: true - type: string - NUMPY: - required: true - type: string - SCIPY: - required: true - type: string - PYOPTSPARSE: - required: true - type: string - SNOPT: - required: true - type: string - OPENMDAO: - required: true - type: string - DYMOS: - required: true - type: string - Run_tests: - required: false - type: boolean - - # Allow running the workflow manually from the Actions tab - workflow_dispatch: - -jobs: - - test_ubuntu: - runs-on: ubuntu-latest - timeout-minutes: 90 - strategy: - fail-fast: false - - 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: ${{ inputs.PY }} - channels: conda-forge - - - name: Install dependencies - shell: bash -l {0} - run: | - echo "=============================================================" - echo "Install dependencies" - echo "=============================================================" - conda install numpy=${{ inputs.NUMPY }} scipy=${{ inputs.SCIPY }} -q -y - conda install matplotlib pandas panel hvplot -q -y - pip install testflo -q - - - name: Install pyOptSparse - if: inputs.PYOPTSPARSE - shell: bash -l {0} - run: | - echo "=============================================================" - echo "Install pyoptsparse" - echo "=============================================================" - if [[ "${{ inputs.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 [[ "${{ inputs.SNOPT }}" ]]; then - echo "SNOPT version ${{ inputs.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 ${{ inputs.PYOPTSPARSE }} $SNOPT - - - name: Install OpenMDAO - if: inputs.OPENMDAO - shell: bash -l {0} - run: | - echo "=============================================================" - echo "Install OpenMDAO" - echo "=============================================================" - if [[ "${{ inputs.OPENMDAO }}" == "dev" ]]; then - pip install git+https://github.com/OpenMDAO/OpenMDAO - elif [[ "${{ inputs.OPENMDAO }}" == "latest" ]]; then - pip install openmdao - else - pip install openmdao==${{ inputs.OPENMDAO }} - fi - - - name: Install Dymos - if: inputs.DYMOS - shell: bash -l {0} - run: | - echo "=============================================================" - echo "Install Dymos" - echo "=============================================================" - if [[ "${{ inputs.DYMOS }}" == "dev" ]]; then - pip install git+https://github.com/OpenMDAO/Dymos - elif [[ "${{ inputs.DYMOS }}" == "latest" ]]; then - pip install dymos - else - pip install dymos==${{ inputs.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 ${{ inputs.NAME }}_env --file ${{ inputs.NAME }}_environment.yml - - - name: 'Upload environment artifact' - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.NAME }}_environment - path: ${{ inputs.NAME }}_environment.yml - retention-days: 5 - - - name: Run tests - if: inputs.Run_tests - shell: bash -l {0} - run: | - echo "=============================================================" - echo "Run Tests" - echo "=============================================================" - testflo . -n 1 --show_skipped --coverage --coverpkg aviary \ No newline at end of file diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index 20e25ed0d..2f80cbb55 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -22,8 +22,15 @@ jobs: timeout-minutes: 90 steps: + - name: Checkout actions + uses: actions/checkout@v3 + with: + sparse-checkout: | + .github/actions + path: actions + - name: prepare_docs_environment - uses: ./.github/workflows/prepare_environment.yml + uses: ./actions/.github/actions/prepare_environment with: NAME: 'latest' PY: 3 @@ -33,6 +40,9 @@ jobs: SNOPT: '7.7' OPENMDAO: 'dev' DYMOS: 'latest' + SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} + SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} + SNOPT_LOCATION_77: ${{ secrets.SNOPT_LOCATION_77 }} - name: Run benchmarks shell: bash -l {0} diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index 68803baba..bded7259b 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -18,14 +18,21 @@ on: jobs: - + test_docs: runs-on: ubuntu-latest timeout-minutes: 90 steps: + - name: Checkout actions + uses: actions/checkout@v3 + with: + sparse-checkout: | + .github/actions + path: actions + - name: prepare_docs_environment - uses: ./.github/workflows/prepare_environment.yml + uses: ./actions/.github/actions/prepare_environment with: NAME: 'latest' PY: 3 @@ -35,6 +42,9 @@ jobs: SNOPT: '7.7' OPENMDAO: 'dev' DYMOS: 'latest' + SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} + SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} + SNOPT_LOCATION_77: ${{ secrets.SNOPT_LOCATION_77 }} - name: Build docs shell: bash -l {0} diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index 73b0bc442..4baf45f19 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -30,6 +30,7 @@ jobs: - uses: pre-commit/action@v3.0.0 test_ubuntu: + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -64,15 +65,26 @@ jobs: OPENMDAO: 'dev' DYMOS: 'latest' - uses: ./.github/workflows/prepare_environment.yml - with: - NAME: ${{ matrix.NAME }} - PY: ${{ matrix.PY }} - NUMPY: ${{ matrix.NUMPY }} - SCIPY: ${{ matrix.SCIPY }} - PYOPTSPARSE: ${{ matrix.PYOPTSPARSE }} - SNOPT: ${{ matrix.SNOPT }} - OPENMDAO: ${{ matrix.OPENMDAO }} - DYMOS: ${{ matrix.DYMOS }} - Run_tests: true - secrets: inherit + steps: + - name: Checkout actions + uses: actions/checkout@v3 + with: + sparse-checkout: | + .github/actions + path: actions + + - name: prepare_docs_environment + uses: ./actions/.github/actions/prepare_environment + with: + NAME: ${{ matrix.NAME }} + PY: ${{ matrix.PY }} + NUMPY: ${{ matrix.NUMPY }} + SCIPY: ${{ matrix.SCIPY }} + PYOPTSPARSE: ${{ matrix.PYOPTSPARSE }} + SNOPT: ${{ matrix.SNOPT }} + OPENMDAO: ${{ matrix.OPENMDAO }} + DYMOS: ${{ matrix.DYMOS }} + Run_tests: true + SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} + SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} + SNOPT_LOCATION_77: ${{ secrets.SNOPT_LOCATION_77 }} \ No newline at end of file From f8fe963a7c73e8b25ae974f7ee94a4afbf0a7507 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Thu, 14 Mar 2024 14:14:28 -0700 Subject: [PATCH 10/16] fixing test failure --- .github/actions/prepare_environment/action.yml | 3 ++- .github/workflows/test_workflow.yml | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/actions/prepare_environment/action.yml b/.github/actions/prepare_environment/action.yml index 8c4c64c8e..6ad6df825 100644 --- a/.github/actions/prepare_environment/action.yml +++ b/.github/actions/prepare_environment/action.yml @@ -39,6 +39,7 @@ runs: using: "composite" steps: - name: Display run details + shell: bash run: | echo "=============================================================" echo "Run #${GITHUB_RUN_NUMBER}" @@ -128,7 +129,7 @@ runs: fi - name: Checkout Aviary - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Aviary shell: bash -l {0} diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index 4baf45f19..5cc4689d8 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -23,11 +23,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.11' - - uses: pre-commit/action@v3.0.0 + - uses: pre-commit/action@v3.0.1 test_ubuntu: runs-on: ubuntu-latest @@ -67,7 +67,7 @@ jobs: steps: - name: Checkout actions - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: sparse-checkout: | .github/actions From 0eaa02f8cc2248e8233672f244f6110adcfc1ca7 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Thu, 14 Mar 2024 14:20:19 -0700 Subject: [PATCH 11/16] updated naming and organization --- .github/workflows/test_benchmarks.yml | 4 ++-- .github/workflows/test_docs.yml | 4 ++-- .github/workflows/test_workflow.yml | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index 2f80cbb55..e1016ea8d 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -1,6 +1,6 @@ # Run Tests -name: Aviary Tests +name: Test Benchmarks on: # Trigger on push or pull request events for the main branch @@ -17,7 +17,7 @@ on: jobs: - test_benchmarks: + latest_benchmarks: runs-on: ubuntu-latest timeout-minutes: 90 diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index bded7259b..690616b7b 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -1,6 +1,6 @@ # Run Tests -name: Aviary Tests +name: Test Docs on: # Trigger on push or pull request events for the main branch @@ -19,7 +19,7 @@ on: jobs: - test_docs: + latest_docs: runs-on: ubuntu-latest timeout-minutes: 90 diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index 5cc4689d8..dc41c834e 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -45,25 +45,25 @@ jobs: OPENMDAO: 'dev' DYMOS: '1.8.0' - # development versions of openmdao/dymos - - NAME: dev - PY: 3 + # latest versions of openmdao/dymos + - NAME: latest + PY: '3.10' NUMPY: 1 SCIPY: 1 PYOPTSPARSE: 'v2.9.1' SNOPT: '7.7' OPENMDAO: 'dev' - DYMOS: 'dev' + DYMOS: 'latest' - # latest versions of openmdao/dymos - - NAME: latest - PY: '3.10' + # development versions of openmdao/dymos + - NAME: dev + PY: 3 NUMPY: 1 SCIPY: 1 PYOPTSPARSE: 'v2.9.1' SNOPT: '7.7' OPENMDAO: 'dev' - DYMOS: 'latest' + DYMOS: 'dev' steps: - name: Checkout actions From 5e231a261b6b9c49e58c6fa01400578ee3a57457 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Thu, 14 Mar 2024 14:47:34 -0700 Subject: [PATCH 12/16] experimenting --- .github/actions/prepare_environment/action.yml | 1 + .github/workflows/test_benchmarks.yml | 9 ++++++++- .github/workflows/test_docs.yml | 3 +-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/actions/prepare_environment/action.yml b/.github/actions/prepare_environment/action.yml index 6ad6df825..5254c1d15 100644 --- a/.github/actions/prepare_environment/action.yml +++ b/.github/actions/prepare_environment/action.yml @@ -130,6 +130,7 @@ runs: - name: Checkout Aviary uses: actions/checkout@v4 + # Default: ${{ github.repository }} - name: Install Aviary shell: bash -l {0} diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index e1016ea8d..915045328 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -29,7 +29,7 @@ jobs: .github/actions path: actions - - name: prepare_docs_environment + - name: prepare_benchmark_environment uses: ./actions/.github/actions/prepare_environment with: NAME: 'latest' @@ -51,3 +51,10 @@ jobs: echo "Run Benchmarks" echo "=============================================================" testflo . --testmatch=bench_test* + + - name: Checkout actions (again) + uses: actions/checkout@v3 + with: + sparse-checkout: | + .github/actions + path: actions diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index 690616b7b..c680f3a4e 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -29,10 +29,9 @@ jobs: with: sparse-checkout: | .github/actions - path: actions - name: prepare_docs_environment - uses: ./actions/.github/actions/prepare_environment + uses: ./.github/actions/prepare_environment with: NAME: 'latest' PY: 3 From 970c71ea6ec78f3aa2c93ca1fb770d6ffb814a90 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Thu, 14 Mar 2024 15:00:47 -0700 Subject: [PATCH 13/16] adding checkout to end of workflow for post test steps --- .github/actions/prepare_environment/action.yml | 1 - .github/workflows/test_docs.yml | 10 +++++++++- .github/workflows/test_workflow.yml | 11 +++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/actions/prepare_environment/action.yml b/.github/actions/prepare_environment/action.yml index 5254c1d15..6ad6df825 100644 --- a/.github/actions/prepare_environment/action.yml +++ b/.github/actions/prepare_environment/action.yml @@ -130,7 +130,6 @@ runs: - name: Checkout Aviary uses: actions/checkout@v4 - # Default: ${{ github.repository }} - name: Install Aviary shell: bash -l {0} diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index c680f3a4e..245480142 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -29,9 +29,10 @@ jobs: with: sparse-checkout: | .github/actions + path: actions - name: prepare_docs_environment - uses: ./.github/actions/prepare_environment + uses: ./actions/.github/actions/prepare_environment with: NAME: 'latest' PY: 3 @@ -87,3 +88,10 @@ jobs: echo "=============================================================" cd $GITHUB_WORKSPACE python -m bandit -r -ll aviary + + - name: Checkout actions (again) + uses: actions/checkout@v3 + with: + sparse-checkout: | + .github/actions + path: actions \ No newline at end of file diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index dc41c834e..3add2bb72 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -73,7 +73,7 @@ jobs: .github/actions path: actions - - name: prepare_docs_environment + - name: prepare_testing_environment uses: ./actions/.github/actions/prepare_environment with: NAME: ${{ matrix.NAME }} @@ -87,4 +87,11 @@ jobs: Run_tests: true SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} - SNOPT_LOCATION_77: ${{ secrets.SNOPT_LOCATION_77 }} \ No newline at end of file + SNOPT_LOCATION_77: ${{ secrets.SNOPT_LOCATION_77 }} + + - name: Checkout actions (again) + uses: actions/checkout@v3 + with: + sparse-checkout: | + .github/actions + path: actions \ No newline at end of file From eecbd3a841d478fb9d56fd6db528b4f9020486f3 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Thu, 14 Mar 2024 15:07:05 -0700 Subject: [PATCH 14/16] moved run tests out of prepare_environment --- .github/actions/prepare_environment/action.yml | 13 +------------ .github/workflows/test_workflow.yml | 9 ++++++++- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/actions/prepare_environment/action.yml b/.github/actions/prepare_environment/action.yml index 6ad6df825..468b83763 100644 --- a/.github/actions/prepare_environment/action.yml +++ b/.github/actions/prepare_environment/action.yml @@ -25,9 +25,6 @@ inputs: DYMOS: required: true type: string - Run_tests: - required: false - type: boolean SSH_PRIVATE_KEY: required: true SSH_KNOWN_HOSTS: @@ -152,12 +149,4 @@ runs: name: ${{ inputs.NAME }}_environment path: ${{ inputs.NAME }}_environment.yml retention-days: 5 - - - name: Run tests - if: inputs.Run_tests - shell: bash -l {0} - run: | - echo "=============================================================" - echo "Run Tests" - echo "=============================================================" - testflo . -n 1 --show_skipped --coverage --coverpkg aviary \ No newline at end of file + \ No newline at end of file diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index 3add2bb72..b7924bf78 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -84,11 +84,18 @@ jobs: SNOPT: ${{ matrix.SNOPT }} OPENMDAO: ${{ matrix.OPENMDAO }} DYMOS: ${{ matrix.DYMOS }} - Run_tests: true SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} SNOPT_LOCATION_77: ${{ secrets.SNOPT_LOCATION_77 }} + - name: Run tests + shell: bash -l {0} + run: | + echo "=============================================================" + echo "Run Tests" + echo "=============================================================" + testflo . -n 1 --show_skipped --coverage --coverpkg aviary + - name: Checkout actions (again) uses: actions/checkout@v3 with: From 1f2ac131802d429f3878b361669702d2877451eb Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Thu, 14 Mar 2024 15:11:12 -0700 Subject: [PATCH 15/16] removed old backup --- .github/workflows/old_workflow.backup | 277 -------------------------- 1 file changed, 277 deletions(-) delete mode 100644 .github/workflows/old_workflow.backup diff --git a/.github/workflows/old_workflow.backup b/.github/workflows/old_workflow.backup deleted file mode 100644 index 94f5111c7..000000000 --- a/.github/workflows/old_workflow.backup +++ /dev/null @@ -1,277 +0,0 @@ -# Run Tests - -name: Aviary Tests - -on: - # Trigger on push or pull request events for the main branch - push: - branches: [ main ] - pull_request: - branches: [ main ] - merge_group: - branches: [ main ] - - # Allow running the workflow manually from the Actions tab - workflow_dispatch: - -jobs: - - pre_commit: - # run pre-commit checks - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: pre-commit/action@v3.0.1 - - test_ubuntu: - 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: 'dev' - DYMOS: '1.8.0' - MAKE_DOCS: 0 - RUN_BENCHES: 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' - MAKE_DOCS: 0 - RUN_BENCHES: 0 - - # latest versions of openmdao/dymos - - NAME: latest - PY: '3.10' - NUMPY: 1 - SCIPY: 1 - PYOPTSPARSE: 'v2.9.1' - SNOPT: '7.7' - OPENMDAO: 'dev' - DYMOS: 'latest' - MAKE_DOCS: 0 - RUN_BENCHES: 0 - - # latest versions of openmdao/dymos for docs only - - NAME: latest_docs - PY: 3 - NUMPY: 1 - SCIPY: 1 - PYOPTSPARSE: 'v2.9.1' - SNOPT: '7.7' - OPENMDAO: 'dev' - DYMOS: 'latest' - MAKE_DOCS: 1 - RUN_BENCHES: 0 - - # latest versions of openmdao/dymos for benches only - - NAME: latest_benches - PY: 3 - NUMPY: 1 - SCIPY: 1 - PYOPTSPARSE: 'v2.9.1' - SNOPT: '7.7' - OPENMDAO: 'latest' - DYMOS: 'latest' - MAKE_DOCS: 0 - RUN_BENCHES: 1 - - 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 }} - channels: conda-forge - - - 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 -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 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@v4 - - - 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 --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: Run tests - if: matrix.MAKE_DOCS == 0 && matrix.RUN_BENCHES == 0 - shell: bash -l {0} - run: | - echo "=============================================================" - echo "Run Tests" - echo "=============================================================" - testflo . -n 1 --show_skipped --coverage --coverpkg aviary - - - name: Run benchmarks - if: matrix.RUN_BENCHES - shell: bash -l {0} - run: | - echo "=============================================================" - echo "Run Benchmarks" - echo "=============================================================" - testflo . --testmatch=bench_test* - - - name: Build docs - if: matrix.MAKE_DOCS - shell: bash -l {0} - run: | - pip install -U jupyter-book - cd aviary/docs - echo "=============================================================" - echo "Build the docs" - echo "=============================================================" - bash build_book.sh - - - name: Display doc build reports - continue-on-error: True - if: matrix.MAKE_DOCS - shell: bash -l {0} - run: | - cd $HOME/work/Aviary/Aviary/aviary/docs - find _build/html/reports/ -type f -name '*.log' \ - -exec echo "#################################################################" \; \ - -exec echo {} \; \ - -exec echo "#################################################################" \; \ - -exec cat {} \; - - - name: Publish docs to github.io - if: | - github.event_name == 'push' && github.ref == 'refs/heads/main' && - matrix.MAKE_DOCS - shell: bash -l {0} - run: | - echo "=============================================================" - echo "Publishing Docs to github.io" - echo "=============================================================" - pip install ghp-import - cd $HOME/work/Aviary/Aviary/aviary - ghp-import -n -p -f docs/_build/html - - - name: Scan for security issues - if: matrix.MAKE_DOCS - 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 From ff103e2f55fa62f7a8a950e597f67dd920ec42a5 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Fri, 15 Mar 2024 10:21:22 -0700 Subject: [PATCH 16/16] updated versions due to release of OpenMDAO 3.31.0 --- .github/workflows/test_benchmarks.yml | 2 +- .github/workflows/test_docs.yml | 2 +- .github/workflows/test_workflow.yml | 4 ++-- .github/workflows/test_workflow_no_dev_install.yml | 10 ---------- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index 915045328..668aa68a7 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -38,7 +38,7 @@ jobs: SCIPY: 1 PYOPTSPARSE: 'v2.9.1' SNOPT: '7.7' - OPENMDAO: 'dev' + OPENMDAO: 'latest' DYMOS: 'latest' SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml index 245480142..a83ea3222 100644 --- a/.github/workflows/test_docs.yml +++ b/.github/workflows/test_docs.yml @@ -40,7 +40,7 @@ jobs: SCIPY: 1 PYOPTSPARSE: 'v2.9.1' SNOPT: '7.7' - OPENMDAO: 'dev' + OPENMDAO: 'latest' DYMOS: 'latest' SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index b7924bf78..1a69c26db 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -42,7 +42,7 @@ jobs: SCIPY: '1.6' PYOPTSPARSE: 'v2.9.1' SNOPT: '7.7' - OPENMDAO: 'dev' + OPENMDAO: '3.31.0' DYMOS: '1.8.0' # latest versions of openmdao/dymos @@ -52,7 +52,7 @@ jobs: SCIPY: 1 PYOPTSPARSE: 'v2.9.1' SNOPT: '7.7' - OPENMDAO: 'dev' + OPENMDAO: 'latest' DYMOS: 'latest' # development versions of openmdao/dymos diff --git a/.github/workflows/test_workflow_no_dev_install.yml b/.github/workflows/test_workflow_no_dev_install.yml index f994dc9c6..160e10527 100644 --- a/.github/workflows/test_workflow_no_dev_install.yml +++ b/.github/workflows/test_workflow_no_dev_install.yml @@ -58,16 +58,6 @@ jobs: python-version: ${{ matrix.PY }} channels: conda-forge - - name: Install OpenMDAO Dev - shell: bash -l {0} - run: | - echo "=============================================================" - echo "THIS STEP IS TEMPORARY" - echo "Please remove after the release of OpenMDAO 3.31." - echo "Install OpenMDAO" - echo "=============================================================" - pip install git+https://github.com/OpenMDAO/OpenMDAO - - name: Checkout Aviary uses: actions/checkout@v4