Skip to content

Commit

Permalink
Modernize setup and CI (#297)
Browse files Browse the repository at this point in the history
* Add Ext_Interface flag

* Update rosco dylib dir

* F_NumNotchFilts is not allowed to have a default value

* Fix checkpoint testing paths

* simplify and modernize the setup and test experience

* fix path to zmq.c file

* Update api_change.rst formatting slightly

* Update version numbers

* Add more descriptions to API docs

* Update api_change.rst formatting

* combine tests

* trying with build directory

* really think build issues should be fixed now. ..

* see if cmake find is more robust

* fix path to libdiscon in notebook

* trying more robust package search

* elevate pyzmq to be installed before extension is built, but also remove option and make it something that works if it is found

* forgotten init file I think

* testing build

* fix environment file issue on windows

* remove 3.12

* suppressing problem areas for now

* update library path in examples

* fixing case ambiguity

* fix paths in servodyn files

* still chasing paths in all of the files

* hopefully find pyzmq libs better now

* try that again

* fix library link

* add openfast_toolbox

* remove imports of old pyFAST

* restrict examples to ubuntu

* fix typo

* avoid circular dependecies with WEIS

* renable tests for all platforms

* make sure it works from any path

* prep for pypi release

* restrict full regression testing to linux

* restricting further

* Skip pip windows test for now

---------

Co-authored-by: AbhineetGupta <[email protected]>
Co-authored-by: Garrett Barter <[email protected]>
Co-authored-by: Garrett Barter <[email protected]>
  • Loading branch information
4 people authored Jan 8, 2024
1 parent 92e2ac5 commit c5de22f
Show file tree
Hide file tree
Showing 52 changed files with 2,334 additions and 620 deletions.
210 changes: 138 additions & 72 deletions .github/workflows/CI_rosco-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,146 @@ name: CI_rosco-compile
# We run CI on push commits on all branches
on: [push, pull_request]

# Specify FORTRAN compiler, used to be "gfortran-10"
env:
FORTRAN_COMPILER: gfortran

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "windows-latest" , "macOS-latest"]
python-version: ["3.9"]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install conda/mamba
uses: conda-incubator/setup-miniconda@v2
# 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
miniforge-variant: Mambaforge

# Install ROSCO toolbox
- name: Install ROSCO toolbox
shell: bash -l {0}
run: |
python setup.py install
build_pip:
name: Pip Build (${{ matrix.os }}) - ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}

strategy:
fail-fast: false #true
matrix:
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
python-version: ["3.9", "3.10", "3.11"]

steps:
- name: Setup GNU Fortran
# if: false == contains( matrix.os, 'windows')
uses: awvwgk/setup-fortran@v1 #modflowpy/install-intelfortran-action@v1 #

- name: checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
id: cp
with:
python-version: ${{ matrix.python-version }}
update-environment: true

#- name: Setup tmate session
# if: contains( matrix.os, 'windows')
# uses: mxschmitt/action-tmate@v3

# Install ZeroMQ- should be done via Conda
#- name: Install ZeroMQ
# run: |
# sudo apt-get update
# sudo apt-get install libzmq3-dev

- name: Pip Install ROSCO
run: |
'${{ steps.cp.outputs.python-path }}' -m pip install -e .
# Re-generate registry
- name: Generate Registry
shell: bash -l {0}
run: python rosco/controller/rosco_registry/write_registry.py
# Re-generate registry
- name: Generate Registry
run: |
'${{ steps.cp.outputs.python-path }}' rosco/controller/rosco_registry/write_registry.py
- name: Test run
# skipping pip test on windows for now until wisdem pypi is ready
if: false == contains( matrix.os, 'windows')
run: |
cd Examples
'${{ steps.cp.outputs.python-path }}' 01_turbine_model.py
build_and_test_conda:
name: Conda Build (${{ matrix.os }}) - ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}

strategy:
fail-fast: false #true
matrix:
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
python-version: ["3.9", "3.10", "3.11"]

steps:
- name: checkout repository
uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v2
# https://github.com/marketplace/actions/setup-miniconda
with:
#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 m2w64-toolchain libpython
gfortran --version
- name: Add dependencies mac specific
if: contains( matrix.os, 'mac')
run: |
conda install -y compilers
gfortran --version
# Install
- name: Debug
run: |
conda list
printenv
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# detached: true
# if: contains( matrix.os, 'windows')

- name: Conda Install ROSCO
run: |
python -m pip install -e .
- name: Install OpenFAST
run: |
conda install openfast==3.5.1
- name: Add dependencies windows
if: true == contains( matrix.os, 'windows')
run: |
conda install -y m2w64-toolchain
- name: Add dependencies windows
if: true == contains( matrix.os, 'mac')
shell: bash -l {0}
run: |
conda install -y gfortran
- name: Setup Workspace
run: |
cmake -E make_directory ${{runner.workspace}}/ROSCO/rosco/controller/build
- name: Configure and Build - unix
if: false == contains( matrix.os, 'windows')
shell: bash -l {0}
working-directory: "${{runner.workspace}}/ROSCO/rosco/controller/build"
run: |
cmake \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/ROSCO/rosco/controller/install \
-DCMAKE_Fortran_COMPILER:STRING=${{env.FORTRAN_COMPILER}} \
..
cmake --build . --target install
- name: Configure and Build - windows
if: true == contains( matrix.os, 'windows')
#shell: bash #-l {0}
working-directory: "${{runner.workspace}}/ROSCO/rosco/controller/build"
run: |
cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX="${{runner.workspace}}/ROSCO/rosco/controller/build" ..
cmake --build . --target install
- name: Generate Registry
run: |
python rosco/controller/rosco_registry/write_registry.py
- name: Fix example file extensions
run: |
python Examples/Test_Cases/update_libdiscon_extension.py
- name: Run ROSCO testing
run: |
cd rosco/test
python ROSCO_testing.py
- name: Run regression testing
if: contains( matrix.os, 'ubuntu')
run: |
cd rosco/test
pytest .
- name: Test walkthrough notebook
if: contains( matrix.os, 'ubuntu')
run: |
cd Examples
treon ROSCO_walkthrough.ipynb
Loading

0 comments on commit c5de22f

Please sign in to comment.