Skip to content

Commit 55921ca

Browse files
authored
Merge pull request #162 from MHKiT-Software/develop
Release MHKiT-MATLAB Version 0.6.0
2 parents e780f1c + 2be1910 commit 55921ca

File tree

147 files changed

+171374
-5582
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+171374
-5582
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Build Production and Development Release
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- develop
7+
jobs:
8+
build-toolbox:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Verify Version Numbers
16+
run: |
17+
# Extract version from pyproject.toml
18+
PYPROJECT_VERSION=$(grep -Po '(?<=version = ")[^"]*' pyproject.toml)
19+
20+
# Extract version from __init__.py
21+
INIT_PY_VERSION=$(grep -Po '(?<=__version__ = ")[^"]*' mhkit_python_utils/__init__.py)
22+
23+
# Extract version from build_release.m
24+
MATLAB_VERSION=$(grep -Po "(?<=project_version = ')[^']*" scripts/build_release.m)
25+
26+
echo "Versions found:"
27+
echo "pyproject.toml: $PYPROJECT_VERSION"
28+
echo "__init__.py: $INIT_PY_VERSION"
29+
echo "build_release.m: $MATLAB_VERSION"
30+
31+
# Verify all versions match
32+
if [ "$PYPROJECT_VERSION" != "$INIT_PY_VERSION" ] || [ "$PYPROJECT_VERSION" != "$MATLAB_VERSION" ]; then
33+
echo "Error: Version numbers do not match across files!"
34+
echo "Please ensure versions are consistent in:"
35+
echo "- pyproject.toml ($PYPROJECT_VERSION)"
36+
echo "- mhkit_python_utils/__init__.py ($INIT_PY_VERSION)"
37+
echo "- scripts/build_release.m ($MATLAB_VERSION)"
38+
exit 1
39+
fi
40+
41+
# Set version as environment variable for later use
42+
echo "MHKIT_MATLAB_VERSION=$MATLAB_VERSION" >> $GITHUB_ENV
43+
44+
- name: Check for existing version tag
45+
run: |
46+
if git ls-remote --exit-code --tags origin "refs/tags/v${MHKIT_MATLAB_VERSION}" >/dev/null 2>&1; then
47+
echo "Error: Version v${MHKIT_MATLAB_VERSION} already exists as a tag!"
48+
echo "Please update the version number in:"
49+
echo "- pyproject.toml"
50+
echo "- mhkit_python_utils/__init__.py"
51+
echo "- scripts/build_release.m"
52+
exit 1
53+
fi
54+
55+
- name: Set environment variables
56+
run: |
57+
echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
58+
59+
- name: Set up MATLAB
60+
uses: matlab-actions/setup-matlab@v2
61+
with:
62+
release: R2024a
63+
64+
- name: Build Toolbox
65+
uses: matlab-actions/run-command@v2
66+
with:
67+
command: addpath('scripts'); build_release
68+
69+
- name: Rename files for develop branch
70+
if: github.ref != 'refs/heads/master'
71+
run: |
72+
for f in mhkit_v*.mltbx; do
73+
mv "$f" "${f/.mltbx/-dev-${SHORT_SHA}.mltbx}"
74+
done
75+
for f in mhkit_examples_v*.zip; do
76+
mv "$f" "${f/.zip/-dev-${SHORT_SHA}.zip}"
77+
done
78+
for f in mhkit_python_utils*.zip; do
79+
mv "$f" "${f/.zip/-dev-${SHORT_SHA}.zip}"
80+
done
81+
82+
- name: Upload MATLAB Toolbox
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: mhkit-toolbox
86+
path: mhkit_v*.mltbx
87+
if-no-files-found: error
88+
89+
- name: Upload Examples
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: mhkit-examples
93+
path: mhkit_examples_v*.zip
94+
if-no-files-found: error
95+
96+
- name: Upload mhkit_python_utils
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: mhkit-python-utils
100+
path: mhkit_python_utils_v*.zip
101+
if-no-files-found: error
102+
103+
- name: Create Release
104+
uses: softprops/action-gh-release@v1
105+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
106+
with:
107+
files: |
108+
mhkit_v*.mltbx
109+
mhkit_examples_v*.zip
110+
mhkit_python_utils_v*.zip
111+
name: ${{ github.ref == 'refs/heads/master' && format('MHKiT-MATLAB v{0} Release', env.MHKIT_MATLAB_VERSION) || format('MHKiT-MATLAB v{0} Development Build ({1})', env.MHKIT_MATLAB_VERSION, env.SHORT_SHA) }}
112+
tag_name: ${{ github.ref == 'refs/heads/master' && format('v{0}', env.MHKIT_MATLAB_VERSION) || format('v{0}-dev-{1}', env.MHKIT_MATLAB_VERSION, env.SHORT_SHA) }}
113+
# Release visibility settings:
114+
# - For master branch: Creates a public production release (draft=false)
115+
# - For other branches: Creates a draft release (draft=true) visible only to repository contributors
116+
# This allows the development team to test new builds before making them public.
117+
draft: ${{ github.ref != 'refs/heads/master' }}
118+
prerelease: false
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/unix_unit_tests.yml

