Skip to content

Commit

Permalink
use same approach to run tests and demos in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Apr 8, 2022
1 parent fede69e commit 5c1cdd0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/run_demos_ci.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
% run demos with moxunit in github CI

root_dir = getenv('GITHUB_WORKSPACE');

% MOxUnit and MOcov need to be in the matlab path
addpath(fullfile(root_dir, 'MOcov', 'MOcov'));
cd(fullfile(root_dir, 'MOxUnit', 'MOxUnit'));
run moxunit_set_path();

% add glm single to path
cd(root_dir)
setup();

this_folder = fileparts(mfilename('fullpath'));
test_folder = this_folder;
success = moxunit_runtests(test_folder, '-verbose', '-recursive');

if success
system('echo 0 > test_report.log');
else
system('echo 1 > test_report.log');
end
7 changes: 1 addition & 6 deletions .github/workflows/run_demos_matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,5 @@ jobs:
with:
command:
root_dir = getenv('GITHUB_WORKSPACE');
addpath(fullfile(root_dir, 'MOcov', 'MOcov'));
cd(fullfile(root_dir, 'MOxUnit', 'MOxUnit'));
run moxunit_set_path();
cd(root_dir);
setup();
cd(fullfile(root_dir, '.github', 'workflows'));
run test_demos;
run run_demos_ci;
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests_matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
command:
cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows'));
run tests_matlab;
run run_tests_ci;

- name: Check logs
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_demos.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

function test_demo1()

run(fullfile(root_dir(), '/matlab/examples/example1'));
run(fullfile(root_dir(), 'matlab', 'examples', 'example1'));

end

function test_demo2()

run(fullfile(root_dir(), '/matlab/examples/example2'));
run(fullfile(root_dir(), 'matlab', 'examples', 'example2'));

end

Expand All @@ -29,4 +29,4 @@ function test_demo2()
value = fullfile(fileparts(mfilename('fullpath')), '..', '..');
end

end
end

0 comments on commit 5c1cdd0

Please sign in to comment.