From 678dc2f8f34ef532083e56d4f44ed07d1cd6ad21 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Thu, 4 Dec 2025 12:01:59 +0530 Subject: [PATCH 1/6] add circleci test splitting workflow and update releases --- .circleci/CrossPlatformBuilder.yml | 2 +- .circleci/TestSplitting.yml | 46 ++++++++++++++++++++++ .github/workflows/CrossPlatformBuilder.yml | 2 +- AzureDevOps/CrossPlatformBuilder.yml | 20 +++++----- Jenkins/CrossPlatformBuilder/Jenkinsfile | 2 +- Jenkins/ToolboxDistribution/Jenkinsfile | 4 +- 6 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 .circleci/TestSplitting.yml diff --git a/.circleci/CrossPlatformBuilder.yml b/.circleci/CrossPlatformBuilder.yml index acf5e86..a2edea8 100644 --- a/.circleci/CrossPlatformBuilder.yml +++ b/.circleci/CrossPlatformBuilder.yml @@ -48,4 +48,4 @@ workflows: matrix: parameters: os: [linux, macos, windows] - release: ["R2024b", "R2025a"] \ No newline at end of file + release: ["R2025a", "R2025b"] \ No newline at end of file diff --git a/.circleci/TestSplitting.yml b/.circleci/TestSplitting.yml new file mode 100644 index 0000000..d135ef9 --- /dev/null +++ b/.circleci/TestSplitting.yml @@ -0,0 +1,46 @@ +version: 2.1 +orbs: + matlab: mathworks/matlab@1 + win: circleci/windows@5 + +# Define the execution environments for different operating systems +executors: + linux: + machine: + image: default + macos: + macos: + xcode: 15.4.0 + windows: + win/default + +jobs: + split-test: + parameters: + os: + type: executor + executor: << parameters.os >> + steps: + - checkout + + # Install MATLAB and required products + - matlab/install: + products: > + MATLAB_Compiler_SDK + MATLAB_Test + + # Builds Python package from MATLAB function + - matlab/run-build: + tasks: mex buildPythonPackage + + - - matlab/run-tests: + select-by-name: $(circleci tests glob "tests/**/*.m" | circleci tests split | awk -F'[\\\\/.]' '{print $(NF-1) "/*"}') + +workflows: + test-splitting-build: + jobs: + # A job will run for each OS present in the matrix + - split-test: + matrix: + parameters: + os: [linux, macos, windows] \ No newline at end of file diff --git a/.github/workflows/CrossPlatformBuilder.yml b/.github/workflows/CrossPlatformBuilder.yml index 8bd61f8..953ca71 100644 --- a/.github/workflows/CrossPlatformBuilder.yml +++ b/.github/workflows/CrossPlatformBuilder.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - release: [R2024b, R2025a] + release: [R2025a, R2025b] # The type of runner that the job will run on runs-on: ${{ matrix.os }} diff --git a/AzureDevOps/CrossPlatformBuilder.yml b/AzureDevOps/CrossPlatformBuilder.yml index efd92aa..c1888e9 100644 --- a/AzureDevOps/CrossPlatformBuilder.yml +++ b/AzureDevOps/CrossPlatformBuilder.yml @@ -3,24 +3,24 @@ jobs: # Matrix strategy to run builds across different OS and MATLAB release combinations strategy: matrix: - linux-R2024b: - imageName: ubuntu-latest - release: R2024b linux-R2025a: imageName: ubuntu-latest release: R2025a - mac-R2024b: - imageName: macOS-latest - release: R2024b + linux-R2025b: + imageName: ubuntu-latest + release: R2025b mac-R2025a: imageName: macOS-latest release: R2025a - windows-R2024b: - imageName: windows-latest - release: R2024b + mac-R2025b: + imageName: macOS-latest + release: R2025b windows-R2025a: imageName: windows-latest - release: R2025a + release: R2025a + windows-R2025b: + imageName: windows-latest + release: R2025b pool: vmImage: $(imageName) steps: diff --git a/Jenkins/CrossPlatformBuilder/Jenkinsfile b/Jenkins/CrossPlatformBuilder/Jenkinsfile index 61d2eda..ff3b266 100644 --- a/Jenkins/CrossPlatformBuilder/Jenkinsfile +++ b/Jenkins/CrossPlatformBuilder/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { } axis { name 'RELEASE' - values 'R2024b', 'R2025a' + values 'R2025a', 'R2025b' } } stages { diff --git a/Jenkins/ToolboxDistribution/Jenkinsfile b/Jenkins/ToolboxDistribution/Jenkinsfile index 8ed6f54..9b0d010 100644 --- a/Jenkins/ToolboxDistribution/Jenkinsfile +++ b/Jenkins/ToolboxDistribution/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { agent { label "${OS}" } tools { - matlab 'R2024b' + matlab 'R2025a' } steps { @@ -44,7 +44,7 @@ pipeline { } tools { - matlab 'R2024b' + matlab 'R2025a' } steps { From 624b07f7db13fd8892a6766b2d47963ec4eb3f65 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Thu, 11 Dec 2025 11:30:24 +0530 Subject: [PATCH 2/6] update workflows --- .circleci/CrossPlatformBuilder.yml | 2 +- .circleci/TestSplitting.yml | 9 ++++++--- .circleci/ToolboxDistribution.yml | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.circleci/CrossPlatformBuilder.yml b/.circleci/CrossPlatformBuilder.yml index a2edea8..a592a56 100644 --- a/.circleci/CrossPlatformBuilder.yml +++ b/.circleci/CrossPlatformBuilder.yml @@ -10,7 +10,7 @@ executors: image: default macos: macos: - xcode: 15.4.0 + xcode: 16.4.0 windows: win/default diff --git a/.circleci/TestSplitting.yml b/.circleci/TestSplitting.yml index d135ef9..fb19fc8 100644 --- a/.circleci/TestSplitting.yml +++ b/.circleci/TestSplitting.yml @@ -10,7 +10,7 @@ executors: image: default macos: macos: - xcode: 15.4.0 + xcode: 16.4.0 windows: win/default @@ -20,6 +20,8 @@ jobs: os: type: executor executor: << parameters.os >> + # Use parallelism to split tests across multiple containers + parallelism: 2 steps: - checkout @@ -29,11 +31,12 @@ jobs: MATLAB_Compiler_SDK MATLAB_Test - # Builds Python package from MATLAB function + # Builds mex file and Python package from MATLAB function - matlab/run-build: tasks: mex buildPythonPackage - - - matlab/run-tests: + # Run MATLAB tests, splitting them across parallel containers + - matlab/run-tests: select-by-name: $(circleci tests glob "tests/**/*.m" | circleci tests split | awk -F'[\\\\/.]' '{print $(NF-1) "/*"}') workflows: diff --git a/.circleci/ToolboxDistribution.yml b/.circleci/ToolboxDistribution.yml index 29b73ab..181deae 100644 --- a/.circleci/ToolboxDistribution.yml +++ b/.circleci/ToolboxDistribution.yml @@ -11,7 +11,7 @@ executors: image: default macos: macos: - xcode: 15.4.0 + xcode: 16.4.0 windows: win/default From 940cf8df786164f5e76e26bb7637d5c176e5d2ba Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Thu, 11 Dec 2025 11:47:55 +0530 Subject: [PATCH 3/6] update Jenkins release --- Jenkins/ToolboxDistribution/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkins/ToolboxDistribution/Jenkinsfile b/Jenkins/ToolboxDistribution/Jenkinsfile index 9b0d010..c5e8ebb 100644 --- a/Jenkins/ToolboxDistribution/Jenkinsfile +++ b/Jenkins/ToolboxDistribution/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { agent { label "${OS}" } tools { - matlab 'R2025a' + matlab 'R2025b' } steps { @@ -44,7 +44,7 @@ pipeline { } tools { - matlab 'R2025a' + matlab 'R2025b' } steps { From d32b9739e78722398853c6c2b05618ffc8f38eb1 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Thu, 11 Dec 2025 12:21:49 +0530 Subject: [PATCH 4/6] update README.md --- README.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8b34424..cf1869d 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ This repository includes examples of advanced workflows in MATLAB® for common CI platforms. For example, you can use matrix-build templates to package and distribute toolboxes across operating systems or build and deploy standalone applications for multiple MATLAB releases. The repository includes all the required source code, tests, and configuration files for each workflow and CI platform. This repository provides workflow examples for these platforms: + * [Azure® DevOps](https://marketplace.visualstudio.com/items?itemName=MathWorks.matlab-azure-devops-extension) * [CircleCI®](https://github.com/mathworks/matlab-circleci-orb/blob/master/README.md) * [GitHub® Actions](https://github.com/matlab-actions) @@ -16,9 +17,10 @@ For starter workflows, use the [`ci-configuration-examples`](https://github.com/ The repository contains examples for packaging and distributing a toolbox, building and uploading Python® packages, and running tests across multiple build agents. -- **Package and Distribute Toolbox**: Using a matrix build across multiple platforms, compile, link, and test your C source files to produce a binary MEX file per operating system. Then, bundle the resulting binaries into a toolbox and distribute it as a GitHub release. +* **Package and Distribute Toolbox**: Using a matrix build across multiple platforms, compile, link, and test your C source files to produce a binary MEX file per operating system. Then, bundle the resulting binaries into a toolbox and distribute it as a GitHub release. To access the configuration files for this workflow, follow the links in this table. + | **Platform** | **File Path** | |--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| | Azure DevOps| [`AzureDevOps/ToolboxDistribution.yml`](https://github.com/mathworks/advanced-ci-configuration-examples/blob/main/AzureDevOps/ToolboxDistribution.yml) | @@ -26,9 +28,10 @@ The repository contains examples for packaging and distributing a toolbox, build | GitHub Actions| [`.github/workflows/ToolboxDistribution.yml`](https://github.com/mathworks/advanced-ci-configuration-examples/blob/main/.github/workflows/ToolboxDistribution.yml) | | Jenkins | [`Jenkins/ToolboxDistribution/Jenkinsfile`](https://github.com/mathworks/advanced-ci-configuration-examples/blob/main/Jenkins/ToolboxDistribution/Jenkinsfile) | -- **Build and Upload Python Packages**: Using a matrix build across multiple platforms and MATLAB releases, build python packages by compiling MATLAB functions (requires MATLAB Compiler SDK™) and upload the resulting packages as artifacts. +* **Build and Upload Python Packages**: Using a matrix build across multiple platforms and MATLAB releases, build python packages by compiling MATLAB functions (requires MATLAB Compiler SDK™) and upload the resulting packages as artifacts. To access the configuration files for this workflow, follow the links in this table. + | **Platform** | **File Path** | |--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| | Azure DevOps| [`AzureDevOps/CrossPlatformBuilder.yml`](https://github.com/mathworks/advanced-ci-configuration-examples/blob/main/AzureDevOps/CrossPlatformBuilder.yml) | @@ -36,13 +39,21 @@ The repository contains examples for packaging and distributing a toolbox, build | GitHub Actions| [`.github/workflows/CrossPlatformBuilder.yml`](https://github.com/mathworks/advanced-ci-configuration-examples/blob/main/.github/workflows/CrossPlatformBuilder.yml) | | Jenkins | [`Jenkins/CrossPlatformBuilder/Jenkinsfile`](https://github.com/mathworks/advanced-ci-configuration-examples/blob/main/Jenkins/CrossPlatformBuilder/Jenkinsfile) | -- **Run Tests Across Multiple Agents**: Use the [parallel strategy](https://learn.microsoft.com/en-us/azure/devops/pipelines/test/parallel-testing-any-test-runner?view=azure-devops) in Azure DevOps to run tests across multiple agents and speed up the testing process. For configuration details, see the example in [`AzureDevOps/ParallelStrategy/ParallelStrategy.yml`](https://github.com/mathworks/advanced-ci-configuration-examples/blob/main/AzureDevOps/ParallelStrategy/ParallelStrategy.yml). +* **Run Tests Across Multiple Agents**: Use the [parallel strategy](https://learn.microsoft.com/en-us/azure/devops/pipelines/test/parallel-testing-any-test-runner?view=azure-devops) in Azure DevOps or [test splitting](https://circleci.com/docs/guides/optimize/parallelism-faster-jobs/) in CircleCI to run tests across multiple agents and speed up the testing process. + + To access the configuration files for this workflow, follow the links in this table. + + | **Platform** | **File Path** | + |--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| + | Azure DevOps| [`AzureDevOps/ParallelStrategy/ParallelStrategy.yml`](https://github.com/mathworks/advanced-ci-configuration-examples/blob/main/AzureDevOps/ParallelStrategy/ParallelStrategy.yml) | + | CircleCI| [`.circleci/TestSplitting.yml`](https://github.com/mathworks/advanced-ci-configuration-examples/blob/main/.circleci/TestSplitting.yml) |
## Get Started 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 CI integration for MATLAB. (GitHub Actions does not require this step.) 3. Create a new CI job using your forked repository. You need to specify which file to use based on the workflow you intend to run. @@ -53,22 +64,25 @@ That's really it!
## Licensing + Product licensing for your workflow depends on your project visibility as well as the types of products the workflow 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. +* 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 a [MATLAB batch licensing token](https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/alternates/non-interactive/MATLAB-BATCH.md#matlab-batch-licensing-token) by submitting the [MATLAB Batch Licensing Pilot](https://www.mathworks.com/support/batch-tokens.html) form. Batch licensing tokens are strings that enable MATLAB to start in noninteractive environments.
## See Also -- [Continuous Integration (CI) configuration examples for MATLAB](https://github.com/mathworks/ci-configuration-examples) -- [Continuous Integration with MATLAB and Simulink®](https://www.mathworks.com/solutions/continuous-integration.html) + +* [Continuous Integration (CI) configuration examples for MATLAB](https://github.com/mathworks/ci-configuration-examples) +* [Continuous Integration with MATLAB and Simulink®](https://www.mathworks.com/solutions/continuous-integration.html)
## Feedback and Support + If you encounter a product licensing issue, consider requesting a MATLAB batch licensing token to use in your workflow. For more information, see [Licensing](#licensing). If you have an enhancement request or other feedback, create an issue on the [Issues](https://github.com/mathworks/advanced-ci-configuration-examples/issues) page. From 80cf2e164cb26719a399ce847e0f726268bcecc6 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Thu, 11 Dec 2025 13:40:29 +0530 Subject: [PATCH 5/6] update job name --- .circleci/TestSplitting.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/TestSplitting.yml b/.circleci/TestSplitting.yml index fb19fc8..a4617f5 100644 --- a/.circleci/TestSplitting.yml +++ b/.circleci/TestSplitting.yml @@ -15,7 +15,7 @@ executors: win/default jobs: - split-test: + split-and-run-test: parameters: os: type: executor @@ -43,7 +43,7 @@ workflows: test-splitting-build: jobs: # A job will run for each OS present in the matrix - - split-test: + - split-and-run-test: matrix: parameters: os: [linux, macos, windows] \ No newline at end of file From 120fcaaebfa78ac26e62afb0b7c11bd0bf4cb8d8 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Tue, 16 Dec 2025 13:48:43 +0530 Subject: [PATCH 6/6] Use split-by-timing --- .circleci/TestSplitting.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.circleci/TestSplitting.yml b/.circleci/TestSplitting.yml index a4617f5..d6a607b 100644 --- a/.circleci/TestSplitting.yml +++ b/.circleci/TestSplitting.yml @@ -35,9 +35,13 @@ jobs: - matlab/run-build: tasks: mex buildPythonPackage - # Run MATLAB tests, splitting them across parallel containers + # Run MATLAB tests, splitting them by timing across parallel containers - matlab/run-tests: - select-by-name: $(circleci tests glob "tests/**/*.m" | circleci tests split | awk -F'[\\\\/.]' '{print $(NF-1) "/*"}') + test-results-junit: test-results/results.xml + select-by-name: $(circleci tests glob "tests/**/*.m" | awk -F'[\\\\/.]' '{print $(NF-1)}' | circleci tests split --split-by=timings --timings-type=classname | awk '{print $0 "/*"}') + + - store_test_results: + path: test-results/results.xml workflows: test-splitting-build: