fix workflow #792
This file contains hidden or 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: Build and Test | |
| on: [push, pull_request] | |
| permissions: | |
| contents: read | |
| jobs: | |
| bat: | |
| name: Build and Test | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Perform npm tasks | |
| run: npm run ci | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: built-action | |
| path: | | |
| **/* | |
| !node_modules/ | |
| integ: | |
| needs: bat | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest, macos-14] | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: built-action | |
| - name: Perform 'setup-matlab' | |
| uses: matlab-actions/setup-matlab@v3 | |
| with: | |
| products: | | |
| MATLAB_Test | |
| Simulink | |
| Simulink_Test | |
| Simulink_Coverage | |
| - name: Run MATLAB Tests with job summary disabled | |
| uses: ./ | |
| with: | |
| source-folder: sample | |
| generate-summary: false | |
| - name: Run MATLAB Tests | |
| uses: ./ | |
| with: | |
| source-folder: sample | |
| startup-options: -logfile output.log | |
| - name: Verify option application | |
| run: | | |
| set -e | |
| grep "Running TheTruth" output.log | |
| grep "Done TheTruth" output.log | |
| grep "Running QuadraticPolynomialTest" output.log | |
| grep "Done QuadraticPolynomialTest" output.log | |
| grep "Running tAssumptionFailure" output.log | |
| grep "Done tAssumptionFailure" output.log | |
| grep "3 Passed" output.log | |
| grep "1 Incomplete" output.log | |
| shell: bash | |
| - name: Generate Model | |
| uses: matlab-actions/run-command@v3 | |
| with: | |
| command: cd('sample'),createSampleModel('temp_model'),sltest.testmanager.createTestsFromModel('sltestfile', 'temp_model'); | |
| - name: Set up diary for logging | |
| run: echo 'diary console.log' >> startup.m | |
| - name: Run run-test command | |
| uses: ./ | |
| with: | |
| test-results-simulink-test: test-results/simulinktest.mldatx | |
| model-coverage-cobertura: test-results/modelcoverage.xml | |
| test-results-pdf: test-results/pdf-results.pdf | |
| test-results-junit: test-results/results.xml | |
| code-coverage-cobertura: test-results/coverage.xml | |
| code-coverage-html: test-results/coverageHTML | |
| model-coverage-html: test-results/modelcoverageHTML | |
| test-results-html: test-results/resultsHTML | |
| select-by-folder: sample | |
| strict: true | |
| use-parallel: true | |
| output-detail: Detailed | |
| logging-level: Detailed | |
| - name: Verify artifacts generation | |
| run: | | |
| (test -f test-results/simulinktest.mldatx) || (echo "File simulinktest.mldatx does not exist" && exit 1) | |
| (test -f test-results/modelcoverage.xml) || (echo "File modelcoverage.xml does not exist" && exit 1) | |
| (test -f test-results/pdf-results.pdf) || (echo "File pdf-results.pdf does not exist" && exit 1) | |
| (test -f test-results/results.xml) || (echo "File results.xml does not exist" && exit 1) | |
| (test -f test-results/coverage.xml) || (echo "File coverage.xml does not exist" && exit 1) | |
| (test -d test-results/coverageHTML) || (echo "Directory coverageHTML does not exist" && exit 1) | |
| (test -f test-results/coverageHTML/*.html) || (echo "No HTML file found" && exit 1) | |
| (test -d test-results/modelcoverageHTML) || (echo "Directory modelcoverageHTML does not exist" && exit 1) | |
| (test -f test-results/modelcoverageHTML/*.html) || (echo "No HTML file found" && exit 1) | |
| (test -d test-results/resultsHTML) || (echo "Directory resultsHTML does not exist" && exit 1) | |
| (test -f test-results/resultsHTML/*.html) || (echo "No HTML file found" && exit 1) | |
| grep -q "runner.addPlugin(FailOnWarningsPlugin())" console.log | |
| grep -q "runInParallel" console.log | |
| grep -q "'OutputDetail', 3" console.log | |
| grep -q "'LoggingLevel', 3" console.log | |
| shell: bash | |
| - name: Verify workflow command is added | |
| run: | | |
| grep "::group::TheTruth" output.log | |
| shell: bash | |
| run-tests-for-coverage-summary: | |
| name: Test coverage summary view | |
| needs: bat | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: built-action | |
| - name: Perform 'setup-matlab' without MATLAB Test | |
| uses: matlab-actions/setup-matlab@v3 | |
| - name: Run MATLAB Tests without MATLAB Test # Test Case 1: Without MATLAB Test, statement coverage view is shown | |
| uses: ./ | |
| with: | |
| source-folder: sample | |
| - name: Perform 'setup-matlab' with MATLAB Test | |
| uses: matlab-actions/setup-matlab@v3 | |
| with: | |
| products: | | |
| MATLAB_Test | |
| - name: Run MATLAB Tests with other options # Test Case 2: With MATLAB Test, and other code-coverage report options, no view is shown. | |
| uses: ./ | |
| with: | |
| model-coverage-cobertura: test-results/modelcoverage.xml | |
| test-results-pdf: test-results/pdf-results.pdf | |
| test-results-junit: test-results/results.xml | |
| code-coverage-cobertura: test-results/coverage.xml | |
| code-coverage-html: test-results/coverageHTML | |
| code-coverage-metrics: mcdc | |
| model-coverage-html: test-results/modelcoverageHTML | |
| test-results-html: test-results/resultsHTML | |
| select-by-folder: sample | |
| strict: true | |
| use-parallel: true | |
| output-detail: Detailed | |
| logging-level: Detailed | |
| - name: Run MATLAB Tests # Test Case 3: With MATLAB Test and code-coverage-metrics option (w/o coverage report options), view is shown. | |
| uses: ./ | |
| with: | |
| source-folder: sample | |
| code-coverage-metrics: decision | |
| - name: Run MATLAB Tests with default metrics # Test Case 4: With MATLAB Test, and no code-coverage-metrics option ('auto' default), mcdc view is shown. | |
| uses: ./ | |
| with: | |
| source-folder: sample | |
| - name: Run MATLAB Tests with empty metrics # Test Case 5: With MATLAB Test, and empty code-coverage-metrics option, no view is shown. | |
| uses: ./ | |
| with: | |
| source-folder: sample | |
| code-coverage-metrics: "" |