Skip to content

Commit ccfc2d0

Browse files
committed
add tests with matlab
1 parent 1964f59 commit ccfc2d0

File tree

4 files changed

+75
-10
lines changed

4 files changed

+75
-10
lines changed

.github/workflows/run_tests.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- master
7-
- main
87
- dev
98

109
pull_request:
@@ -22,7 +21,7 @@ jobs:
2221
sudo apt-get -y install octave liboctave-dev
2322
2423
- name: Clone spm_2_bids
25-
uses: actions/checkout@v2
24+
uses: actions/checkout@v3
2625
with:
2726
submodules: true
2827
fetch-depth: 2
@@ -41,12 +40,6 @@ jobs:
4140
with_coverage: true
4241
cover_xml_file: coverage.xml
4342

44-
- name: Upload coverage
45-
uses: actions/upload-artifact@v1
46-
with:
47-
name: coverage_file
48-
path: coverage.xml
49-
5043
- name: Code coverage
5144
uses: codecov/codecov-action@v1
5245
with:
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: tests and coverage with matlab
2+
3+
on:
4+
5+
push:
6+
branches:
7+
- master
8+
- dev
9+
10+
pull_request:
11+
branches: ["*"]
12+
13+
jobs:
14+
15+
build:
16+
17+
runs-on: ubuntu-20.04
18+
19+
steps:
20+
21+
- name: Install MATLAB
22+
uses: matlab-actions/[email protected]
23+
with:
24+
# MATLAB release to set up R2020a
25+
release: R2020a
26+
27+
- name: Install Moxunit and MOcov
28+
run: |
29+
git clone https://github.com/MOxUnit/MOxUnit.git --depth 1
30+
git clone https://github.com/MOcov/MOcov.git --depth 1
31+
32+
- name: Clone spm_2_bids
33+
uses: actions/checkout@v2
34+
with:
35+
submodules: true
36+
fetch-depth: 2
37+
38+
- name: get bids-matlab and JSONio
39+
run: |
40+
make install_dev
41+
42+
- name: Run commands
43+
uses: matlab-actions/[email protected]
44+
with:
45+
command: cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); run tests_matlab;
46+
47+
- name: Run tests
48+
run: |
49+
cat test_report.log | grep 0
50+
bash <(curl -s https://codecov.io/bash)
51+
52+
- name: Code coverage
53+
uses: codecov/codecov-action@v1
54+
with:
55+
file: coverage.xml # optional
56+
flags: unittests # optional
57+
name: codecov-umbrella # optional
58+
fail_ci_if_error: true # optional (default = false)

.github/workflows/tests_matlab.m

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

run_tests.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
folderToCover = fullfile(pwd, 'src');
44
testFolder = fullfile(pwd, 'tests');
55

6-
success = moxunit_runtests( ...
7-
testFolder, ...
6+
success = moxunit_runtests(testFolder, ...
87
'-verbose', '-recursive', '-with_coverage', ...
98
'-cover', folderToCover, ...
109
'-cover_xml_file', 'coverage.xml', ...

0 commit comments

Comments
 (0)