Skip to content

Commit c683356

Browse files
authored
Initial commit
1 parent d9b26e4 commit c683356

File tree

138 files changed

+1085
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+1085
-0
lines changed

.circleci/CrossPlatformBuilder.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: 2.1
2+
orbs:
3+
matlab: mathworks/matlab@1
4+
win: circleci/windows@5
5+
6+
# Define the execution environments for different operating systems
7+
executors:
8+
linux:
9+
machine:
10+
image: default
11+
macos:
12+
macos:
13+
xcode: 15.4.0
14+
windows:
15+
win/default
16+
17+
jobs:
18+
build-python-package:
19+
parameters:
20+
os:
21+
type: executor
22+
release:
23+
type: string
24+
executor: << parameters.os >>
25+
steps:
26+
- checkout
27+
28+
# Install MATLAB and required products
29+
- matlab/install:
30+
release: << parameters.release >>
31+
products: >
32+
MATLAB_Compiler_SDK
33+
MATLAB_Test
34+
35+
# Builds Python package from MATLAB function and verifies functionality through equivalence tests
36+
- matlab/run-build:
37+
tasks: equivalenceTest
38+
39+
# Stores the built Python package as an artifact
40+
- store_artifacts:
41+
path: KgToPoundsPythonBuild
42+
43+
workflows:
44+
cross-platform-build:
45+
jobs:
46+
# A job will run for all combinations of OS and release present in the matrix
47+
- build-python-package:
48+
matrix:
49+
parameters:
50+
os: [linux, macos, windows]
51+
release: ["R2024a", "R2024b"]

.circleci/ToolboxDistribution.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
version: 2.1
2+
orbs:
3+
matlab: mathworks/matlab@1
4+
gh: circleci/github-cli@2
5+
win: circleci/windows@5
6+
7+
# Define the execution environments for different operating systems
8+
executors:
9+
linux:
10+
machine:
11+
image: default
12+
macos:
13+
macos:
14+
xcode: 15.4.0
15+
windows:
16+
win/default
17+
18+
jobs:
19+
# This job compiles MEX files and runs tests across different platforms
20+
compile-and-test-mex:
21+
parameters:
22+
os:
23+
type: executor
24+
executor: << parameters.os >>
25+
steps:
26+
- checkout
27+
28+
- matlab/install
29+
30+
# Runs build to create MEX file and then run tests
31+
- matlab/run-build:
32+
tasks: test
33+
34+
# Uploads the test results
35+
- store_artifacts:
36+
path: test-results/results.xml
37+
38+
# Saves MEX files for the packaging job
39+
- persist_to_workspace:
40+
root: .
41+
paths:
42+
- toolbox/*.mex*
43+
44+
# This job packages and releases the toolbox after successful MEX compilation
45+
create-and-release-toolbox:
46+
machine:
47+
image: default
48+
steps:
49+
- checkout
50+
51+
- matlab/install
52+
53+
# Downloads all mex files from previous job
54+
- attach_workspace:
55+
at: .
56+
57+
# Packages all files in toolbox folder into a mltbx toolbox package
58+
- matlab/run-build:
59+
tasks: packageToolbox
60+
61+
# The packaged toolbox is distributed as a GitHub release
62+
- gh/install
63+
- run:
64+
name: Create a Github Release for the Toolbox
65+
command: gh release create <<pipeline.id>> toolbox.mltbx --title "Cross-Platform Array Product Toolbox" --notes "Cross-Platform Array Product Toolbox" --repo <<pipeline.project.git_url>>
66+
67+
workflows:
68+
toolbox-create-package-release:
69+
jobs:
70+
# A job will run for all the OS present in the matrix
71+
- compile-and-test-mex:
72+
matrix:
73+
parameters:
74+
os: [linux, macos, windows]
75+
- create-and-release-toolbox:
76+
requires:
77+
- compile-and-test-mex
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Cross-Platform Python Package Build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
# Utilizes repository-stored secrets for MATLAB's batch-token licensing
8+
env:
9+
MLM_LICENSE_TOKEN: ${{ secrets.MLM_LICENSE_TOKEN }}
10+
11+
jobs:
12+
# This workflow contains a single job called "build-python-package"
13+
build-python-package:
14+
15+
# A job will run for all combinations of OS and release present in the matrix
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, windows-latest, macos-latest]
19+
release: [R2024a, R2024b]
20+
21+
# The type of runner that the job will run on
22+
runs-on: ${{ matrix.os }}
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
# Sets up MATLAB on the GitHub Actions runner, downloads MATLAB_Compiler_SDK and MATLAB_Test
28+
- name: Setup MATLAB
29+
uses: matlab-actions/setup-matlab@v2
30+
with:
31+
release: ${{ matrix.release }}
32+
products: >
33+
MATLAB_Compiler_SDK
34+
MATLAB_Test
35+
36+
# Installs Python and adds it to the Path
37+
- name: Setup Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.11'
41+
42+
# Builds Python package from MATLAB function and verifies functionality through equivalence tests
43+
- name: Compile and Verify Python Package
44+
uses: matlab-actions/run-build@v2
45+
with:
46+
tasks: equivalenceTest
47+
48+
# Uploads the built Python package as an artifact to GitHub
49+
- name: Upload Python package artifact
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: KgToPounds-${{ matrix.release }}-${{ matrix.os }}
53+
path: KgToPounds*
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Compile, Test and Release toolbox
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
# This workflow contains two jobs called "compile-and-test-mex" and "create-and-release-toolbox"
9+
compile-and-test-mex:
10+
# A job will run for all the OS present in the matrix
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, windows-latest, macos-latest]
14+
15+
# The type of runner that the job will run on
16+
runs-on: ${{ matrix.os }}
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
# Sets up MATLAB on the GitHub Actions runner
22+
- name: Setup MATLAB
23+
uses: matlab-actions/setup-matlab@v2
24+
25+
# Runs build to create MEX file and then run tests
26+
- name: Run MATLAB build
27+
uses: matlab-actions/run-build@v2
28+
with:
29+
tasks: test
30+
31+
# Uploads the test results and MEX files to GitHub
32+
- name: Upload test results
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: test-results-${{ matrix.os }}
36+
path: test-results/results.xml
37+
38+
- name: Upload mex file
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: mex-${{ matrix.os }}
42+
path: toolbox/**/*.mex*
43+
44+
create-and-release-toolbox:
45+
# This job executes only after a successful completion of 'compile-and-test-mex' job
46+
needs: compile-and-test-mex
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- uses: actions/checkout@v3
51+
52+
# Sets up MATLAB on the GitHub Actions runner
53+
- name: Setup MATLAB
54+
uses: matlab-actions/setup-matlab@v2
55+
56+
# Downloads all mex files uploaded to GitHub in the previous job
57+
- name: Download mex files
58+
uses: actions/download-artifact@v4
59+
with:
60+
path: toolbox
61+
pattern: mex-*
62+
merge-multiple: true
63+
64+
# Packages all files in toolbox folder into a mltbx toolbox package
65+
- name: Run MATLAB build
66+
uses: matlab-actions/run-build@v2
67+
with:
68+
tasks: packageToolbox
69+
70+
# The packaged toolbox is distributed as a GitHub release
71+
- name: Create relase and upload asset
72+
run: |
73+
gh release create ${{github.run_id}} --title "Cross-Platform Array Product Toolbox" toolbox.mltbx
74+
env:
75+
GH_TOKEN: ${{ github.token }}

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Autosave files
2+
*.asv
3+
*.m~
4+
*.autosave
5+
*.slx.r*
6+
*.mdl.r*
7+
8+
# Derived content-obscured files
9+
*.p
10+
11+
# Compiled MEX files
12+
*.mex*
13+
14+
# Packaged app and toolbox files
15+
*.mlappinstall
16+
*.mltbx
17+
18+
# Deployable archives
19+
*.ctf
20+
21+
# Generated helpsearch folders
22+
helpsearch*/
23+
24+
# Code generation folders
25+
slprj/
26+
sccprj/
27+
codegen/
28+
29+
# Cache files
30+
*.slxc
31+
32+
# Cloud based storage dotfile
33+
.MATLABDriveTag
34+
35+
.buildtool/

