-
Notifications
You must be signed in to change notification settings - Fork 14
132 lines (129 loc) · 4.42 KB
/
Copy pathbat.yml
File metadata and controls
132 lines (129 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Build and Test
on: [push]
permissions:
contents: read
jobs:
bat:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Perform npm tasks
run: npm run ci
- uses: actions/upload-artifact@v7
with:
name: built-action
path: |
**/*
!node_modules/
integ:
needs: bat
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-14]
steps:
- uses: actions/download-artifact@v8
with:
name: built-action
- name: Perform 'setup-matlab'
uses: matlab-actions/setup-matlab@v3
with:
products: MATLAB_Test
- name: Greet the world in style
uses: ./
with:
command: "disp('hello world');"
- name: Run MATLAB statement
uses: ./
with:
command: f = fopen('myscript.m', 'w'); fwrite(f, 'assert(true)'); fclose(f);
- name: Run MATLAB script
uses: ./
with:
command: myscript
- name: Run MATLAB statement with quotes 1
uses: ./
with:
command: 'eval("a = 1+2"), assert(a == 3); eval(''b = 3+4''), assert(b == 7);'
- name: Run MATLAB statement with quotes 2
uses: ./
with:
command: 'eval("a = 1+2"), assert(a == 3); eval(''b = 3+4''), assert(b == 7);'
- name: Run MATLAB statement with quotes 3
uses: ./
with:
command: a = """hello world""", b = '"hello world"', assert(strcmp(a,b));
- name: Run MATLAB statement with symbols
uses: ./
with:
command: a = " !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~", b = char([32:126]), assert(strcmp(a, b), a+b);
- name: Run MATLAB statement in working directory
uses: ./
with:
command: exp = getenv('GITHUB_WORKSPACE'), act = pwd, assert(strcmp(act, exp), strjoin({act exp}, '\n'));
- name: Run MATLAB statement with arguments
uses: ./
with:
command: disp("Hello world!!")
startup-options: -nojvm -nodesktop -logfile mylog.log
- name: Validate that previous command ran with arguments
uses: ./
with:
command: assert(isfile("mylog.log"));
- run: echo 'onetyone = 11' > startup.m
shell: bash
- name: MATLAB runs startup.m automatically
uses: ./
with:
command: assert(onetyone==11, 'the variable `onetyone` was not set as expected by startup.m')
- run: |
mkdir subdir
echo 'onetyonetyone = 111' > subdir/startup.m
shell: bash
- name: MATLAB sd startup option is not overwritten
uses: ./
with:
command: >
assert(onetyonetyone==111);
[~, f] = fileparts(pwd);
assert(strcmp(f, 'subdir'));
startup-options: -sd subdir
- name: Run command to run tests
uses: ./
with:
command: runtests("sample/TheTruth.m");
- name: Run command to run tests (sanity check for test summary)
uses: ./
with:
command: runtests("sample/TheTruth.m"); runtests("sample/TheTruth.m"); runtests("sample/TheTruth.m");
- name: Create buildfile.m in project root for build and test summary
shell: bash
run: |
cat <<'_EOF' >> "buildfile.m"
function plan = buildfile
import matlab.buildtool.tasks.TestTask
plan = buildplan(localfunctions);
plan("preMadeTest") = TestTask;
plan.DefaultTasks = "preMadeTest";
end
_EOF
- name: Run command with buildtool pre-made test task
uses: ./
with:
command: buildtool preMadeTest
- name: Verify environment variables make it to MATLAB
uses: ./
with:
command: exp = 'my_value', act = getenv('MY_VAR'), assert(strcmp(act, exp), strjoin({act exp}, '\n'));
env:
MY_VAR: my_value
# Remove when online batch licensing is the default
- name: Verify MW_BATCH_LICENSING_ONLINE variable set
uses: ./
with:
command: exp = 'true', act = getenv('MW_BATCH_LICENSING_ONLINE'), assert(strcmp(act, exp), strjoin({act exp}, '\n'));