Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This repository makes it easy to run your MATLAB tests on some of the most common CI platforms. The configuration files take care of setting up MATLAB and automatically executing your MATLAB tests.

License

NotificationsYou must be signed in to change notification settings

mathworks/ci-configuration-examples

Repository files navigation

Azure® DevOpsCircleCI®GitHub® ActionsGitLab® CI/CD
Build Status
Azure DevOps Coverage
CircleCI

MATLAB

GitLab CI/CD

Are you interested in automating your testing with CI?

Not sure how to connect MATLAB with CI systems?

We've got you covered!

This repository makes it easy to run your MATLAB tests on some of the most common CI platforms. The configuration files take care of setting up MATLAB to work with the CI system and automatically executing your MATLAB tests.

For advanced workflows, use theadvanced-ci-configuration-examples repository instead.


Getting started

Quick start guide

Here's how to quickly get this repository running on a CI system:

  1. Fork the repository to your own GitHub account
  2. Go to one of the supported CI platforms and install the available MATLAB CI pluginNote: GitHub Actions does not require this step
  3. Create a new CI job using your forked repository
  4. Enjoy using CI with MATLAB!

That's really it!

To use your MATLAB code or Simulink® models with this repository, simply replace the existing code and tests in "code" and "tests" with your own code and tests. There's no need to modify any of the CI configuration files because they are all completely agnostic of the MATLAB code being used.

Notes:

  • In most cases, the configuration files will automatically get picked up by the CI platform during step 3, but some platforms may require you to specify which file to use
  • The default branch for this repository is "main"

Step-by-step getting started guide for GitHub Actions

Our Continuous Integration with MATLAB and GitHub Actions Workshop provides a step-by-step guide for getting started with GitHub Actions.


Badges

Badges look really great, but they're not always easy to set up. Take a look at the badges, badge code, and reference links below to get started with badges for your repository.


