Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1709e3c
initial commit
mw-kapilg Feb 6, 2023
010a177
Update templateDesign.yml
mw-kapilg Feb 6, 2023
4c19b89
Update templateDesign.yml
mw-kapilg Feb 6, 2023
babf3dc
added source code and test
mw-kapilg Feb 6, 2023
7e2878e
Update templateDesign.yml
mw-kapilg Feb 6, 2023
b58a3d1
Updated buildfile location
mw-kapilg Feb 6, 2023
54a6e69
Updated source code
mw-kapilg Feb 6, 2023
611052c
Update templateDesign.yml
mw-kapilg Feb 6, 2023
a77a00e
Update templateDesign.yml
mw-kapilg Feb 6, 2023
31b4606
Update templateDesign.yml
mw-kapilg Feb 6, 2023
a2aa5e3
Update templateDesign.yml
mw-kapilg Feb 6, 2023
0668b6f
Update templateDesign.yml
mw-kapilg Feb 6, 2023
5d3311f
removed unwanted files
mw-kapilg Feb 6, 2023
2139861
updated buildfile
mw-kapilg Feb 6, 2023
54327c4
Added 2nd template
mw-kapilg Feb 9, 2023
7f58ad5
Updated template1
mw-kapilg Feb 9, 2023
797960e
Fixed typo
mw-kapilg Feb 9, 2023
ac9993f
Added artifacts uploading in templates
mw-kapilg Feb 9, 2023
bd404a9
renamed files/folders
mw-kapilg Feb 9, 2023
6f85612
Updated buildfile
mw-kapilg Feb 9, 2023
3fb067a
Updated branch to $default-branch
mw-kapilg Feb 13, 2023
4a8e3b6
Updated names
mw-kapilg Feb 15, 2023
8eea4a3
Fixed typo
mw-kapilg Feb 15, 2023
f286202
Fixed name
mw-kapilg Feb 15, 2023
3f3cdbf
Update templateSample1.yml
mw-kapilg Jun 5, 2023
03322d6
Update templateSample1.yml
mw-kapilg Jun 5, 2023
4098165
Update templateSample1.yml
mw-kapilg Jun 5, 2023
9a94a40
Create config.yml
mw-kapilg Aug 24, 2023
aedd6c2
Update config.yml
mw-kapilg Aug 24, 2023
0c445f8
Create dayofyear.m
mw-kapilg Aug 24, 2023
d6ed87a
Create ParameterizedTestExample.m
mw-kapilg Aug 24, 2023
c121a20
Create TestExamples.m
mw-kapilg Aug 24, 2023
fff5154
Update config.yml
mw-kapilg Aug 24, 2023
0ecdb04
Update config.yml
mw-kapilg Aug 24, 2023
cf22136
Update config.yml
mw-kapilg Aug 24, 2023
3a2c577
Update Test1.m
mw-kapilg Aug 24, 2023
ba83158
Update config.yml
mw-kapilg Aug 24, 2023
fa8f9e4
Update config.yml
mw-kapilg Aug 24, 2023
64712ca
Update config.yml
mw-kapilg Aug 24, 2023
4251200
Update config.yml
mw-kapilg Aug 25, 2023
6069e59
Update config.yml
mw-kapilg Aug 25, 2023
2789abc
Update config.yml
mw-kapilg Aug 25, 2023
632fe62
Update config.yml
mw-kapilg Aug 25, 2023
284367c
Update config.yml
mw-kapilg Aug 25, 2023
629996a
Update config.yml
mw-kapilg Aug 25, 2023
f5654dd
Update config.yml
mw-kapilg Aug 25, 2023
0a6f76f
Update config.yml
mw-kapilg Aug 25, 2023
6ff27f2
Update config.yml
mw-kapilg Feb 21, 2024
9ff1147
Update config.yml
mw-kapilg Feb 21, 2024
58e166c
Update config.yml
mw-kapilg Feb 21, 2024
4fdfaac
Update config.yml
mw-kapilg Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
version: 2.1
orbs:
matlab: mathworks/matlab@0
matlab: mathworks/matlab@1
jobs:
build:
environment:
MLM_LICENSE_TOKEN: [email protected]|test_token|AAARAYelzOx0ZtlcbAzLqfVklD1U/WR8wE6UNGVy+kwT+AUq8zWnWvSvchpfeU1s+Ryyj6Wi/fO/elTyIS994z7zbk/TiyNJ/amAZNVKZMQz8SWQplW2fj+fL9uRY7X2meObVT6LA0pzE4QGvKt9wmQKAIsNt1AlcRznzyk82E6bPdWiaw+fjwk
# MATHWORKS_ACCOUNT: [email protected]
machine:
image: ubuntu-2004:202201-02
steps:
- checkout
# - checkout
- matlab/install
- matlab/run-tests:
source-folder: code
- run:
command: |
echo "$PATH"
# echo "$MATHWORKS_ACCOUNT"
matlab-batch pwd
# mkdir matlabCommandArtifacts
# echo '<!DOCTYPE html><html><body><h2>HTML Links</h2><p>HTML links are defined with the a tag:</p><a href="https://www.w3schools.com">This is a link</a></body></html>' > matlabCommandArtifacts/myfile.html
# cd matlabCommandArtifacts
# ls
# cat myfile.html
# - store_artifacts:
# path: matlabCommandArtifacts/
# - matlab/run-tests:
# source-folder: code
# select-by-folder: tests
# code-coverage-html: /matlabTestArtifacts/coverage
# - store_artifacts:
# path: /matlabTestArtifacts/coverage

