-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run demos with MOxUnit in CI so that demo2 is run even if demo1 fails
run test demi CI set up through yml undo refactoring fix function name make sure demos run locally use same approach to run tests and demos in CI use similar calls for both tests and demos in CI
- Loading branch information
Showing
7 changed files
with
73 additions
and
18 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,9 @@ name: MATLAB demos | |
on: | ||
schedule: | ||
- cron: "0 0 1,15 * *" | ||
push: | ||
# TODO only run on master branch on push | ||
branches: ["*"] | ||
|
||
jobs: | ||
demos: | ||
|
@@ -29,18 +32,22 @@ jobs: | |
- name: Install MATLAB | ||
uses: matlab-actions/[email protected] | ||
with: | ||
# MATLAB release to set up R2020a | ||
release: R2020a | ||
|
||
- name: Shallow clone GLMsingle | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
fetch-depth: 0 # 0 means we only get the last commit, not the whole git history | ||
|
||
- name: Install Moxunit and MOcov | ||
run: | | ||
git clone https://github.com/MOxUnit/MOxUnit.git --depth 1 | ||
git clone https://github.com/MOcov/MOcov.git --depth 1 | ||
- name: Run commands | ||
uses: matlab-actions/[email protected] | ||
with: | ||
command: | ||
cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); | ||
run run_demos; | ||
cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); | ||
run run_demos_ci; |
6 changes: 3 additions & 3 deletions
6
.github/workflows/tests_matlab.m → .github/workflows/run_tests_ci.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
% run tests with code coverage via the run_tests scripts in the root folder. | ||
|
||
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(); | ||
|
||
% adds GLM single to the path and runs all the tests | ||
cd(fullfile(root_dir)); | ||
setup(); | ||
cd(root_dir) | ||
run run_tests(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,14 +40,14 @@ jobs: | |
- name: Download data | ||
run: make tests/data/nsdcoreexampledataset.mat | ||
|
||
- name: Run commands | ||
- name: Run tests | ||
uses: matlab-actions/[email protected] | ||
with: | ||
command: | ||
cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); | ||
run tests_matlab; | ||
run run_tests_ci; | ||
|
||
- name: Run tests | ||
- name: Check logs | ||
run: | | ||
cat test_report.log | grep 0 | ||
bash <(curl -s https://codecov.io/bash) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function test_suite = test_demos %#ok<*STOUT> | ||
|
||
try % assignment of 'localfunctions' is necessary in Matlab >= 2016 | ||
test_functions = localfunctions(); %#ok<*NASGU> | ||
catch % no problem; early Matlab versions can use initTestSuite fine | ||
end | ||
|
||
initTestSuite; | ||
|
||
end | ||
|
||
function test_demo1() | ||
|
||
run(fullfile(root_dir(), 'matlab', 'examples', 'example1')); | ||
|
||
end | ||
|
||
function test_demo2() | ||
|
||
run(fullfile(root_dir(), 'matlab', 'examples', 'example2')); | ||
|
||
end | ||
|
||
function value = root_dir() | ||
|
||
value = getenv('GITHUB_WORKSPACE'); | ||
|
||
if isempty(value) | ||
value = fullfile(fileparts(mfilename('fullpath')), '..', '..'); | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
function run_tests() | ||
|
||
% run tests with code coverage | ||
|
||
tic; | ||
|
||
cd(fileparts(mfilename('fullpath'))); | ||
|