Skip to content

Update codecov.yml

Update codecov.yml #57

Workflow file for this run

name: Code Coverage
on:
push:
branches: [develop]
pull_request:
branches: [develop]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
with:
release: R2022a
- name: Install MOcov
run: |
git clone https://github.com/MOxUnit/MOcov.git /opt/MOcov
sudo chmod -R 755 /opt/MOcov
- name: Create MATLAB script
run: |
cat << 'EOF' > run_tests.m
% Add MOcov to path
addpath(genpath('/opt/MOcov'));
% Add test directories
addpath('tests');
% Start coverage
mocov('start');
try
% 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
EOF
- name: Run MATLAB tests
run: matlab -batch "run('run_tests.m')"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: matlab
token: ${{ secrets.CODECOV_TOKEN }}