在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mathworks/ci-configuration-examples开源软件地址(OpenSource Url):https://github.com/mathworks/ci-configuration-examples开源编程语言(OpenSource Language):MATLAB 100.0%开源软件介绍(OpenSource Introduction):
Continuous Integration (CI) configuration examples for MATLAB®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. Take a look at the "Quick Start Guide" below to get started! Quick start guideHere's how to quickly get this repository running on a CI system:
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:
BadgesBadges 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.
How to use the Badge Code:
Supported CI platforms
About the codeThe 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, Travis CI). Each of these pipeline definitions does four things:
The example MATLAB code example Notes:
There are 2 test classes provided:
The repository includes these files:
CI configuration filesAzure DevOpspool:
vmImage: ubuntu-latest
steps:
- task: InstallMATLAB@0
- task: RunMATLABTests@0
inputs:
sourceFolder: code
codeCoverageCobertura: code-coverage/coverage.xml
testResultsJUnit: test-results/results.xml
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'test-results/results.xml'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: 'code-coverage/coverage.xml'
pathToSources: 'code/'
# As an alternative to RunMATLABTests, you can use RunMATLABCommand to execute a MATLAB script, function, or statement.
# - task: RunMATLABCommand@0
# inputs:
# command: addpath('code'); results = runtests('IncludeSubfolders', true); assertSuccess(results); CircleCIversion: 2.1
orbs:
matlab: mathworks/matlab@0
jobs:
build:
machine:
image: ubuntu-2004:202201-02
steps:
- checkout
- matlab/install
- matlab/run-tests:
source-folder: code
# As an alternative to run-tests, you can use run-command to execute a MATLAB script, function, or statement.
# - matlab/run-command:
# command: addpath('code'); results = runtests('IncludeSubfolders', true); assertSuccess(results); GitHub Actions# This is a basic workflow to help you get started with MATLAB Actions
name: MATLAB Build
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Sets up MATLAB on the GitHub Actions runner
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v1
# Runs a set of commands using the runners shell
- name: Run all tests
uses: matlab-actions/run-tests@v1
with:
source-folder: code
# As an alternative to run-tests, you can use run-command to execute a MATLAB script, function, or statement.
#- name: Run all tests
# uses: matlab-actions/run-command@v1
# with:
# command: addpath('code'); results = runtests('IncludeSubfolders', true); assertSuccess(results); Jenkinspipeline {
agent any
stages {
stage('Run MATLAB Tests') {
steps {
runMATLABTests(
sourceFolder: 'code'
)
// As an alternative to runMATLABTests, you can use runMATLABCommand to execute a MATLAB script, function, or statement.
// runMATLABCommand "addpath('code'); results = runtests('IncludeSubfolders', true); assertSuccess(results);"
}
}
}
} Travis CIlanguage: matlab
script: matlab -batch "addpath('code'); results = runtests('IncludeSubfolders', true); assertSuccess(results);" GitLab CI/CDstages:
- matlab-test
matlab-test:
stage: matlab-test
script:
- matlab -batch "addpath('code'); results = runtests('IncludeSubfolders', true); assertSuccess(results);" Caveats
LinksContact UsIf you have any questions or suggestions, please contact MathWorks at [email protected]. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论