Skip to content

Merge pull request #1 from haoershi/main #3

Merge pull request #1 from haoershi/main

Merge pull request #1 from haoershi/main #3

Workflow file for this run

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'