24
24
matrix :
25
25
os : [ubuntu-latest, windows-latest] # Windows and Linux builds
26
26
outputs :
27
- linuxx64_artifact : ${{ steps.prepare_linux_artifact.outputs.linuxx64_build }}
28
- windowsx64_artifact : ${{ steps.prepare_windows_artifact.outputs.windowsx64_build }}
27
+ linuxx64_matlab_artifact : ${{ steps.prepare_linux_artifact.outputs.linuxx64_matlab_build }}
28
+ linuxx64_octave_artifact : ${{ steps.prepare_linux_artifact.outputs.linuxx64_octave_build }}
29
+ windowsx64_matlab_artifact : ${{ steps.prepare_windows_matlab_artifact.outputs.windowsx64_matlab_build }}
30
+ windowsx64_octave_artifact : ${{ steps.prepare_windows_octave_artifact.outputs.windowsx64_octave_build }}
29
31
steps :
30
32
- name : Check out repository
31
33
uses : actions/checkout@v4
@@ -47,33 +49,104 @@ jobs:
47
49
cd build
48
50
cmake .. -DCMAKE_BUILD_TYPE=Release
49
51
cmake --build . --config Release -j
50
- - name : Prepare artifact (Linux)
51
- id : prepare_linux_artifact
52
+ - name : Prepare MATLAB artifact (Linux)
53
+ id : prepare_linux_matlab_artifact
52
54
if : runner.os == 'Linux'
53
55
shell : bash
54
56
run : |
55
57
mkdir -p artifacts
56
- name="MEXlibCZI-linux-x64-$(git describe --always)"
58
+ name="MATLAB- MEXlibCZI-linux-x64-$(git describe --always)"
57
59
mkdir -p artifacts/${name}
58
60
cp build/MEXlibCZI/MEXlibCZI.mexa64 artifacts/${name}/
59
61
echo "artifactName=${name}" >> "$GITHUB_ENV"
60
62
echo "artifactPath=artifacts/${name}" >> "$GITHUB_ENV"
61
- #echo "::set-output name=linuxx64_build::${name}"
62
- echo "linuxx64_build=${name}" >> $GITHUB_OUTPUT
63
- - name : Prepare artifact (Windows)
64
- id : prepare_windows_artifact
63
+ echo "linuxx64_matlab_build=${name}" >> "$GITHUB_OUTPUT"
64
+ - name : install Octave (Windows)
65
+ if : runner.os == 'Windows'
66
+ shell : bash
67
+ run : |
68
+ choco install octave --no-progress
69
+ # I am not sure how to find the octave-cli-executable now, so we search for the link in the start menu
70
+ search_dir="/c/ProgramData/Microsoft/Windows/Start Menu/Programs"
71
+ octave_link=$(find "$search_dir" -type f -name "Octave*CLI*.lnk" 2>/dev/null)
72
+ octave_link_windows_path=$(cygpath -w "$octave_link")
73
+ echo "octave_link=$octave_link"
74
+ echo "octave_link_windows_path=$octave_link_windows_path"
75
+ echo "OCTAVECLI_LINK=$octave_link_windows_path" >> "$GITHUB_ENV"
76
+ - name : install Octave (Linux)
77
+ if : runner.os == 'Linux'
78
+ shell : bash
79
+ run : |
80
+ sudo apt install -y -qq -o=Dpkg::Progress-Fancy="0" octave liboctave-dev
81
+ - name : build Octave mex-file (Windows)
82
+ if : runner.os == 'Windows'
83
+ shell : cmd
84
+ run : |
85
+ REM We compile the mex file for Octave within Octave itself, this seems the easiest way. The
86
+ REM downside is that installing octave takes a long time.
87
+ REM Note that we are using cmd.exe here, because it can "execute" the .lnk file.
88
+ "%OCTAVECLI_LINK%" --version
89
+ REM echo "cd %GITHUB_WORKSPACE%/OctaveMex , mkoctfile --mex octavelibczi.c"
90
+ set "GITHUB_WORKSPACE_FORWARD_SLASHES=%GITHUB_WORKSPACE:\=/%
91
+ "%OCTAVECLI_LINK%" --eval "cd %GITHUB_WORKSPACE_FORWARD_SLASHES%/OctaveMex , mkoctfile --mex octavelibczi.c"
92
+ REM now, copy the libmexlibczi.dll to this folder
93
+ echo "*** directory listing of build\libmexlibczi\Release ***"
94
+ dir build\libmexlibczi\Release\
95
+ copy /B build\libmexlibczi\Release\libmexlibczi.dll %GITHUB_WORKSPACE%\OctaveMex
96
+ echo "*** directory listing of %GITHUB_WORKSPACE%\OctaveMex ***"
97
+ dir %GITHUB_WORKSPACE%\OctaveMex
98
+ - name : build Octave mex-file (Linux)
99
+ if : runner.os == 'Linux'
100
+ shell : bash
101
+ run : |
102
+ cd OctaveMex
103
+ octave --version
104
+ octave --eval "mkoctfile --mex octavelibczi.c"
105
+ cp ../build/libmexlibczi/libmexlibczi.so . # now, copy the libmexlibczi.so to this folder
106
+ - name : Prepare MATLAB-mex artifact (Windows)
107
+ id : prepare_windows_matlab_artifact
65
108
if : runner.os == 'Windows'
66
109
shell : bash
67
110
run : |
68
111
mkdir -p artifacts
69
- name="MEXlibCZI-windows-x64-$(git describe --always)"
112
+ name="MATLAB- MEXlibCZI-windows-x64-$(git describe --always)"
70
113
mkdir -p artifacts/${name}
71
114
cp build/MEXlibCZI/Release/MEXlibCZI.mexw64 artifacts/${name}/
72
115
echo "artifactName=${name}" >> "$GITHUB_ENV"
73
116
echo "artifactPath=artifacts/${name}" >> "$GITHUB_ENV"
74
- #echo "::set-output name=windowsx64_build::${name}"
75
- echo "windowsx64_build=${name}" >> $GITHUB_OUTPUT
76
- - name : Upload artifacts
117
+ echo "windowsx64_matlab_build=${name}" >> $GITHUB_OUTPUT
118
+ - name : Upload MATLAB-mex artifacts
119
+ uses : actions/upload-artifact@v4
120
+ with :
121
+ path : ${{ env.artifactPath }}/
122
+ name : ${{ env.artifactName }}
123
+ - name : Prepare Octave-mex artifact (Windows)
124
+ id : prepare_windows_octave_artifact
125
+ if : runner.os == 'Windows'
126
+ shell : bash
127
+ run : |
128
+ mkdir -p artifacts
129
+ name="Octave-MEXlibCZI-windows-x64-$(git describe --always)"
130
+ mkdir -p artifacts/${name}
131
+ cp $(cygpath "${GITHUB_WORKSPACE}")/OctaveMex/libmexlibczi.dll artifacts/${name}/
132
+ cp $(cygpath "${GITHUB_WORKSPACE}")/OctaveMex/octavelibczi.mex artifacts/${name}/
133
+ echo "artifactName=${name}" >> "$GITHUB_ENV"
134
+ echo "artifactPath=artifacts/${name}" >> "$GITHUB_ENV"
135
+ echo "windowsx64_octave_build=${name}" >> $GITHUB_OUTPUT
136
+ - name : Prepare Octave-mex artifact (Linux)
137
+ id : prepare_linux_octave_artifact
138
+ if : runner.os == 'Linux'
139
+ shell : bash
140
+ run : |
141
+ mkdir -p artifacts
142
+ name="Octave-MEXlibCZI-linux-x64-$(git describe --always)"
143
+ mkdir -p artifacts/${name}
144
+ cp ${GITHUB_WORKSPACE}/OctaveMex/libmexlibczi.so artifacts/${name}/
145
+ cp ${GITHUB_WORKSPACE}/OctaveMex/octavelibczi.mex artifacts/${name}/
146
+ echo "artifactName=${name}" >> "$GITHUB_ENV"
147
+ echo "artifactPath=artifacts/${name}" >> "$GITHUB_ENV"
148
+ echo "linuxx64_octave_build=${name}" >> $GITHUB_OUTPUT
149
+ - name : Upload Octave-mex artifacts
77
150
uses : actions/upload-artifact@v4
78
151
with :
79
152
path : ${{ env.artifactPath }}/
88
161
- name : Check out repository
89
162
uses : actions/checkout@v4
90
163
- name : Download All Artifacts
91
- if : needs.build.outputs.linuxx64_artifact != '' || needs.build.outputs.windowsx64_artifact != ''
164
+ if : needs.build.outputs.linuxx64_matlab_artifact != '' || needs.build.outputs.windowsx64_matlab_artifact != '' || needs.build.outputs.linuxx64_octave_artifact != '' || needs.build.outputs.windowsx64_octave_artifact != ''
92
165
uses : actions/download-artifact@v4
93
166
with :
94
167
path : ./artifacts # download to a specific folder
@@ -108,7 +181,11 @@ jobs:
108
181
name : ${{ env.releaseName }}
109
182
tag_name : ${{ env.tagName }}
110
183
files : |
111
- ./artifacts/${{ needs.build.outputs.linuxx64_artifact }}/MEXlibCZI.mexa64
112
- ./artifacts/${{ needs.build.outputs.windowsx64_artifact }}/MEXlibCZI.mexw64
184
+ ./artifacts/${{ needs.build.outputs.linuxx64_matlab_artifact }}/MEXlibCZI.mexa64
185
+ ./artifacts/${{ needs.build.outputs.windowsx64_matlab_artifact }}/MEXlibCZI.mexw64
186
+ ./artifacts/${{ needs.build.outputs.linuxx64_octave_artifact }}/octavelibczi.mex
187
+ ./artifacts/${{ needs.build.outputs.linuxx64_octave_artifact }}/libmexlibczi.so
188
+ ./artifacts/${{ needs.build.outputs.windowsx64_octave_artifact }}/octavelibczi.mex
189
+ ./artifacts/${{ needs.build.outputs.windowsx64_octave_artifact }}/libmexlibczi.dll
113
190
prerelease : true
114
191
0 commit comments