# As an alternative to run-tests, you can use run-command to execute a MATLAB script, function, or statement.
# - matlab/run-command:
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/ci.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/templateSample1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This is a basic workflow to help you get started with MATLAB Actions

name: Build and test your MEX file

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ testing ]
pull_request:
branches: [ testing ]
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:
# 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

- name: Softwares
uses: matlab-actions/run-command@v1
with:
command: ver

- name: Build MEX file using buildtool
uses: matlab-actions/run-build@v1

- name: Run all tests and generate artifacts
uses: matlab-actions/run-tests@v1
with:
source-folder: codeDesign
test-results-junit: test-results/results.xml
code-coverage-cobertura: code-coverage/coverage.xml

- name: Upload test results artifact
uses: actions/upload-artifact@v2
if: always()
with:
name: test-restuls
path: test-results/results.xml

- name: Upload code coverage artifact
uses: actions/upload-artifact@v2
if: always()
with:
name: code-coverage
path: code-coverage/coverage.xml
56 changes: 56 additions & 0 deletions .github/workflows/templateSample2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This is a basic workflow to help you get started with MATLAB Actions

name: Build and test

# Controls when the action will run
on:
# Triggers the workflow on push or pull request events
push:
branches: [ $default-branch ]
pull_request:
branches: [ $default-branch ]

jobs:
# This workflow contains a single job called "bat"
bat:
name: Build and test

# The type of runner that the job will run on
runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# Set up MATLAB on the GitHub Actions runner
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v1

# Run the given tasks from the buildfile
- name: Execute buildplan
uses: matlab-actions/run-build@v1
with:
tasks: clean check compile

# Run all MATLAB tests and generate required artifacts
- name: Run tests and generate artifacts
uses: matlab-actions/run-tests@v1
with:
source-folder: code
test-results-junit: test-results/results.xml
code-coverage-cobertura: code-coverage/coverage.xml

# Upload generated artifacts to GitHub Actions
- name: Upload test results artifact
uses: actions/upload-artifact@v2
if: always()
with:
name: test-results
path: test-results/results.xml

- name: Upload code coverage artifact
uses: actions/upload-artifact@v2
if: always()
with:
name: code-coverage
path: code-coverage/coverage.xml
7 changes: 0 additions & 7 deletions .gitlab-ci.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .travis.yml

This file was deleted.

15 changes: 0 additions & 15 deletions Jenkinsfile

This file was deleted.

25 changes: 0 additions & 25 deletions azure-pipelines.yml

This file was deleted.

23 changes: 23 additions & 0 deletions buildfile.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function plan = buildfile
% Create a plan from the task functions
plan = buildplan(localfunctions);

% Make the "mex" task the default task in the plan
plan.DefaultTasks = "mex";