Lines changed: 41 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
env:
2222
mhkit-python-dir: "MHKiT-Python"
23-
MHKIT_PYTHON_VERSION: '0.7.0'
23+
MHKIT_PYTHON_VERSION: '0.9.0'
2424
steps:
2525
- name: Install & Setup Miniconda
2626
uses: conda-incubator/setup-miniconda@v3
@@ -29,32 +29,17 @@ jobs:
2929
auto-update-conda: true
3030
python-version: ${{ matrix.python-version }}
3131
activate-environment: mhkit_conda_env
32-
channels: conda-forge
32+
channels: conda-forge,defaults
3333

3434
- name: "Conda install netcdf4, hdf5"
3535
shell: bash -l {0}
3636
run: |
3737
conda activate mhkit_conda_env
38-
conda install numpy==1.24.4 cython pip pytest hdf5 libnetcdf cftime netcdf4
39-
# conda install netcdf4 hdf5
40-
# export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
38+
conda install numpy cython pip pytest hdf5 libnetcdf cftime netcdf4
4139
4240
- name: Check out MHKiT-MATLAB
4341
uses: actions/checkout@v4
4442

45-
# - name: Check out MHKiT-Python
46-
# uses: actions/checkout@v4
47-
# with:
48-
# repository: "MHKiT-Software/MHKiT-Python"
49-
# path: ${{env.mhkit-python-dir}}
50-
51-
# - name: pip install mhkit module from source
52-
# shell: bash -l {0}
53-
# run: |
54-
# conda activate mhkit_conda_env
55-
# pip install -e .
56-
# working-directory: ${{env.mhkit-python-dir}}
57-
5843
- name: pip install mhkit from pypi
5944
shell: bash -l {0}
6045
run: |
@@ -72,7 +57,7 @@ jobs:
7257
run: |
7358
conda activate mhkit_conda_env
7459
pip uninstall -y scipy
75-
pip install scipy==1.10.1
60+
pip install scipy==1.12.0
7661
7762
- name: List installed pip modules
7863
shell: bash -l {0}
@@ -136,64 +121,38 @@ jobs:
136121
strategy:
137122
fail-fast: false
138123

