Skip to content

Commit

Permalink
Update codecov.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronBrennan1 authored Nov 5, 2024
1 parent 66c7974 commit f717b8e
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,37 @@ jobs:
- name: Install MOcov
run: |
git clone https://github.com/MOxUnit/MOcov.git /opt/MOcov
ls -la /opt/MOcov
sudo chmod -R 755 /opt/MOcov
- name: Create and run MATLAB script
- name: Create MATLAB script
run: |
echo 'addpath(genpath('\''/opt/MOcov'\''));
addpath(genpath(''test''));
addpath(genpath(''src''));
mocov(''start'');
cat << 'EOF' > run_tests.m
% Add MOcov to path
addpath(genpath('/opt/MOcov'));
% Add test directories
addpath('tests');
% Start coverage
mocov('start');
try
results = runtests(''test_myfunction.m'');
assert(all([results.Passed]), ''Some tests failed'');
mocov(''stop'');
mocov(''-cover'', ''src'', ''-cover_xml_file'', ''coverage.xml'');
% Run the test
results = runtests('tests/test_myfunction.m');
assert(all([results.Passed]), 'Some tests failed');
% Stop coverage and generate report
mocov('stop');
mocov('-cover', pwd, '-cover_xml_file', 'coverage.xml');
exit(0);
catch e
disp(getReport(e));
exit(1);
end' > run_tests.m
matlab -batch "run('run_tests.m')"
end
EOF
- name: Run MATLAB tests
run: matlab -batch "run('run_tests.m')"

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down

0 comments on commit f717b8e

Please sign in to comment.