Skip to content

Commit 4c7d048

Browse files
authored
Merge pull request #27 from cpp-lln-lab/fix_test_ci_dev
[INFRA] update tests in CI
2 parents 98a690a + 5c4a43d commit 4c7d048

18 files changed

+155
-114
lines changed

.github/workflows/miss_hit_quality.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616

1717
steps:
1818

19-
- uses: actions/checkout@v2
19+
- name: Install CPP_ROI
20+
uses: actions/checkout@v3
2021
with:
2122
submodules: true
2223
fetch-depth: 1

.github/workflows/miss_hit_style.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616

1717
steps:
1818

19-
- uses: actions/checkout@v2
19+
- name: Install CPP_ROI
20+
uses: actions/checkout@v3
2021
with:
2122
submodules: true
2223
fetch-depth: 1

.github/workflows/run_tests.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: tests and coverage with matlab
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- main
8+
- master
9+
pull_request:
10+
branches: ['*']
11+
schedule:
12+
- cron: "1 1 1 * *"
13+
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-20.04
20+
21+
steps:
22+
- name: Install MATLAB
23+
uses: matlab-actions/[email protected]
24+
with:
25+
# MATLAB release to set up R2020a
26+
release: R2020a
27+
28+
- name: Install CPP_ROI
29+
uses: actions/checkout@v3
30+
with:
31+
submodules: true
32+
fetch-depth: 1
33+
34+
- name: Install SPM
35+
run: |
36+
git clone https://github.com/spm/spm12.git --depth 1
37+
38+
- name: Install Moxunit and MOcov
39+
run: |
40+
git clone https://github.com/MOxUnit/MOxUnit.git --depth 1
41+
git clone https://github.com/MOcov/MOcov.git --depth 1
42+
43+
- name: Add bids-matlab
44+
run: |
45+
git clone https://github.com/bids-standard/bids-matlab.git --depth 1
46+
47+
- name: Run commands
48+
uses: matlab-actions/[email protected]
49+
with:
50+
command: cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); run tests_matlab;
51+
52+
- name: Run tests
53+
run: |
54+
cat test_report.log | grep 0
55+
bash <(curl -s https://codecov.io/bash)
56+
57+
- name: Code coverage
58+
uses: codecov/codecov-action@v1
59+
with:
60+
file: coverage.xml # optional
61+
flags: unittests # optional
62+
name: codecov-umbrella # optional
63+
fail_ci_if_error: true # optional (default = false)

.github/workflows/tests_matlab.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
%
2+
% (C) Copyright 2022 CPP ROI developers
3+
4+
root_dir = getenv('GITHUB_WORKSPACE');
5+
6+
addpath(fullfile(root_dir, 'spm12'));
7+
addpath(fullfile(root_dir, 'bids-matlab'));
8+
addpath(fullfile(root_dir, 'MOcov', 'MOcov'));
9+
10+
cd(fullfile(root_dir, 'MOxUnit', 'MOxUnit'));
11+
run moxunit_set_path();
12+
13+
cd(fullfile(root_dir));
14+
15+
initCppRoi();
16+
17+
run run_tests();

src/atlas/returnAtlasDir.m renamed to atlas/returnAtlasDir.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
%
1111
% (C) Copyright 2021 CPP ROI developers
1212

13-
atlasDir = fullfile(rootDir(), 'atlas');
13+
atlasDir = fileparts(mfilename('fullpath'));
1414

1515
if nargin > 0
1616

initCppRoi.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function initCppRoi()
55
global CPP_ROI_INITIALIZED
66
global CPP_ROI_PATHS
77

8-
if isempty(CPP_ROI_INITIALIZED)
8+
if isempty(CPP_ROI_INITIALIZED) || ~CPP_ROI_INITIALIZED
99

1010
% directory with this script becomes the current directory
1111
thisDirectory = fileparts(mfilename('fullpath'));
@@ -18,6 +18,8 @@ function initCppRoi()
1818
CPP_ROI_PATHS = genpath(fullfile(thisDirectory, 'src'));
1919
CPP_ROI_PATHS = cat(2, CPP_ROI_PATHS, pathSep, ...
2020
fullfile(thisDirectory, 'lib', 'marsbar-0.44'));
21+
CPP_ROI_PATHS = cat(2, CPP_ROI_PATHS, pathSep, ...
22+
fullfile(thisDirectory, 'atlas'));
2123
addpath(CPP_ROI_PATHS, '-begin');
2224

2325
marsbar('on');

run_tests.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
testFolder = fullfile(fileparts(mfilename('fullpath')), 'tests');
1010

11+
addpath(fullfile(testFolder, 'utils'));
12+
1113
folderToCover = fullfile(testFolder, '..', 'src');
1214

1315
success = moxunit_runtests( ...

src/utils/cppRoiRoot.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function pth = cppRoiRoot()
2+
%
3+
%
4+
% USAGE::
5+
%
6+
% pth = cppRoiRoot()
7+
%
8+
%
9+
% (C) Copyright 2022 CPP ROI developers
10+
11+
pth = fullfile(fileparts(mfilename('fullpath')), '..', '..');
12+
pth = spm_file(pth, 'cpath');
13+
14+
end

0 commit comments

Comments
 (0)