-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (37 loc) · 1.4 KB
/
matlab.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: MATLAB Unit Tests
on:
push:
branches: [ "main" ]
paths:
- 'matlab/**'
pull_request:
branches: [ "main" ]
paths:
- 'matlab/**'
workflow_dispatch:
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
with:
matlab-version: R2021b # Adjust to your MATLAB version
- name: Run MATLAB Unit Tests
env:
IEEG_USERNAME: ${{ secrets.IEEG_USERNAME }}
IEEG_PASSWORD: ${{ secrets.IEEG_PASSWORD }}
run: |
matlab -batch "import matlab.unittest.TestRunner; import matlab.unittest.TestSuite; import matlab.unittest.plugins.XMLPlugin; suite = testsuite('matlab/test','IncludeSubfolders',true); runner = TestRunner.withNoPlugins; xmlFile = 'matlab/test-results.xml'; p = XMLPlugin.producingJUnitFormat(xmlFile); runner.addPlugin(p); result = runner.run(suite); if any([result.Failed]) exit(1); end"
- name: Upload Test Results
uses: actions/upload-artifact@v2
with:
name: test-results
path: matlab/test-results.xml
- name: Display Test Results
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
report_paths: 'matlab/test-results.xml'