Skip to content

Commit ddcd7be

Browse files
authored
Merge pull request #762 from Remi-Gau/ci
[MNT] update CI and fix tests
2 parents 06f5a29 + 04bc3a2 commit ddcd7be

File tree

62 files changed

+334
-160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+334
-160
lines changed

.github/workflows/check_md_links.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
with:
2424
use-quiet-mode: 'yes'
2525
use-verbose-mode: 'yes'
26-
config-file: 'mlc_config.json'
26+
config-file: '.github/workflows/mlc_config.json'

.github/workflows/miss_hit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- uses: actions/checkout@v3
3030
with:
31-
fetch-depth: 1
31+
fetch-depth: 0
3232

3333
- name: Set up Python
3434
uses: actions/setup-python@v4
File renamed without changes.

.github/workflows/run_system_tests_matlab.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# only trigger update on upstream repo
4545
if: github.repository_owner == 'cpp-lln-lab'
4646

47-
runs-on: ubuntu-20.04
47+
runs-on: ubuntu-22.04
4848

4949
strategy:
5050
matrix:
@@ -67,7 +67,7 @@ jobs:
6767
uses: actions/checkout@v3
6868
with:
6969
submodules: true
70-
fetch-depth: 2
70+
fetch-depth: 0
7171

7272
- name: Get moae fmriprep data from OSF
7373
run: |

.github/workflows/run_system_tests_octave.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "system tests with octave: failure expected"
1+
name: "system tests with octave"
22

33
# Uses the cron schedule for github actions
44
#
@@ -44,7 +44,7 @@ jobs:
4444
# only trigger update on upstream repo
4545
if: github.repository_owner == 'cpp-lln-lab'
4646

47-
runs-on: ubuntu-latest
47+
runs-on: ubuntu-22.04
4848

4949
strategy:
5050
matrix:
@@ -58,11 +58,15 @@ jobs:
5858
sudo apt-get -y -qq update
5959
sudo apt-get -y install octave liboctave-dev
6060
61+
- name: Info
62+
run: |
63+
octave --version
64+
6165
- name: Clone bidspm
6266
uses: actions/checkout@v3
6367
with:
6468
submodules: true
65-
fetch-depth: 2
69+
fetch-depth: 0
6670

6771
- name: Get moae fmriprep data from OSF
6872
run: |

.github/workflows/run_tests_matlab.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
tests_matlab:
3030

31-
runs-on: ubuntu-20.04
31+
runs-on: ubuntu-22.04
3232

3333
steps:
3434
- name: Install MATLAB
@@ -41,7 +41,7 @@ jobs:
4141
uses: actions/checkout@v3
4242
with:
4343
submodules: true
44-
fetch-depth: 2
44+
fetch-depth: 0
4545

4646
- name: Install SPM
4747
run: |
@@ -66,15 +66,15 @@ jobs:
6666
with:
6767
command: cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); run tests_matlab;
6868

