Skip to content

Commit

Permalink
try using globals
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Aug 18, 2023
1 parent e127f3e commit 91cedd6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 61 deletions.
2 changes: 1 addition & 1 deletion +bids/+internal/is_github_ci.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
% (C) Copyright 2021 Remi Gau
is_github = false;

GITHUB_WORKSPACE = bg;
GITHUB_WORKSPACE = getenv('HOME');
IS_CI = getenv('CI');

if IS_CI
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/run_tests_matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,15 @@ jobs:
git clone https://github.com/MOxUnit/MOxUnit.git --depth 1
git clone https://github.com/MOcov/MOcov.git --depth 1
- name: set environment variable unix
if: matrix.test == 'slow' && matrix.os == 'ubuntu-latest'
run: export SLOW=true

- name: set environment variable windows
if: matrix.test == 'slow' && matrix.os == 'windows-latest'
run: |
setx SLOW "true"
- name: Run slow tests
if: matrix.test == 'slow'
uses: matlab-actions/[email protected]
with:
command: run MOxUnit/MOxUnit/moxunit_set_path(); addpath(fullfile(pwd, 'MOcov', 'MOcov')); global SLOW; SLOW=true; addpath(getenv('GITHUB_WORKSPACE'));
success = run_tests(); assert(success);

- name: Run commands
- name: Run fast commands
if: matrix.test == 'fast'
uses: matlab-actions/[email protected]
with:
command: run MOxUnit/MOxUnit/moxunit_set_path(); addpath(fullfile(pwd, 'MOcov', 'MOcov')); addpath(getenv('GITHUB_WORKSPACE')); success = run_tests();
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/run_tests_octave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ jobs:
mkoctfile --mex jsonread.c jsmn.c -DJSMN_PARENT_LINKS
octave $OCTFLAGS --eval "addpath(fullfile(pwd)); savepath();"
- name: set environment variable
if: matrix.test == 'slow'
run: export SLOW=true
- name: Run fast tests Octave
if: matrix.test == 'fast'
run: |
octave $OCTFLAGS --eval "success = run_tests(); assert(success);"
- name: Run unit tests Octave
- name: Run slow tests Octave
if: matrix.test == 'slow'
run: |
export SLOW=true
octave $OCTFLAGS --eval "success = run_tests(); assert(success);"
2 changes: 2 additions & 0 deletions run_tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@

testFolder = fullfile(pwd, 'tests');
if run_slow_test_only
fprintf('Running only slow tests\n');
testFolder = fullfile(pwd, 'tests', 'tests_slow');
end

if with_coverage
success = moxunit_runtests(testFolder, ...
'-verbose', ...
'-randomize_order', ...
'-recursive', ...
'-with_coverage', ...
'-cover', folderToCover, ...
Expand Down
45 changes: 0 additions & 45 deletions tests/test_download_ds.m

This file was deleted.

5 changes: 3 additions & 2 deletions tests/utils/run_slow_test_only.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
function value = run_slow_test_only()
% (C) Copyright 2023 BIDS-MATLAB developers
SLOW = getenv('SLOW');
global SLOW
ENV_SLOW = getenv('SLOW');
value = false;
if ~isempty(SLOW)
if ~isempty(ENV_SLOW) || SLOW
value = true;
end
end

0 comments on commit 91cedd6

Please sign in to comment.