Azure DevOps
BadgesBuild Status
Azure DevOps Coverage
Badge Code[![Build Status](https://dev.azure.com/AZURE_DEVOPS_ORG/AZURE_DEVOPS_PROJECT_NAME/_apis/build/status/GITHUB_USERNAME.GITHUB_REPO_NAME)](https://dev.azure.com/AZURE_DEVOPS_ORG/AZURE_DEVOPS_PROJECT_NAME/_build)

![Azure DevOps Coverage](https://img.shields.io/azure-devops/coverage/AZURE_DEVOPS_ORG/AZURE_DEVOPS_PROJECT_NAME/AZURE_DEVOPS_DEFINITION_ID)
Badge HelpBlog with helpful information for setting up Azure DevOps badges

CircleCI
BadgeCircleCI
Badge Code[![CircleCI](https://circleci.com/SOURCE_CONTROL_SYSTEM/GITHUB_USERNAME/GITHUB_REPO_NAME.svg?style=svg)](https://circleci.com/SOURCE_CONTROL_SYSTEM/GITHUB_USERNAME/GITHUB_REPO_NAME)
Badge HelpCircleCI documentation for setting up badges

GitHub Actions
BadgeMATLAB
Badge Code[![MATLAB](https://github.com/GITHUB_USERNAME/GITHUB_REPO_NAME/actions/workflows/ci.yml/badge.svg)](https://github.com/GITHUB_USERNAME/GITHUB_REPO_NAME/actions/workflows/ci.yml)
Badge HelpGitHub Actions documentation for setting up badges

GitLab CI/CD
BadgeGitLab CI/CD
Badge Code[![Pipeline Status](https://gitlab.com/GITLAB_PROJECT_PATH/badges/DEFAULT_BRANCH_NAME/pipeline.svg)](https://gitlab.com/GITLAB_PROJECT_PATH)
Badge HelpGitLab CI/CD documentation for setting up badges

How to use the Badge Code:

  1. Copy-paste the badge code into your README.md file
    • The badge code you copy should start with "[!" and not "\[\!"
  2. Replace allBOLD+ITALIC names with your specific credentials/names
    • ReplaceGITHUB_ORG with your GitHub organization name (usually your GitHub username)
    • ReplaceGITHUB_REPO_NAME with the name of your GitHub repository
    • ReplaceSOURCE_CONTROL_SYSTEM with the name of the source control system you are pointing to (gh = GitHub, bb = BitBucket)
    • ReplaceAZURE_DEVOPS_ORG with the name of your Azure DevOps organization name (usually your Azure DevOps username)
    • ReplaceAZURE_DEVOPS_PROJECT_NAME with the name of the Azure DevOps project that will run the CI job
    • ReplaceAZURE_DEVOPS_DEFINITION_ID with the definition ID for your Azure DevOps pipeline
      • To find the definition ID for your Azure DevOps pipeline, you must:
        • go to your Azure DevOps project
        • select "Pipelines" from the left-side navigation menu
        • select the pipeline you want to get coverage for
        • look at the end of the resulting URL for the number in "definitionId=###"
    • ReplaceGITLAB_PROJECT_PATH with the path of your GitLab project
    • ReplaceDEFAULT_BRANCH_NAME with the repository branch name you want to get the pipeline status from


Supported CI platforms

  • Azure® DevOps
  • CircleCI®
  • GitHub® Actions
  • Jenkins®
  • GitLab® CI/CD

About the code

The primary goal of this repository is to provide a set of configuration files as templates that illustrate how to run MATLAB on various CI platforms (e.g., Azure DevOps, CircleCI, GitHub Actions, Jenkins).

The example MATLAB code exampledayofyear.m is a simple function takes a date string"mm/dd/yyyy" and returns the day-of-year number.

Notes:

  • MATLAB already includes a day-of-year calculation usingday(d,"dayofyear"), whered is a datetime object. This code is only used as an example since it is a concept that is familiar to most people.
  • The code coverage is intentionally set below 100% to show how missing coverage looks with badges. Uncomment the last test inTestExamples.m to increase the coverage to 100%.

There are 2 test classes provided:

  1. TestExamples.m - A simple set of equality and negative tests
  2. ParameterizedTestExamples.m - A set of 12 equality tests set up using the parameterized test format

The repository includes these files:

File PathDescription
code/dayofyear.mThedayofyear function returns the day-of-year number for a given date string "mm/dd/yyyy"
tests/TestExamples.mTheTestExamples class provides a few equality and negative tests for thedayofyear function
tests/ParameterizedTestExample.mTheParameterizedTestExample class provides 12 tests for thedayofyear function using the parameterized test format
azure-pipelines.ymlTheazure-pipelines.yml file defines the pipeline that runs onAzure DevOps.
.circleci/config.ymlTheconfig.yml file defines the pipeline that runs onCircleCI
.github/workflows/ci.ymlTheci.yml file defines the pipeline that runs onGitHub Actions
JenkinsfileTheJenkinsfile file defines the pipeline that runs onJenkins
.gitlab-ci.ymlThe.gitlab-ci.yml file defines the pipeline that runs onGitLab CI/CD

Licensing

Product licensing for your pipeline depends on your project visibility as well as the types of products the pipeline uses:

  • Public project — The CI integration for MATLAB automatically licenses all products for you, except for transformation products, such as MATLAB Coder™ and MATLAB Compiler™.
  • Private project — The CI integration does not automatically license any products for you.

To license products that are not automatically licensed, you can request aMATLAB batch licensing token by submitting theMATLAB Batch Licensing Pilot form. Batch licensing tokens are strings that enable MATLAB to start in noninteractive environments.


See Also


Feedback and Support

If you encounter a product licensing issue, consider requesting a MATLAB batch licensing token to use in your pipeline. For more information, seeLicensing.

If you have an enhancement request or other feedback, create an issue on theIssues page.

For support, contactMathWorks Technical Support.

About

This repository makes it easy to run your MATLAB tests on some of the most common CI platforms. The configuration files take care of setting up MATLAB and automatically executing your MATLAB tests.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors12

Languages


[8]ページ先頭

©2009-2025 Movatter.jp