69-
- name: Run tests
69+
- name: Check tests
7070
run: |
7171
cat test_report.log | grep 0
72-
bash <(curl -s https://codecov.io/bash)
7372
7473
- name: Code coverage
7574
uses: codecov/codecov-action@v3
7675
with:
77-
file: coverage.xml # optional
78-
flags: unittests # optional
79-
name: codecov-umbrella # optional
80-
fail_ci_if_error: true # optional (default = false)
76+
file: coverage.xml
77+
flags: matlab
78+
name: codecov-matlab
79+
fail_ci_if_error: false
80+
# token: ${{ secrets.CODECOV_TOKEN }} # not required but might help API rate limits

.github/workflows/run_tests_octave.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "tests with octave: failure expected"
1+
name: "tests with octave"
22

33
on:
44

@@ -23,7 +23,7 @@ env:
2323
jobs:
2424
tests_octave:
2525

26-
runs-on: ubuntu-20.04
26+
runs-on: ubuntu-22.04
2727

2828
# only trigger update on upstream repo
2929
if: github.repository_owner == 'cpp-lln-lab'
@@ -35,11 +35,15 @@ jobs:
3535
sudo apt-get -y -qq update
3636
sudo apt-get -y install octave liboctave-dev
3737
38+
- name: Info
39+
run: |
40+
octave --version
41+
3842
- name: Clone bidspm
3943
uses: actions/checkout@v3
4044
with:
4145
submodules: true
42-
fetch-depth: 2
46+
fetch-depth: 0
4347

4448
- name: Install SPM
4549
run: |
@@ -67,4 +71,15 @@ jobs:
6771
octave $OCTFLAGS --eval "bidspm(); cd demos/MoAE; download_moae_ds(true);"
6872
cd .github/workflows
6973
octave $OCTFLAGS --eval "tests_octave;"
70-
cat test_report.log | grep 0
74+
75+
- name: Check tests
76+
run: cat test_report.log | grep 0
77+
78+
- name: Code coverage
79+
uses: codecov/codecov-action@v3
80+
with:
81+
file: coverage.xml
82+
flags: octave
83+
name: codecov-octave
84+
fail_ci_if_error: false
85+
# token: ${{ secrets.CODECOV_TOKEN }} # not required but might help API rate limits

bidspm.m

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,42 @@ function bidspm(varargin)
1313

1414
defaultAction = 'init';
1515

16-
isEmptyOrCellstr = @(x) isempty(x) || iscellstr(x);
16+
isEmptyOrCellstr = @(x) isempty(x) || iscellstr(x); %#ok<*ISCLSTR>
1717
isFileOrStruct = @(x) isstruct(x) || exist(x, 'file') == 2;
1818

19-
isLogical = @(x) validateattributes(x, {'logical'}, {'numel', 1});
20-
isChar = @(x) validateattributes(x, {'char'}, {'row'});
21-
isPositiveScalar = @(x) validateattributes(x, {'numeric'}, {'nonnegative', 'numel', 1});
19+
isLogical = @(x) islogial(x) && numel(x) == 1;
20+
isChar = @(x) ischar(x);
21+
isPositiveScalar = @(x) isnumeric(x) && numel(x) == 1 && x >= 0;
2222

23-
isLowLevelActionOrDir = @(x) (ismember(x, low_level_actions()) || isdir(x));
23+
isFolder = @(x) isfolder(x);
24+
25+
isCellStr = @(x) iscellstr(x);
26+
27+
isLowLevelActionOrDir = @(x) (ismember(x, low_level_actions()) || isfolder(x));
2428

2529
addOptional(args, 'bids_dir', pwd, isLowLevelActionOrDir);
2630

2731
addOptional(args, 'output_dir', '', isChar);
2832
addOptional(args, 'analysis_level', 'subject', @(x) ismember(x, {'subject', 'dataset'}));
2933

3034
addParameter(args, 'action', defaultAction, isChar);
31-
addParameter(args, 'participant_label', {}, @iscellstr);
32-
addParameter(args, 'task', {}, @iscellstr);
35+
addParameter(args, 'participant_label', {}, isCellStr);
36+
addParameter(args, 'task', {}, isCellStr);
3337
addParameter(args, 'dry_run', false, isLogical);
3438
addParameter(args, 'bids_filter_file', struct([]), isFileOrStruct);
3539
addParameter(args, 'options', struct([]), isFileOrStruct);
3640
addParameter(args, 'verbosity', 2, isPositiveScalar);
3741

3842
addParameter(args, 'fwhm', 6, isPositiveScalar);
39-
addParameter(args, 'space', {}, @iscellstr);
43+
addParameter(args, 'space', {}, isCellStr);
4044

4145
% preproc only
4246
addParameter(args, 'dummy_scans', 0, isPositiveScalar);
4347
addParameter(args, 'anat_only', false, isLogical);
4448
addParameter(args, 'ignore', {}, isEmptyOrCellstr);
4549

4650
% stats only
47-
addParameter(args, 'preproc_dir', pwd, @isdir);
51+
addParameter(args, 'preproc_dir', pwd, isFolder);
4852
addParameter(args, 'model_file', struct([]), isFileOrStruct);
4953
addParameter(args, 'roi_based', false, isLogical);
5054
% group level stats only
@@ -178,6 +182,11 @@ function bidspm(varargin)
178182
if ismember('fieldmaps', args.Results.ignore)
179183
opt.useFieldmaps = false;
180184
end
185+
if ismember('qa', lower(args.Results.ignore))
186+
opt.QA.func.do = false;
187+
opt.QA.anat.do = false;
188+
opt.QA.glm.do = false;
189+
end
181190

182191
opt.dummy_scans = args.Results.dummy_scans;
183192

@@ -375,11 +384,12 @@ function initBidspm(dev)
375384
opt.verbosity = 2;
376385
opt.msg.color = '';
377386

378-
octaveVersion = '4.0.3';
387+
octaveVersion = '6.4.0';
379388
matlabVersion = '8.6.0';
380389

381390
% octave packages
382-
installlist = {'io', 'statistics', 'image'};
391+
installlist = {};
392+
% installlist = {'io', 'statistics', 'image'};
383393

384394
thisDirectory = fileparts(mfilename('fullpath'));
385395

@@ -440,6 +450,10 @@ function initBidspm(dev)
440450

441451
addpath(BIDSPM_PATHS, '-begin');
442452

453+
if isOctave
454+
warning('off', 'Octave:shadowed-function');
455+
end
456+
443457
checkDependencies(opt);
444458
printCredits(opt);
445459

@@ -533,6 +547,11 @@ function run_tests()
533547

534548
bidspm('action', 'dev');
535549

550+
% to reduce noise in the output
551+
if isOctave
552+
warning('off', 'setGraphicWindow:noGraphicWindow');
553+
end
554+
536555
cd(fileparts(mfilename('fullpath')));
537556

538557
if isGithubCi
@@ -552,8 +571,7 @@ function run_tests()
552571
folderToCover = fullfile(pwd, 'src');
553572
testFolder = fullfile(pwd, 'tests', subfolder);
554573

555-
success = moxunit_runtests( ...
556-
testFolder, ...
574+
success = moxunit_runtests(testFolder, ...
557575
'-verbose', '-recursive', '-with_coverage', ...
558576
'-cover', folderToCover, ...
559577
'-cover_xml_file', 'coverage.xml', ...

demos/MoAE/moae_fmriprep.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
addpath(fullfile(pwd, '..', '..'));
2323
bidspm();
2424

25+
if isOctave
26+
warning('off', 'setGraphicWindow:noGraphicWindow');
27+
end
28+
2529
% Getting the raw dataset
2630
download_data = true;
2731
download_moae_ds(download_data);

demos/MoAE/test_moae.m

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,29 @@
2222

2323
addpath(fullfile(WD, '..', '..'));
2424

25+
bidspm();
2526
if download_data
26-
bidspm();
2727
download_moae_ds(download_data, clean);
2828
end
2929

30+
warning('off', 'SPM:noDisplay');
31+
if isOctave
32+
warning('off', 'setGraphicWindow:noGraphicWindow');
33+
end
34+
3035
optionsFile = fullfile(WD, 'options', 'options_task-auditory.json');
3136

32-
space = { 'IXI549Space'
37+
space = {'IXI549Space'
3338
'IXI549Space'
3439
'individual'
3540
'individual'};
36-
ignore = {
37-
{''}
38-
{'unwarp'}
41+
ignore = {{''}
42+
{'unwarp', 'qa'}
3943
{'unwarp'}
4044
{''}
4145
};
4246

43-
models = {
44-
fullfile(WD, 'models', 'model-MoAE_smdl.json')
47+
models = {fullfile(WD, 'models', 'model-MoAE_smdl.json')
4548
fullfile(WD, 'models', 'model-MoAE_smdl.json')
4649
fullfile(WD, 'models', 'model-MoAEindividual_smdl.json')
4750
fullfile(WD, 'models', 'model-MoAEindividual_smdl.json')
@@ -77,4 +80,14 @@
7780

7881
rmdir(fullfile(WD, 'outputs', 'derivatives'), 's');
7982

83+
% with Octave running more n-1 loop in CI is fine
84+
% but not running crashes with a segmentation fault
85+
% /home/runner/work/_temp/fb8e9d58-fa9f-4f93-8c96-387973f3632e.sh: line 2:
86+
% 7487 Segmentation fault (core dumped) octave $OCTFLAGS --eval "run system_tests_facerep;"
87+
%
88+
% not sure why
89+
if isOctave
90+
break
91+
end
92+
8093
end

0 commit comments

Comments
 (0)