Skip to content

Commit b6b5a6c

Browse files
Update matlab-tests.yml
1 parent 2308f9a commit b6b5a6c

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

.github/workflows/matlab-tests.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
name: Run MATLAB Tests
2-
32
on:
43
push:
54
branches:
6-
- main # Runs tests when code is pushed to main
5+
- main
76
pull_request:
87
branches:
9-
- main # Runs tests when a PR is opened to main
10-
8+
- main
119
jobs:
1210
run-matlab-tests:
1311
runs-on: ubuntu-latest
14-
1512
steps:
1613
- name: Checkout repository
17-
uses: actions/checkout@v4 # Clones the repo
18-
14+
uses: actions/checkout@v4
1915
- name: Set up MATLAB
20-
uses: matlab-actions/setup-matlab@v1 # Official MATLAB GitHub Action
21-
16+
uses: matlab-actions/setup-matlab@v1
2217
- name: Run MATLAB Test Script
2318
uses: matlab-actions/run-command@v1
2419
with:
2520
command: |
2621
try
22+
global testing_yml_workflow;
23+
testing_yml_workflow = true; % Indicate CI/CD mode
24+
25+
% Ensure serial execution
26+
if isempty(gcp('nocreate'))
27+
parpool('local', 1);
28+
end
29+
30+
% Run the test script
2731
power_calculator_test_script;
2832
disp('All tests passed successfully.');
2933
catch ME
3034
disp('Test failed.');
3135
disp(ME.message);
3236
exit(1);
3337
end
34-

0 commit comments

Comments
 (0)