Skip to content

Silence run-matlab-command invocation #213

Silence run-matlab-command invocation

Silence run-matlab-command invocation #213

Workflow file for this run

name: Build and Test
on: [push]
jobs:
bat:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Perform npm tasks
run: npm run ci
- name: Perform 'setup-matlab'
uses: matlab-actions/setup-matlab@v2
- 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