Skip to content

Commit 9ac3459

Browse files
committed
ci: test without / with MEX
1 parent ec86a05 commit 9ac3459

File tree

4 files changed

+41
-32
lines changed

4 files changed

+41
-32
lines changed

.github/workflows/composite-buildtool/action.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,32 @@ runs:
1313
startup-options: ${{ matrix.startup-options }}
1414
tasks: check
1515

16-
- name: Test task
17-
if: ${{ matrix.release >= 'R2022b' || startsWith(matrix.release, 'latest') }}
16+
- name: Legacy Mex Test
17+
if: ${{ matrix.release >= 'R2022b' && matrix.release < 'R2024b' }}
1818
uses: matlab-actions/run-build@v2
1919
with:
2020
startup-options: ${{ matrix.startup-options }}
21-
tasks: test
21+
tasks: legacyMex test
2222

23+
- name: Non-Mex Test
24+
if: ${{ matrix.release >= 'R2024b' || startsWith(matrix.release, 'latest') }}
25+
uses: matlab-actions/run-build@v2
26+
with:
27+
startup-options: ${{ matrix.startup-options }}
28+
tasks: test
2329

24-
- name: Run tests (manual)
25-
if: ${{ matrix.release < 'R2022b' && !startsWith(matrix.release, 'latest') }}
26-
uses: matlab-actions/run-tests@v2
30+
- name: Mex Group Test
31+
if: ${{ matrix.release >= 'R2024b' || startsWith(matrix.release, 'latest') }}
32+
uses: matlab-actions/run-build@v2
2733
with:
28-
source-folder: ${{ github.workspace }}
29-
select-by-folder: test
30-
strict: true
34+
startup-options: ${{ matrix.startup-options }}
35+
tasks: mex test
36+
37+
38+
# - name: Run tests (manual)
39+
# if: ${{ matrix.release < 'R2022b' && !startsWith(matrix.release, 'latest') }}
40+
# uses: matlab-actions/run-tests@v2
41+
# with:
42+
# source-folder: ${{ github.workspace }}
43+
# select-by-folder: test
44+
# strict: true

buildfile.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99
plan("check") = matlab.buildtool.tasks.CodeIssuesTask(pkg_name, IncludeSubfolders=true);
1010
end
1111

12-
if isMATLABReleaseOlderThan("R2024b")
13-
plan("test").Dependencies = "legacyMex";
14-
else
12+
if ~isMATLABReleaseOlderThan("R2024b")
1513

16-
plan("test").Dependencies = "mex";
1714
plan("clean") = matlab.buildtool.tasks.CleanTask;
1815

1916
[compiler_id, compiler_opt] = get_compiler_options();

private/get_mex_sources.m

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,22 @@
33
top (1,1) string % package directory
44
end
55

6-
%% source C++
6+
win = "";
7+
if ispc
8+
win = fullfile(top, "src/windows.cpp");
9+
end
10+
11+
mac = fullfile(top, "src/macos.cpp");
712

8-
% Matlab and Java don't have these functions
913
srcs = {fullfile(top, "src/is_char_device.cpp"), ...
1014
fullfile(top, "src/set_permissions.cpp"), ...
11-
fullfile(top, "src/is_rosetta.cpp"), ...
15+
[fullfile(top, "src/is_rosetta.cpp"), mac], ...
16+
[fullfile(top, "src/windows_shortname.cpp"), win]
1217
};
1318

14-
s = fullfile(top, "src/windows_shortname.cpp");
15-
if ispc
16-
s(end+1) = fullfile(top, "src/windows.cpp");
17-
end
18-
srcs{end+1} = s;
19-
20-
21-
% isSymbolicLink() new in R2024b
19+
%% isSymbolicLink() new in R2024b
2220
if ~isMATLABReleaseOlderThan("R2024b")
23-
24-
s = fullfile(top, "src/is_symlink.cpp");
25-
if ispc
26-
s(end+1) = fullfile(top, "src/windows.cpp");
27-
end
28-
srcs{end+1} = s;
29-
21+
srcs{end+1} = [fullfile(top, "src/is_symlink.cpp"), win];
3022
end
3123

3224
end

test/TestMex.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
methods (Test)
44

55
function test_is_char_device(tc)
6-
% /dev/stdin may not be available on CI systems
6+
import matlab.unittest.fixtures.CurrentFolderFixture
7+
8+
tc.applyFixture(CurrentFolderFixture(".."))
9+
% matlab exist() doesn't work for MEX detection with ".." leading path
710

11+
tc.assumeEqual(exist("+stdlib/is_char_device", "file"), 3)
12+
13+
% /dev/stdin may not be available on CI systems
814
if ispc
915
n = "NUL";
1016
else

0 commit comments

Comments
 (0)