Update codecov.yml #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/MOcov/MOcov.git /opt/MOcov | |
sudo chmod -R 755 /opt/MOcov | |
- name: Run MATLAB tests with coverage | |
run: > | |
matlab -batch " | |
try | |
addpath(genpath('/opt/MOcov')); | |
addpath(genpath('test')); | |
addpath(genpath('src')); | |
mocov('start'); | |
results = runtests('test_myfunction.m'); | |
assert(all([results.Passed]), 'Some tests failed'); | |
mocov('stop'); | |
mocov('-cover', 'src', '-cover_xml_file', 'coverage.xml'); | |
exit(0); | |
catch e | |
disp(getReport(e)); | |
exit(1); | |
end" | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml | |
flags: matlab | |
token: ${{ secrets.CODECOV_TOKEN }} |