139-
# Expecting 2 * 4 * 7 - (13 * 2) = 30 jobs
140124
matrix:
141125
os: [macos-13, ubuntu-latest]
142-
python-version: [3.8, 3.9, "3.10", 3.11]
126+
python-version: ["3.10", 3.11, 3.12]
143127
# Note: It is preferred to use an actual release name as opposed to 'latest'
144-
matlab-version: [R2021b, R2022a, R2022b, R2023a, R2023b, R2024a]
145-
mhkit-python-version: ["0.7.0"]
128+
matlab-version: [R2022b, R2023a, R2023b, R2024a, R2024b]
129+
mhkit-python-version: ["0.9.0"]
146130
exclude:
147131
- python-version: "3.10" # cache_population job
148132
matlab-version: R2022b
149133
os: ubuntu-latest
150-
- matlab-version: R2024a # Non compatiable versions of Python and MATLAB
151-
python-version: 3.8
134+
# Python 3.12 + MATLAB incompatability
135+
- matlab-version: R2024a
136+
python-version: 3.12
152137
- matlab-version: R2023b
153-
python-version: 3.8
138+
python-version: 3.12
154139
- matlab-version: R2023a
155-
python-version: 3.11
140+
python-version: 3.12
156141
- matlab-version: R2022b
142+
python-version: 3.12
143+
# Python 3.11 + MATLAB incompatability
144+
- matlab-version: R2023a
157145
python-version: 3.11
158-
- matlab-version: R2022a
159-
python-version: 3.11
160-
- matlab-version: R2022a
161-
python-version: "3.10"
162-
- matlab-version: R2021b
163-
python-version: 3.11
164-
- matlab-version: R2021b
165-
python-version: "3.10"
166-
- matlab-version: R2021a
167-
python-version: 3.11
168-
- matlab-version: R2021a
169-
python-version: "3.10"
170-
- matlab-version: R2021a
171-
python-version: 3.9
172-
- matlab-version: R2020b
146+
- matlab-version: R2022b
173147
python-version: 3.11
174-
- matlab-version: R2020b
175-
python-version: "3.10"
176-
- matlab-version: R2020b
177-
python-version: 3.9
178-
# Specific versions of tests that fail consistently. Most likely due to the GitHub actions environment
179-
# - matlab-version: R2024a # Python netcdf4 pip build error: https://github.com/MHKiT-Software/MHKiT-MATLAB/actions/runs/8789749433/job/24123413351
180-
# python-version: 3.11
181-
# os: macos-13
182-
# - matlab-version: R2024a # Working!
183-
# python-version: "3.10"
184-
# os: macos-13
185-
# - matlab-version: R2024a # Java Segfault on Python initialization: https://github.com/MHKiT-Software/MHKiT-MATLAB/actions/runs/8789749433/job/24123411604
186-
# python-version: 3.9
187-
# os: macos-13
188-
# - matlab-version: R2023b # Python netcd4 pip build error: https://github.com/MHKiT-Software/MHKiT-MATLAB/actions/runs/8789749433/job/24123412889
189-
# python-version: 3.11
190-
# os: macos-13
191-
# - matlab-version: R2023b # Java segfault on Python initialization: https://github.com/MHKiT-Software/MHKiT-MATLAB/actions/runs/8789749433/job/24123412352
192-
# python-version: "3.10"
193-
# os: macos-13
194-
# - matlab-version: R2023b # Java segfault on Python initialization: https://github.com/MHKiT-Software/MHKiT-MATLAB/actions/runs/8789749433/job/24123411335
195-
# python-version: 3.9
196-
# os: macos-13
148+
# Specific MATLAB/Python/OS Errors
149+
# Error using _cythonized_array_utils>init
150+
# scipy.linalg._cythonized_array_utils (line 1)
151+
# Python Error: ValueError: numpy.dtype size changed, may indicate binary
152+
# incompatibility. Expected 96 from C header, got 88 from PyObject
153+
- matlab-version: R2024b
154+
python-version: 3.12
155+
os: macos-13
197156

198157
runs-on: ${{ matrix.os }}
199158

@@ -204,62 +163,21 @@ jobs:
204163
- name: Check out MHKiT-MATLAB
205164
uses: actions/checkout@v4
206165

207-
# - name: Check out MHKiT-Python
208-
# uses: actions/checkout@v4
209-
# with:
210-
# repository: "MHKiT-Software/MHKiT-Python"
211-
# path: ${{env.mhkit-python-dir}}
212-
213166
- name: Install & Setup Miniconda
214167
uses: conda-incubator/setup-miniconda@v3
215168
with:
216169
miniconda-version: latest
217170
auto-update-conda: true
218171
python-version: ${{ matrix.python-version }}
219172
activate-environment: mhkit_conda_env
220-
channels: conda-forge
173+
channels: conda-forge,defaults
221174

222175
# This is necessary to fix any issues with netcdf4 and hdf5 headers
223176
- name: "Conda install netcdf4, hdf5"
224177
shell: bash -l {0}
225178
run: |
226179
conda activate mhkit_conda_env
227-
conda install numpy==1.24.4 cython pip pytest hdf5 libnetcdf cftime netcdf4
228-
# conda install netcdf4 hdf5
229-
# export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
230-
231-
# - name: Setup Python ${{ matrix.python-version }}
232-
# shell: bash -l {0}
233-
# run: |
234-
# conda create --name mhkit_conda_env python=${{ matrix.python-version }} numpy==1.24.4 cython pip pytest hdf5 libnetcdf cftime netcdf4 --strict-channel-priority
235-
# conda activate mhkit_conda_env
236-
# export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
237-
# pip install -e . --no-deps --force-reinstall
238-
239-
# - name: Setup MHKiT Dependencies on macOS
240-
# if: ${{ matrix.os == 'macos-13' }}
241-
# run: brew install hdf5 netcdf
242-
243-
# - name: Setup MHKiT Dependencies on ubuntu
244-
# run: sudo apt install libhdf5-serial-dev libnetcdf-dev
245-
# if: ${{ matrix.os == 'ubuntu-latest' }}
246-
247-
# - name: Setup MHKiT Dependencies on ubuntu
248-
# if: ${{ matrix.os == 'ubuntu-latest' }}
249-
# run: |
250-
# sudo apt update
251-
# sudo apt upgrade
252-
# sudo apt install build-essential
253-
254-
# - name: Print GCC Version
255-
# if: ${{ matrix.os == 'ubuntu-latest' }}
256-
# run: |
257-
# gcc --version
258-
# g++ --version
259-
260-
# - name: Setup MATLAB Path on Ubuntu
261-
# if: ${{ matrix.os == 'ubuntu-latest' }}
262-
# run: echo "export LD_LIBRARY_PATH=/usr/local/MATLAB/${{ matrix.matlab-version }}/sys/os/glnxa64" >> "$GITHUB_ENV"
180+
conda install numpy cython pip pytest hdf5 libnetcdf cftime netcdf4
263181
264182
- name: Setup MATLAB Path on Ubuntu
265183
if: ${{ matrix.os == 'ubuntu-latest' }}
@@ -277,14 +195,6 @@ jobs:
277195
conda activate mhkit_conda_env
278196
python --version
279197
280-
# - name: pip install mhkit module from source
281-
# working-directory: ${{env.mhkit-python-dir}}
282-
# shell: bash -l {0}
283-
# run: |
284-
# conda activate mhkit_conda_env
285-
# export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
286-
# pip install -e .
287-
288198
- name: pip install mhkit from pypi
289199
shell: bash -l {0}
290200
run: |
@@ -310,7 +220,7 @@ jobs:
310220
run: |
311221
conda activate mhkit_conda_env
312222
pip uninstall -y scipy
313-
pip install scipy==1.10.1
223+
pip install scipy==1.12.0
314224
315225
- name: List installed pip modules
316226
shell: bash -l {0}
@@ -345,6 +255,16 @@ jobs:
345255
with:
346256
release: ${{ matrix.matlab-version }}
347257

258+
- name: Configure OpenSSL for MacOS/MATLAB
259+
if: matrix.os == 'macos-13'
260+
shell: bash -l {0}
261+
run: |
262+
conda activate mhkit_conda_env
263+
conda install openssl=="3.0.*"
264+
CONDA_LIB_PATH=$(python -c "import sys; import os; print(os.path.join(os.path.dirname(sys.executable), 'lib'))")
265+
export DYLD_LIBRARY_PATH="$CONDA_LIB_PATH:$DYLD_LIBRARY_PATH"
266+
echo "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
267+
348268
- name: Add Python Dir to Path
349269
shell: bash -l {0}
350270
run: |
@@ -357,6 +277,10 @@ jobs:
357277
run: |
358278
conda activate mhkit_conda_env
359279
printf 'pyenv(Version="%s", ExecutionMode="OutOfProcess")\n' $(python -c "import sys; print(sys.executable)") >> run.m
280+
# Pass dynamic library paths to MATLAB only on macOS
281+
if [[ $OSTYPE == "darwin"* ]]; then
282+
echo "setenv('DYLD_LIBRARY_PATH', getenv('DYLD_LIBRARY_PATH'));" >> run.m
283+
fi
360284
361285
- name: Add MATLAB test commands
362286
shell: bash

0 commit comments

Comments
 (0)