File tree 3 files changed +55
-0
lines changed
3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : matlab
2
+
3
+ defaults :
4
+ run :
5
+ shell : bash
6
+
7
+ on :
8
+ push :
9
+ branches : [ master ]
10
+ pull_request :
11
+ branches : [ master ]
12
+
13
+
14
+
15
+ jobs :
16
+ matlab :
17
+ runs-on : ubuntu-20.04
18
+
19
+ steps :
20
+ - uses : actions/checkout@v2
21
+ with :
22
+ submodules : recursive
23
+
24
+ - uses : actions/setup-python@v1
25
+ with :
26
+ python-version : 3.8
27
+
28
+ - run : |
29
+ echo "CC=gcc-9" >> $GITHUB_ENV
30
+ echo "CXX=g++-9" >> $GITHUB_ENV
31
+ VERBOSE=1 pip install --verbose -e .
32
+
33
+ - run : |
34
+ echo "m = py.importlib.import_module('cmake_example')" > test.m
35
+ echo "AStruct = m.AStruct" >> test.m
36
+ echo "AStruct()" >> test.m
37
+ cat test.m
38
+
39
+ - run : python -c "import cmake_example as m; m.AStruct()"
40
+
41
+ - uses : matlab-actions/setup-matlab@v0
42
+ with :
43
+ release : R2022a
44
+
45
+ - uses : matlab-actions/run-command@v0
46
+ with :
47
+ command : test
Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ int add(int i, int j) {
7
7
return i + j;
8
8
}
9
9
10
+ struct AStruct {
11
+ AStruct () {
12
+ }
13
+ };
14
+
10
15
namespace py = pybind11;
11
16
12
17
PYBIND11_MODULE (cmake_example, m) {
@@ -35,6 +40,8 @@ PYBIND11_MODULE(cmake_example, m) {
35
40
Some other explanation about the subtract function.
36
41
)pbdoc" );
37
42
43
+ py::class_<AStruct>(m, " AStruct" ).def (py::init<>());
44
+
38
45
#ifdef VERSION_INFO
39
46
m.attr (" __version__" ) = MACRO_STRINGIFY (VERSION_INFO);
40
47
#else
Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ def test_main():
5
5
assert m .__version__ == "0.0.1"
6
6
assert m .add (1 , 2 ) == 3
7
7
assert m .subtract (1 , 2 ) == - 1
8
+ assert m .AStruct () is not None
You can’t perform that action at this time.
0 commit comments