AdvancedCIConfigurationExamples.prj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<MATLABProject xmlns="http://www.mathworks.com/MATLABProjectFile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"/>

AzureDevOps/CrossPlatformBuilder.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
jobs:
2+
- job: BuildPythonPackage
3+
# Matrix strategy to run builds across different OS and MATLAB release combinations
4+
strategy:
5+
matrix:
6+
linux-R2024a:
7+
imageName: ubuntu-latest
8+
release: R2024a
9+
linux-R2024b:
10+
imageName: ubuntu-latest
11+
release: R2024b
12+
mac-R2024a:
13+
imageName: macOS-latest
14+
release: R2024a
15+
mac-R2024b:
16+
imageName: macOS-latest
17+
release: R2024b
18+
windows-R2024a:
19+
imageName: windows-latest
20+
release: R2024a
21+
windows-R2024b:
22+
imageName: windows-latest
23+
release: R2024b
24+
pool:
25+
vmImage: $(imageName)
26+
steps:
27+
# Install MATLAB and required products
28+
- task: InstallMATLAB@1
29+
inputs:
30+
release: $(release)
31+
products: MATLAB_Compiler_SDK MATLAB_Test
32+
33+
# Builds Python package from MATLAB function and verifies functionality through equivalence tests
34+
- task: RunMATLABBuild@1
35+
inputs:
36+
tasks: equivalenceTest
37+
env:
38+
MLM_LICENSE_TOKEN: $(MLM_LICENSE_TOKEN)
39+
40+
# Store the built Python package as an artifact
41+
- task: PublishBuildArtifacts@1
42+
inputs:
43+
PathtoPublish: KgToPoundsPythonBuild
44+
ArtifactName: KgToPounds-$(release)-$(imageName)
45+
publishLocation: Container

0 commit comments

Comments
 (0)