forked from NREL/ROSCO
-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (151 loc) · 6.29 KB
/
CI_rosco-compile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: CI_rosco-compile
# 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_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"] #mac-13 intel, mac-14 arm
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Setup GNU Fortran
if: false == contains( matrix.os, 'windows')
uses: fortran-lang/[email protected]
# with:
# compiler: intel-classic
- name: Install compiler
if: false == contains( matrix.os, 'windows')
id: install_cc
uses: rlalik/setup-cpp-compiler@master
with:
compiler: clang
- name: Install mingw-w64 on Windows
if: contains( matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: |
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-zeromq
mingw-w64-x86_64-cmake
mingw-w64-x86_64-pkg-config
- name: Install zeromq ubuntu
if: contains( matrix.os, 'ubuntu')
run: |
sudo apt install libzmq3-dev libzmq5 libczmq-dev libczmq4
- name: Install zeromq mac
if: contains( matrix.os, 'mac')
run: |
brew install zeromq
- name: checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: cp
with:
python-version: ${{ matrix.python-version }}
update-environment: true
- name: Set compilers
if: false == contains( matrix.os, 'windows')
run: |
echo "CC=${{ steps.install_cc.outputs.cc }}" >> $GITHUB_ENV
echo "CXX=${{ steps.install_cc.outputs.cxx }}" >> $GITHUB_ENV
#- 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
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-13", "windows-latest"] #mac-13 intel, mac-14 arm
python-version: ["3.9", "3.10", "3.11", "3.12"]
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: Conda Install ROSCO
run: |
python -m pip install -e .
- name: Install OpenFAST
run: |
conda install openfast==3.5.3
- 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: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# detached: true
# if: contains( matrix.os, 'windows')
- 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