Skip to content

Commit 5caffa3

Browse files
committed
Merge commit '17d2d09d4db6ba93a98445e72b8b618ba82ae63a'
2 parents e2eba1b + 17d2d09 commit 5caffa3

File tree

9 files changed

+83
-10
lines changed

9 files changed

+83
-10
lines changed

.github/workflows/main.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CI
2+
3+
# Controls when the workflow will run
4+
on:
5+
# Triggers the workflow on push or pull request events but only for the "master" branch
6+
push:
7+
branches: [ "master" ]
8+
pull_request:
9+
branches: [ "master" ]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
check:
17+
runs-on: ubuntu-latest
18+
# Steps represent a sequence of tasks that will be executed as part of the job
19+
steps:
20+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
21+
- name: Check out repo
22+
uses: actions/checkout@v3
23+
24+
- name: Set up MATLAB
25+
uses: matlab-actions/setup-matlab@v1
26+
27+
- name: Run commands
28+
uses: matlab-actions/run-command@v1
29+
with:
30+
command: openProject(pwd); checkTask;
31+
32+
- name: Archive check results
33+
uses: actions/upload-artifact@v3
34+
if: always()
35+
with:
36+
name: code-issues
37+
path: checkResults.json
38+
39+
test:
40+
runs-on: ubuntu-latest
41+
# Steps represent a sequence of tasks that will be executed as part of the job
42+
steps:
43+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
44+
- name: Check out repo
45+
uses: actions/checkout@v3
46+
47+
- name: Set up MATLAB
48+
uses: matlab-actions/setup-matlab@v1
49+
50+
- name: Run commands
51+
uses: matlab-actions/run-command@v1
52+
with:
53+
command: openProject(pwd); testTask("github");
54+
55+
- name: Publish Test Results
56+
uses: EnricoMi/publish-unit-test-result-action@v2
57+
if: always()
58+
with:
59+
files: |
60+
results.xml

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# bossdevice-api-matlab
2+
[![CI](https://github.com/sync2brain/bossdevice-api-matlab/actions/workflows/main.yml/badge.svg)](https://github.com/sync2brain/bossdevice-api-matlab/actions/workflows/main.yml) [![GitHub issues by-label](https://img.shields.io/github/issues-raw/sync2brain/bossdevice-api-matlab/bug)](https://github.com/sync2brain/bossdevice-api-matlab/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
3+
24
sync2brain's bossdevice RESEARCH Application Programmable Interface (API) for MATLAB
35

46
## Requirements

buildUtilities/buildfile.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
% Create the "test" task and add it to the plan
1414
plan("test") = Task( ...
1515
Description = "Run unit tests", ...
16-
Actions = @(~) testTask);
16+
Actions = @(~,tags) testTask(tags));
1717

1818
% Make the "release" task dependent on the "check" and "test" tasks
1919
plan("package") = Task( ...

buildUtilities/checkTask.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44

55
% Identify code issues
66
issues = codeIssues(projObj.RootFolder);
7+
8+
% Encode results in JSON file and export
9+
if batchStartupOptionUsed
10+
jsonIssues = jsonencode(issues);
11+
fid = fopen('checkResults.json','w');
12+
fprintf(fid,'%s',jsonIssues);
13+
fclose(fid);
14+
end
15+
16+
% Assert code results
717
assert(isempty(issues.Issues),...
818
formattedDisplayText(issues.Issues(:,["Location" "Severity" "Description"])));
19+
920
end

buildUtilities/testTask.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,18 @@
2020
disp('No tag was passed as input. All test cases will be executed.');
2121
end
2222

23+
if isempty(suite)
24+
warning('No tests were found with tag(s) "%s" and none will be executed.',strjoin(tags,', '));
25+
end
26+
2327
runner = TestRunner.withTextOutput('OutputDetail', Verbosity.Detailed);
2428
runner.addPlugin(XMLPlugin.producingJUnitFormat(fullfile(projObj.RootFolder,'results.xml')));
2529

2630
results = runner.run(suite);
2731

28-
if ~ismember('github',tags)
29-
% GitHub actions evaluate test success from Test Report
32+
% CI workflows evaluate test success from Test Report
33+
if ~batchStartupOptionUsed
3034
results.assertSuccess;
3135
end
3236

33-
end
37+
end

images/toolboxPackaging.jpg

-13.2 KB
Binary file not shown.

resources/project/bI45o7MkfNtHtgUIaFhhf2MCGfY/YudP_WtanNu7H6EDRSg84Ds4IeMd.xml

Lines changed: 0 additions & 2 deletions
This file was deleted.

resources/project/bI45o7MkfNtHtgUIaFhhf2MCGfY/YudP_WtanNu7H6EDRSg84Ds4IeMp.xml

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/smokeTests.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
% Setup for each test
99
end
1010

11-
methods (Test, TestTags = {'github'})
11+
methods (Test)
1212
% Test methods
1313

1414
function noFirmware(testCase)
@@ -24,4 +24,4 @@ function noBossdevice(testCase)
2424
end
2525
end
2626

27-
end
27+
end

0 commit comments

Comments
 (0)