% % Make the "mex" task dependent on the "check" task
% plan("mex").Dependencies = ["check"];
end

function mexTask(~)
cd codeDesign
mex -setup C
mex arrayProduct.c
end

% function checkTask(~)
% % Identify code issues
% issues = codeIssues;
% assert(isempty(issues.Issues),formattedDisplayText(issues.Issues))
% end
%
1 change: 0 additions & 1 deletion code/dayofyear.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@


end

88 changes: 88 additions & 0 deletions codeSample/arrayProduct.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*==========================================================
* arrayProduct.c - example in MATLAB External Interfaces
*
* Multiplies an input scalar (multiplier)
* times a 1xN matrix (inMatrix)
* and outputs a 1xN matrix (outMatrix)
*
* The calling syntax is:
*
* outMatrix = arrayProduct(multiplier, inMatrix)
*
* This is a MEX-file for MATLAB.
* Copyright 2007-2012 The MathWorks, Inc.
*
*========================================================*/

#include "mex.h"

/* The computational routine */
void arrayProduct(double x, double *y, double *z, mwSize n)
{
mwSize i;
/* multiply each element y by x */
for (i=0; i<n; i++) {
z[i] = x * y[i];
}
}

/* The gateway function */
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
double multiplier; /* input scalar */
double *inMatrix; /* 1xN input matrix */
size_t ncols; /* size of matrix */
double *outMatrix; /* output matrix */

/* check for proper number of arguments */
if(nrhs!=2) {
mexErrMsgIdAndTxt("MyToolbox:arrayProduct:nrhs","Two inputs required.");
}
if(nlhs!=1) {
mexErrMsgIdAndTxt("MyToolbox:arrayProduct:nlhs","One output required.");
}
/* make sure the first input argument is scalar */
if( !mxIsDouble(prhs[0]) ||
mxIsComplex(prhs[0]) ||
mxGetNumberOfElements(prhs[0])!=1 ) {
mexErrMsgIdAndTxt("MyToolbox:arrayProduct:notScalar","Input multiplier must be a scalar.");
}

/* make sure the second input argument is type double */
if( !mxIsDouble(prhs[1]) ||
mxIsComplex(prhs[1])) {
mexErrMsgIdAndTxt("MyToolbox:arrayProduct:notDouble","Input matrix must be type double.");
}

/* check that number of rows in second input argument is 1 */
if(mxGetM(prhs[1])!=1) {
mexErrMsgIdAndTxt("MyToolbox:arrayProduct:notRowVector","Input must be a row vector.");
}

/* get the value of the scalar input */
multiplier = mxGetScalar(prhs[0]);

/* create a pointer to the real data in the input matrix */
#if MX_HAS_INTERLEAVED_COMPLEX
inMatrix = mxGetDoubles(prhs[1]);
#else
inMatrix = mxGetPr(prhs[1]);
#endif

/* get dimensions of the input matrix */
ncols = mxGetN(prhs[1]);

/* create the output matrix */
plhs[0] = mxCreateDoubleMatrix(1,(mwSize)ncols,mxREAL);

/* get a pointer to the real data in the output matrix */
#if MX_HAS_INTERLEAVED_COMPLEX
outMatrix = mxGetDoubles(plhs[0]);
#else
outMatrix = mxGetPr(plhs[0]);
#endif

/* call the computational routine */
arrayProduct(multiplier,inMatrix,outMatrix,(mwSize)ncols);
}
1 change: 0 additions & 1 deletion tests/ParameterizedTestExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ function testDayofyear(testCase,monthNum,dayNum,yearNum)
end

end

1 change: 0 additions & 1 deletion tests/TestExamples.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,3 @@ function testCorrectDateFormatButInvalidDate(testCase)
end

end

20 changes: 20 additions & 0 deletions testsSample/Test1.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
classdef Test1 < matlab.unittest.TestCase

% Copyright 2022 The MathWorks, Inc.

methods (Test)

function testMultiplication(testCase)
num = 2;
mat = [1, 2, 3];

% resultExpected = arrayProduct(num, mat);

resultActual = [2, 4, 6];

% testCase.verifyEqual(resultActual,resultExpected)
end

end

end