-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29ff234
commit cb33fed
Showing
12 changed files
with
211 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: MATLAB Build | ||
|
||
# Controls when the action will run. | ||
on: | ||
push: | ||
branches: [ release ] | ||
pull_request: | ||
branches: [ release ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
MATLABVersion: [R2023a,R2023b] | ||
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 | ||
with: | ||
release: ${{ matrix.MATLABVersion }} | ||
|
||
# Run SmokeTests | ||
- name: Run SmokeTests | ||
uses: matlab-actions/run-command@v1 | ||
with: | ||
command: openProject(pwd); results = runtests(fullfile("SoftwareTests","SmokeTests.m")); assertSuccess(results); | ||
|
||
# Run FunctionTests | ||
- name: Run FunctionTests | ||
uses: matlab-actions/run-command@v1 | ||
with: | ||
command: openProject(pwd); results = runtests(fullfile("SoftwareTests","FunctionTests.m")); assertSuccess(results); | ||
|
||
# Upload the test results as artifact | ||
- name: Upload TestResults | ||
uses: actions/[email protected] | ||
with: | ||
name: TestResults | ||
path: ./SoftwareTests/TestResults_${{ matrix.MATLABVersion }}.txt | ||
|
||
# Download the test results from artifact | ||
- name: Download TestResults | ||
uses: actions/[email protected] | ||
with: | ||
name: TestResults | ||
path: ./SoftwareTests/ | ||
|
||
# Create the test results badge | ||
- name: Run CreateBadge | ||
uses: matlab-actions/run-command@v1 | ||
with: | ||
command: openProject(pwd); results = runtests(fullfile("SoftwareTests","CreateBadge.m")); | ||
|
||
# Commit the JSON for the MATLAB releases badge | ||
- name: Commit changed files | ||
continue-on-error: true | ||
run: | | ||
git config user.name "${{ github.workflow }} by ${{ github.actor }}" | ||
git config user.email "<>" | ||
git pull | ||
git add | ||
git commit Images/TestedWith.json -m "Update CI badges ${{ github.ref_name }}" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
% Run these tests with runMyTests | ||
% All tests so far are on code expected to run without errors | ||
% If/when we end up with a version that _should_ error, | ||
% please add it to this set of examples | ||
classdef CreateBadge < matlab.unittest.TestCase | ||
|
||
properties | ||
rootProject | ||
results | ||
end | ||
|
||
|
||
methods (TestClassSetup) | ||
|
||
function setUpPath(testCase) | ||
|
||
try | ||
project = currentProject; | ||
testCase.rootProject = project.RootFolder; | ||
cd(testCase.rootProject) | ||
catch | ||
error("Load project prior to run tests") | ||
end | ||
|
||
testCase.log("Running in " + version) | ||
|
||
end % function setUpPath | ||
|
||
function readResults(testCase) | ||
Release = string([]); | ||
Passed = []; | ||
testCase.results = table(Release,Passed); | ||
|
||
ResultFiles = dir("SoftwareTests"+filesep+"TestResults_*"); | ||
for kFiles = 1:size(ResultFiles) | ||
Results = readtable(fullfile(ResultFiles(kFiles).folder,ResultFiles(kFiles).name),... | ||
Delimiter=",",TextType="string"); | ||
Release = Results.Version(1); | ||
Passed = all(Results.Status == "passed"); | ||
testCase.results(end+1,:) = table(Release,Passed); | ||
end | ||
end | ||
|
||
end % methods (TestClassSetup) | ||
|
||
methods(Test) | ||
|
||
function writeBadge(testCase) | ||
|
||
% Create JSON | ||
badgeInfo = struct; | ||
badgeInfo.schemaVersion = 1; | ||
badgeInfo.label = "tested with"; | ||
badgeInfo.message = ""; | ||
|
||
% Check that results exist: | ||
if size(testCase.results,1) == 0 | ||
badgeInfo.message = "None"; | ||
badgeInfo.color = "failed"; | ||
else | ||
for i = 1:size(testCase.results,1) | ||
if testCase.results.Passed(i) | ||
if badgeInfo.message ~= "" | ||
badgeInfo.message = badgeInfo.message + " | "; | ||
end | ||
badgeInfo.message = badgeInfo.message + string(testCase.results.Release(i)); | ||
end | ||
end | ||
badgeInfo.color = "success"; | ||
end | ||
|
||
% Write JSON file out | ||
badgeJSON = jsonencode(badgeInfo); | ||
fid = fopen(fullfile("Images","TestedWith.json"),"w"); | ||
fwrite(fid,badgeJSON); | ||
fclose(fid); | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
resources/project/ZN2RlSIbyWXhOxbxxI4hOawbMD4/EyDhXb-HjEIhAYfuSMUxquCH4aYd.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Info> | ||
<Category UUID="FileClassCategory"> | ||
<Label UUID="test"/> | ||
</Category> | ||
</Info> |
2 changes: 2 additions & 0 deletions
2
resources/project/ZN2RlSIbyWXhOxbxxI4hOawbMD4/EyDhXb-HjEIhAYfuSMUxquCH4aYp.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Info location="CreateBadge.m" type="File"/> |
6 changes: 6 additions & 0 deletions
6
resources/project/ZN2RlSIbyWXhOxbxxI4hOawbMD4/p5HYYVUpTuYgZwnT8QkkzaoJraUd.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Info> | ||
<Category UUID="FileClassCategory"> | ||
<Label UUID="test"/> | ||
</Category> | ||
</Info> |
2 changes: 2 additions & 0 deletions
2
resources/project/ZN2RlSIbyWXhOxbxxI4hOawbMD4/p5HYYVUpTuYgZwnT8QkkzaoJraUp.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Info location="FunctionTests.m" type="File"/> |
2 changes: 2 additions & 0 deletions
2
resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/trBOSMFt-ZFz0tI8PrpBhVjGM5Md.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Info/> |
2 changes: 2 additions & 0 deletions
2
resources/project/qaw0eS1zuuY1ar9TdPn1GMfrjbQ/trBOSMFt-ZFz0tI8PrpBhVjGM5Mp.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Info location="CONTRIBUTING.md" type="File"/> |