Update runTestsAndGenerateReport.m #45
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 Cov CI | |
on: | |
push: | |
branches: [develop] # Trigger workflow on push to develop | |
pull_request: | |
branches: [develop] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Set up MATLAB | |
- name: Set up MATLAB | |
uses: matlab-actions/setup-matlab@v1 | |
with: | |
release: R2022a # Specify the MATLAB version | |
# Run only the specific test_myfunction.m file from the /tests directory. | |
- name: Run MATLAB tests and generate coverage | |
run: | | |
matlab -batch "import matlab.unittest.TestRunner; import matlab.unittest.plugins.CodeCoveragePlugin; import matlab.unittest.plugins.codecoverage.CoberturaFormat; runner = TestRunner.withTextOutput; runner.addPlugin(CodeCoveragePlugin.forFolder('src', 'Producing', CoberturaFormat('coverage.xml'))); results = runner.run(testsuite('test/test_myfunction.m')); assertSuccess(results);" | |
# Upload coverage report to Codecov | |
- name: Upload coverage to Codecov | |
run: | | |
bash <(curl -s https://codecov.io/bash) -f coverage.xml -F matlab | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |