Skip to content

Commit

Permalink
Merge pull request #7 from mathworks/dev_ci
Browse files Browse the repository at this point in the history
Add CI workflow
  • Loading branch information
pablorcum authored Feb 8, 2022
2 parents 4b38861 + 7dbfb87 commit 12d8a96
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
47 changes: 47 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Setup MATLAB
# You may pin to the exact commit or the version.
# uses: matlab-actions/setup-matlab@bfca1c30aa37e57792ad04e5c68bf4ff33218b6d
uses: matlab-actions/[email protected]

- name: Run MATLAB Command
# You may pin to the exact commit or the version.
# uses: matlab-actions/run-command@3a7e877e5c019883a1f5fe4635c84d74394bb70e
uses: matlab-actions/[email protected]
with:
# Script, function, or statement to execute
command: openProject(pwd); runTestsuite('github');

- name: Test Reporter
uses: dorny/[email protected]
with:
name: Check MATLAB test results from JUnit report
path: work/results.xml
reporter: java-junit
fail-on-error: false
Binary file modified lib/mbdriLib.slx
Binary file not shown.
Binary file not shown.
Binary file modified tests/B2B_tests/AutopilotControlSystem_test1.mldatx
Binary file not shown.
Binary file modified tests/regression_tests/regression_tests.mldatx
Binary file not shown.
15 changes: 13 additions & 2 deletions tests/runTestsuite.m
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
function runTestsuite
function runTestsuite(tags)

arguments
tags {mustBeText} = '';
end

import matlab.unittest.TestRunner;
import matlab.unittest.TestSuite;
import matlab.unittest.Verbosity;
import matlab.unittest.plugins.XMLPlugin;
import matlab.unittest.plugins.TestReportPlugin;
import matlab.unittest.selectors.HasTag;

projObj = currentProject;

suite = TestSuite.fromProject(projObj);
if ~isempty(tags)
suite = suite.selectIf(HasTag(tags));
end

runner = TestRunner.withTextOutput('OutputDetail', Verbosity.Detailed);
runner.addPlugin(XMLPlugin.producingJUnitFormat('results.xml'));
Expand All @@ -17,6 +25,9 @@

results = runner.run(suite);

disp(results.assertSuccess);
if ~ismember('github',tags)
% GitHub actions evaluate test success from Test Report
disp(results.assertSuccess);
end

end

0 comments on commit 12d8a96

Please sign in to comment.