Skip to content

mw-hrastega/myMATLABProject

Repository files navigation

Codecov MATLAB Example

This guide shows how to run MATLAB® tests, produce a code coverage report, and upload the report to Codecov. The repository includes these files.

File Path Description
source/quadraticSolver.m The quadraticSolver function solves quadratic equations.
tests/SolverTest.m The SolverTest class tests the quadraticSolver function.
runMyTests.m The runMyTests script creates a test suite and a test runner that outputs a Cobertura code coverage report.
azure-pipelines.yml The azure-pipelines.yml file defines the pipeline that runs on Azure® DevOps.
.circleci/config.yml The config.yml file defines the pipeline that runs on CircleCI®.
.travis.yml The config.yml file defines the pipeline that runs on Travis CI.

Produce and Publish Coverage Reports

Use these example pipeline YAMLs to:

  1. Install the latest MATLAB release on a Linux®-based build agent.
  2. Run all MATLAB tests in the root of your repository, including its subfolders.
  3. Produce a code coverage report in Cobertura XML format for the source folder.
  4. Upload the produced artifact to Codecov.

Azure DevOps

pool:
  vmImage: Ubuntu 16.04
steps:
  - task: InstallMATLAB@0
  - task: RunMATLABTests@0
    inputs:
      sourceFolder: source
      codeCoverageCobertura: coverage.xml
  - script: bash <(curl -s https://codecov.io/bash)

CircleCI

version: 2.1
orbs:
  matlab: mathworks/[email protected]
  codecov: codecov/[email protected]
jobs:
  build:
    machine:
      image: ubuntu-1604:201903-01
    steps:
      - checkout
      - matlab/install
      - matlab/run-tests:
          source-folder: source
          code-coverage-cobertura: coverage.xml
      - codecov/upload: 
          file: coverage.xml

Travis CI

language: matlab
script: matlab -batch 'runMyTests'
after_success: bash <(curl -s https://codecov.io/bash)

Caveats

  • Currently, MATLAB builds on CircleCI and Travis CI are available only for public projects. MATLAB builds on Azure DevOps that use Microsoft®-hosted agents are also available only for public projects.

Links

Contact Us

If you have any questions or suggestions, please contact MathWorks® at [email protected].

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages