Skip to content

Commit ad3a50e

Browse files
committed
Actions: Run cache_population then main on Windows
1 parent 22b62ee commit ad3a50e

File tree

1 file changed

+98
-14
lines changed

1 file changed

+98
-14
lines changed

.github/workflows/windows_unit_tests.yml

Lines changed: 98 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,98 @@ on:
77
branches: [master, develop, ebbflood]
88

99
jobs:
10+
cache_population:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [windows-latest]
15+
python-version: [3.9]
16+
matlab-version: [R2022a]
17+
runs-on: ${{ matrix.os }}
18+
19+
env:
20+
mhkit-python-dir: "MHKiT-Python"
21+
steps:
22+
- name: Install/Setup Miniconda
23+
uses: conda-incubator/setup-miniconda@v2
24+
with:
25+
auto-update-conda: true
26+
python-version: ${{ matrix.python-version }}
27+
activate-environment: mhkit
28+
channels: conda-forge
29+
30+
- name: "Conda install h5py, netcdf4, and cython"
31+
run: |
32+
conda activate mhkit
33+
conda install numpy cython pip pytest hdf5 libnetcdf cftime netcdf4 --strict-channel-priority
34+
35+
- name: Check out MHKiT-MATLAB
36+
uses: actions/checkout@v4
37+
38+
- name: Check out MHKiT-Python
39+
uses: actions/checkout@v4
40+
with:
41+
repository: "MHKiT-Software/MHKiT-Python"
42+
path: ${{env.mhkit-python-dir}}
43+
44+
- name: pip install mhkit from source
45+
working-directory: ${{env.mhkit-python-dir}}
46+
run: |
47+
conda activate mhkit
48+
pip install -e .
49+
50+
- name: pip install mhkit-python-utils module from source
51+
run: |
52+
conda activate mhkit
53+
pip install -e .
54+
55+
- name: Download mhkit_webread_cache artifact
56+
uses: actions/upload-artifact@v2
57+
with:
58+
name: mhkit_webread_cache
59+
path: mhkit_webread_cache
60+
61+
- name: Set up MATLAB
62+
uses: matlab-actions/setup-matlab@v1
63+
with:
64+
release: ${{ matrix.matlab-version }}
65+
66+
- name: Configure MATLAB pyenv Version and ExecutionMode
67+
if: ${{ matrix.os == 'windows-latest' }}
68+
shell: pwsh
69+
run: >
70+
"pyenv(Version='{0}', ExecutionMode='InProcess')" -f (python -c "import sys; print(sys.executable)") | Out-File -FilePath run.m
71+
72+
- name: Add MATLAB test commands
73+
shell: bash
74+
run: echo "version,
75+
addpath(genpath('mhkit')),
76+
import matlab.unittest.TestSuite,
77+
import matlab.unittest.TestRunner,
78+
testFolder = ['mhkit' filesep 'tests'],
79+
suite = TestSuite.fromFolder(testFolder),
80+
runner = TestRunner.withTextOutput,
81+
results = runner.run(suite),
82+
assertSuccess(results)" >> run.m
83+
84+
- name: Output Run.m
85+
shell: bash
86+
run: cat run.m
87+
88+
- name: Run MHKiT-MATLAB Unit Tests
89+
uses: matlab-actions/run-command@v1
90+
with:
91+
command: run
92+
startup-options: -noFigureWindows
93+
94+
- name: Save mhkit_webread_cache directory as an artifact
95+
uses: actions/upload-artifact@v2
96+
with:
97+
name: mhkit_webread_cache
98+
path: mhkit_webread_cache
99+
10100
main:
101+
needs: cache_population
11102
strategy:
12103
fail-fast: false
13104
matrix:
@@ -17,6 +108,8 @@ jobs:
17108
# R2022b and above have a windows specific error related to the MATLAB/Python interface
18109
matlab-version: [R2021b, R2022a]
19110
exclude:
111+
- matlab-version: 2022a
112+
python-version: 3.9
20113
- matlab-version: R2023b
21114
python-version: 3.8
22115
- matlab-version: R2023a
@@ -101,26 +194,17 @@ jobs:
101194
conda activate mhkit
102195
pip freeze
103196
197+
- name: Download mhkit_webread_cache artifact
198+
uses: actions/download-artifact@v3
199+
with:
200+
path: mhkit_webread_cache
201+
104202
# Note, does not work, fails with error: RuntimeError: MATLAB installation not found in Windows Registry: [WinError 2] The system cannot find the file specified
105203
# - name: Install MATLAB Engine API for Python on Windows
106204
# if: ${{ matrix.os == 'windows-latest' }}
107205
# run: python -m pip install matlabengine==9.14.3
108206
# run: "pip3 install matlabengine --only-binary=:all:"
109207

110-
# - name: Test MHKiT-Python
111-
# if: ${{ matrix.os == 'windows-latest' }}
112-
# run: |
113-
# pip install nose pytest
114-
# nosetests -v --traverse-namespace mhkit
115-
# working-directory: ${{env.mhkit-python-dir}}
116-
# # if: always() && steps.runTests.outcome == 'failure'
117-
118-
- name: Download mhkit_webread_cache artifact
119-
uses: actions/upload-artifact@v2
120-
with:
121-
name: mhkit_webread_cache
122-
path: mhkit_webread_cache
123-
124208
- name: Set up MATLAB
125209
uses: matlab-actions/setup-matlab@v1
126210
with:

0 commit comments

Comments
 (0)