update unit tests #2
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
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' | |