- Notifications
You must be signed in to change notification settings - Fork331
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
mathworks/ci-configuration-examples
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
| Azure® DevOps | CircleCI® | GitHub® Actions | 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.
Here's how to quickly get this repository running on a CI system:
- Fork the repository to your own GitHub account
- Go to one of the supported CI platforms and install the available MATLAB CI pluginNote: GitHub Actions does not require this step
- Create a new CI job using your forked repository
- 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"
Our Continuous Integration with MATLAB and GitHub Actions Workshop provides a step-by-step guide for getting started with GitHub Actions.
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 | |
|---|---|
| Badges | |
| Badge Code | [](https://dev.azure.com/AZURE_DEVOPS_ORG/AZURE_DEVOPS_PROJECT_NAME/_build)  |
| Badge Help | Blog with helpful information for setting up Azure DevOps badges |
| CircleCI | |
|---|---|
| Badge | |
| Badge Code | [](https://circleci.com/SOURCE_CONTROL_SYSTEM/GITHUB_USERNAME/GITHUB_REPO_NAME) |
| Badge Help | CircleCI documentation for setting up badges |
| GitHub Actions | |
|---|---|
| Badge | |
| Badge Code | [](https://github.com/GITHUB_USERNAME/GITHUB_REPO_NAME/actions/workflows/ci.yml) |
| Badge Help | GitHub Actions documentation for setting up badges |
| GitLab CI/CD | |
|---|---|
| Badge | |
| Badge Code | [](https://gitlab.com/GITLAB_PROJECT_PATH) |
| Badge Help | GitLab CI/CD documentation for setting up badges |
How to use the Badge Code:
- Copy-paste the badge code into your README.md file
- The badge code you copy should start with "
[!" and not "\[\!"
- The badge code you copy should start with "
- 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=###"
- To find the definition ID for your Azure DevOps pipeline, you must:
- 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
- Azure® DevOps
- CircleCI®
- GitHub® Actions
- Jenkins®
- GitLab® CI/CD
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 using
day(d,"dayofyear"), wheredis 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 in
TestExamples.mto increase the coverage to 100%.
There are 2 test classes provided:
- TestExamples.m - A simple set of equality and negative tests
- ParameterizedTestExamples.m - A set of 12 equality tests set up using the parameterized test format
The repository includes these files:
| File Path | Description |
|---|---|
code/dayofyear.m | Thedayofyear function returns the day-of-year number for a given date string "mm/dd/yyyy" |
tests/TestExamples.m | TheTestExamples class provides a few equality and negative tests for thedayofyear function |
tests/ParameterizedTestExample.m | TheParameterizedTestExample class provides 12 tests for thedayofyear function using the parameterized test format |
azure-pipelines.yml | Theazure-pipelines.yml file defines the pipeline that runs onAzure DevOps. |
.circleci/config.yml | Theconfig.yml file defines the pipeline that runs onCircleCI |
.github/workflows/ci.yml | Theci.yml file defines the pipeline that runs onGitHub Actions |
Jenkinsfile | TheJenkinsfile file defines the pipeline that runs onJenkins |
.gitlab-ci.yml | The.gitlab-ci.yml file defines the pipeline that runs onGitLab CI/CD |
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.
- Advanced Continuous Integration (CI) configuration examples for MATLAB
- Continuous Integration with MATLAB and Simulink
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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors12
Uh oh!
There was an error while loading.Please reload this page.