WEIS v2.1 #3095
This file contains hidden or 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
| name: CI_WEIS | |
| # We run CI on push commits on all branches | |
| on: [push, pull_request] | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.os }} Python ${{ matrix.python-version }}) | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["ubuntu-latest", "macOS-14", "windows-latest"] # mac13 is intel, mac-14 arm | |
| python-version: ["3.11","3.12","3.13"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install conda/mamba | |
| uses: conda-incubator/setup-miniconda@v3 | |
| # https://github.com/marketplace/actions/setup-miniconda | |
| with: | |
| # To use mamba, uncomment here, comment out the miniforge line | |
| # mamba-version: "*" | |
| miniforge-version: "latest" | |
| auto-update-conda: true | |
| python-version: ${{ matrix.python-version }} | |
| environment-file: environment.yml | |
| activate-environment: test | |
| auto-activate-base: false | |
| #- name: Add dependencies windows specific | |
| # if: contains( matrix.os, 'windows') | |
| # run: | | |
| # conda install -y -c intel intel-openmp mkl | |
| # Enable the next entries to use feature branches of dependencies for CI testing | |
| # - name: Add dependencies ubuntu specific | |
| # if: false == contains( matrix.os, 'windows') | |
| # run: | | |
| # conda install -y compilers | |
| # - name: Add dependencies windows specific | |
| # if: contains( matrix.os, 'windows') | |
| # run: | | |
| # conda install -y gfortran libpython | |
| # pip install --no-deps control | |
| # - name: feature branches of other codes | |
| # run: | | |
| # conda remove --force openraft | |
| # pip install https://github.com/yqliaohk/RAFT/archive/meshing_update.zip | |
| # Don't delete after this | |
| - name: Add dependencies ubuntu specific | |
| if: contains( matrix.os, 'ubuntu') | |
| run: | | |
| sudo apt install -y libglu1-mesa | |
| conda install -c conda-forge -y petsc4py mpi4py pyoptsparse mpich | |
| pip install pygmsh==7.1.17 | |
| pip install https://github.com/LHEEA/meshmagick/archive/master.zip | |
| which -a mpiexec | |
| which -a mpirun | |
| - name: Add test packages | |
| run: | | |
| conda install -y pytest pytest-cov coveralls treon gdown | |
| - name: Show custom environment | |
| run: | | |
| conda list | |
| printenv | sort | |
| # Install WEIS | |
| - name: Install WEIS | |
| run: | | |
| python -m pip install --no-deps -e . -v | |
| # Debugging session | |
| #- name: Setup tmate session | |
| # if: contains( matrix.os, 'windows') | |
| # uses: mxschmitt/action-tmate@v3 | |
| #- name: Show openfast environment | |
| # run: | | |
| # which -a openfast | |
| # cd /c/Miniconda3/envs/test/Library/bin/ | |
| # ls *fast*.exe | |
| # ls *fast*.dll | |
| # openfast -h | |
| # python -c "import ctypes; ctypes.cdll.LoadLibrary('openfastlib.dll')" | |
| # ls *fast*.dll | |
| # cd examples/03_NREL5MW_OC3_spar | |
| # python weis_driver.py | |
| # List the collected tests for debugging purposes | |
| #- name: List tests | |
| # run: | | |
| # pytest --collect-only weis | |
| - name: Change examples to test mode | |
| run: | | |
| cd examples | |
| if [[ "$RUNNER_OS" == "macOS" ]]; then | |
| find . -type f -name "*.py" -exec sed -i '' 's/TEST_RUN = False/TEST_RUN = True/g' {} + | |
| else | |
| find . -type f -name "*.py" -exec sed -i 's/TEST_RUN = False/TEST_RUN = True/g' {} + | |
| fi | |
| head -n 5 02_generate_openfast_model_for_dlcs/iea15_semi_driver.py # check that the sed command worked | |
| # 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 -s --disable-warnings 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/07_postprocessing_notebooks | |
| cp -r ../03_design_with_openfast/outputs/03_iea22_ptfm_opt/ outputs/ | |
| treon plot_FAST.ipynb | |
| treon rev_DLCs_WEIS.ipynb | |
| treon rev_Opt.ipynb | |
| treon rev_WEIS_CSV.ipynb | |
| - name: Test preprocessing notebooks | |
| if: contains( matrix.os, 'ubuntu') && contains( github.event_name, 'pull_request') | |
| run: | | |
| cd examples/09_preprocessing/fatigue | |
| treon Fatigue_Setup.ipynb | |
| - name: Test model creation notebooks and drivers | |
| if: contains( matrix.os, 'ubuntu') && contains( github.event_name, 'pull_request') | |
| run: | | |
| cd examples/11_model_creation_process | |
| treon 0_notebooks/chapter1.ipynb | |
| treon 0_notebooks/chapter2.ipynb | |
| treon 0_notebooks/chapter3.ipynb | |
| # 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/01_simulate_own_openfast_model | |
| mpiexec -np 2 python dlc_sim_driver.py | |
| cd ../06_parametric_analysis | |
| mpiexec -n 2 python raft_doe_driver.py | |
| mpiexec -n 2 --bind-to core python openfast_doe_driver.py | |
| python postprocess_results.py | |
| # Skip these until we figure out MPI and overrides | |
| # cd ../03_design_with_openfast | |
| # mpiexec -n 2 python iea22_ptfm_opt_driver.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') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| #uses: coverallsapp/github-action@v2 | |
| #with: | |
| # github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| coveralls --service=github |