diff --git a/.circleci/CrossPlatformBuilder.yml b/.circleci/CrossPlatformBuilder.yml index acf5e86..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 @@ -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..d6a607b --- /dev/null +++ b/.circleci/TestSplitting.yml @@ -0,0 +1,53 @@ +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: 16.4.0 + windows: + win/default + +jobs: + split-and-run-test: + parameters: + os: + type: executor + executor: << parameters.os >> + # Use parallelism to split tests across multiple containers + parallelism: 2 + steps: + - checkout + + # Install MATLAB and required products + - matlab/install: + products: > + MATLAB_Compiler_SDK + MATLAB_Test + + # Builds mex file and Python package from MATLAB function + - matlab/run-build: + tasks: mex buildPythonPackage + + # Run MATLAB tests, splitting them by timing across parallel containers + - matlab/run-tests: + 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: + jobs: + # A job will run for each OS present in the matrix + - split-and-run-test: + matrix: + parameters: + os: [linux, macos, windows] \ No newline at end of file diff --git a/.circleci/ToolboxDistribution.yml b/.circleci/ToolboxDistribution.yml index 7cc025d..c7c589a 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 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..c5e8ebb 100644 --- a/Jenkins/ToolboxDistribution/Jenkinsfile +++ b/Jenkins/ToolboxDistribution/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { agent { label "${OS}" } tools { - matlab 'R2024b' + matlab 'R2025b' } steps { @@ -44,7 +44,7 @@ pipeline { } tools { - matlab 'R2024b' + matlab 'R2025b' } steps { 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.