Code Monkey home page Code Monkey logo

matlab-codecov-example's Introduction

Use MATLAB with Codecov

This example 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 A function that solves quadratic equations
tests/SolverTest.m A class that tests the quadraticSolver function
runMyTests.m A script that creates a test suite and a test runner that outputs a Cobertura code coverage report
azure-pipelines.yml A configuration example for Azure® DevOps
.circleci/config.yml A configuration example for CircleCI®
.github/workflows/workflow.yml A configuration example for GitHub® Actions
.travis.yml A configuration example for Travis CI

Produce and Publish Coverage Reports

Each of these pipeline definitions does four things:

  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-latest
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/matlab@0
  codecov: codecov/codecov@1
jobs:
  build:
    machine:
      image: ubuntu-2004:202104-01
    steps:
      - checkout
      - matlab/install
      - matlab/run-tests:
          source-folder: source
          code-coverage-cobertura: coverage.xml
      - codecov/upload: 
          file: coverage.xml

GitHub Actions

name: Example
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: matlab-actions/setup-matlab@v1
      - uses: matlab-actions/run-tests@v1
        with:
          source-folder: source
          code-coverage-cobertura: coverage.xml
      - uses: codecov/codecov-action@v1
        with:
          file: coverage.xml

Travis CI

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

Caveats

  • Currently, MATLAB builds that use cloud-hosted agents are available only for public projects.

Links

Contact Us

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

matlab-codecov-example's People

Contributors

mw-hrastega avatar mcafaro avatar davidbuzinski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.