Skip to content

Commit

Permalink
Merge pull request #340 from WISDEM/ci_actions
Browse files Browse the repository at this point in the history
Ci actions and run examples cleanup
  • Loading branch information
gbarter authored Jan 11, 2025
2 parents 2d10640 + 66b2387 commit c2559f8
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 163 deletions.
52 changes: 50 additions & 2 deletions .github/workflows/CI_WEIS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Add test packages
run: |
conda install -y pytest pytest-cov coveralls
conda install -y pytest pytest-cov coveralls treon gdown
- name: Show custom environment
run: |
Expand Down Expand Up @@ -80,12 +80,60 @@ jobs:
#- name: List tests
# run: |
# pytest --collect-only weis

# Test walkthrough notebook
- name: Test postprocessing notebooks
if: contains( matrix.os, 'ubuntu') && contains( github.event_name, 'pull_request')
env:
RUN_EXHAUSTIVE: 1
run: |
cd examples/16_postprocessing
gdown --no-check-certificate 1AtLjjX5xpPqlHkfwDqeUj6VBMOYWcjmV
unzip outputs
treon plot_FAST.ipynb
treon rev_DLCs_WEIS.ipynb
treon rev_Opt.ipynb
treon rev_WEIS_CSV.ipynb
# Run all tests within WEIS, but not computationally expensive examples
- name: Run tests within WEIS
if: false == contains( matrix.os, 'ubuntu') || contains( github.event_name, 'push')
run: |
pytest -p no:warnings --disable-warnings --cov=weis weis
# Run long tests in on pull request
- name: Run exhaustive
if: contains( matrix.os, 'ubuntu') && contains( github.event_name, 'pull_request')
env:
RUN_EXHAUSTIVE: 1
run: |
pytest -p no:warnings --disable-warnings weis
# Run parallel script calling OpenFAST
- name: Run parallel cases
if: contains( matrix.os, 'ubuntu') && contains( github.event_name, 'pull_request')
env:
RUN_EXHAUSTIVE: 1
run: |
cd examples/02_run_openfast_cases
mpiexec -np 2 python weis_driver_loads.py
cd ../03_NREL5MW_OC3_spar
mpiexec -np 2 python weis_driver.py
cd ../05_IEA-3.4-130-RWT
mpiexec -np 2 python weis_driver.py
cd ../09_design_of_experiments
mpiexec -n 2 python DOE_raft.py
mpiexec -n 2 --bind-to core python DOE_openfast.py
python postprocess_results.py
cd ../17_IEA22_Optimization
mpiexec -n 2 python driver_weis_raft_opt.py
# Run scripts within dac folder
# - name: Run examples distributed aerodynamic control
# run: |
# cd examples/dac_flaps
# python dac_driver.py

# Run coveralls
- name: Run coveralls
if: contains( matrix.os, 'ubuntu') && contains( matrix.python-version, '3.11')
Expand Down
119 changes: 0 additions & 119 deletions .github/workflows/run_exhaustive_examples.yml

This file was deleted.

34 changes: 31 additions & 3 deletions weis/test/run_examples.py → weis/test/test_examples.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,59 @@
import os
import unittest
from weis.test.utils import execute_script

skinny_scripts = [
"02_run_openfast_cases/weis_driver_rosco_opt", #It's fast, I promise (49 sec. locally)
"02_run_openfast_cases/weis_driver_sm", #Not as fast as weis_driver, but not too bad (120 sec. locally)
"03_NREL5MW_OC3_spar/weis_freq_driver",
"05_IEA-3.4-130-RWT/weis_driver_model_only",
"06_IEA-15-240-RWT/weis_driver_monopile",
"06_IEA-15-240-RWT/weis_driver_TMDs",
"09_design_of_experiments/DOE_openfast",
# "13_DTQP/gen_oloc",
]


all_scripts = [
"01_aeroelasticse/run_general",
"01_aeroelasticse/run_OLAF",
"01_aeroelasticse/run_nodalOutputs",
#"02_run_openfast_cases/weis_driver_rosco_opt", # executed in examples_skinny
#"02_run_openfast_cases/weis_driver_sm", # executed in examples_skinny
"02_run_openfast_cases/weis_driver_loads",
"03_NREL5MW_OC3_spar/weis_driver",
# "03_NREL5MW_OC3_spar/weis_freq_driver", # executed in examples_skinny
# "04_NREL5MW_OC4_semi/weis_driver", # skipping until we resolve multiple variable ballasts
"04_NREL5MW_OC4_semi/weis_freq_driver",
"05_IEA-3.4-130-RWT/weis_driver", # also executed via mpi in the gitthub workflow
#"05_IEA-3.4-130-RWT/weis_driver_model_only", # executed in examples_skinny
#"06_IEA-15-240-RWT/weis_driver", # executed in the test_IEA15.py
#"06_IEA-15-240-RWT/weis_driver_monopile", # executed in examples_skinny
#"06_IEA-15-240-RWT/weis_driver_TMDs", # executed in examples_skinny
# "07_te_flaps/dac_driver",
"08_OLAF/weis_driver",
#"09_design_of_experiments/weis_driver", # executed in the test_DOE.py
#"09_design_of_experiments/DOE_openfast", # executed in examples_skinny
"10_override_example/weis_driver",
#"12_linearization/doe_driver", # Soul crushingly long
"12_linearization/weis_driver",
"15_RAFT_Studies/weis_driver_raft_opt"
"15_RAFT_Studies/weis_driver_raft_opt",
"17_IEA22_Optimization/driver_weis_openfast_opt",
"17_IEA22_Optimization/driver_weis_raft_opt"
"17_IEA22_Optimization/driver_weis_raft_opt",
]

class TestExamples(unittest.TestCase):

def test_skinny(self):
for ks,s in enumerate(skinny_scripts):
with self.subTest(f"Running: {s}", i=ks):
try:
execute_script(s)
self.assertTrue(True)
except:
self.assertEqual(s, "Success")

@unittest.skipUnless("RUN_EXHAUSTIVE" in os.environ, "exhaustive on pull request only")
def test_all_scripts(self):
for ks,s in enumerate(all_scripts):
with self.subTest(f"Running: {s}", i=ks):
Expand All @@ -34,7 +63,6 @@ def test_all_scripts(self):
except:
self.assertEqual(s, "Success")


def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestExamples))
Expand Down
39 changes: 0 additions & 39 deletions weis/test/test_examples_skinny.py

This file was deleted.

0 comments on commit c2559f8

Please sign in to comment.