Run MATLAB Build on GitHub-Hosted Runner #62
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: Run MATLAB Build on GitHub-Hosted Runner | |
| on: | |
| workflow_dispatch | |
| env: | |
| MLM_LICENSE_TOKEN: ${{ secrets.LICTOKEN }} | |
| # SonarQube connection details | |
| SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| jobs: | |
| check_test: | |
| name: Run MATLAB Build & Test | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| release: [latest-including-prerelease] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Install MATLAB | |
| uses: matlab-actions/setup-matlab@v2 | |
| with: | |
| products: MATLAB_Compiler | |
| cache: true | |
| release: ${{ matrix.release }} | |
| # - name: Run build to check code and run unit tests | |
| # uses: matlab-actions/run-build@v2 | |
| # with: | |
| # tasks: check test | |
| - name: Run MATLAB Tests and Generate Coverage | |
| uses: matlab-actions/run-tests@v2 | |
| with: | |
| source-folder: source | |
| # Output location for JUnit-style test results | |
| test-results-junit: test-results/results.xml | |
| # Output location for Cobertura coverage report | |
| code-coverage-cobertura: code-coverage/coverage.xml | |
| - name: Upload Test Results Artifact | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: matlab-test-results | |
| path: test-results/results.xml | |
| - name: Upload Coverage Artifact | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: matlab-coverage-report | |
| path: code-coverage/coverage.xml | |
| - name: Download SonarScanner CLI | |
| run: | | |
| # Download and unzip SonarScanner CLI (example for Linux runner) | |
| wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip -O sonar-scanner.zip | |
| unzip sonar-scanner.zip | |
| mv sonar-scanner-4.8.0.2856-linux sonar-scanner | |
| echo "$(pwd)/sonar-scanner/bin" >> $GITHUB_PATH | |
| - name: Run SonarScanner CLI to upload coverage | |
| run: | | |
| sonar-scanner \ | |
| -Dsonar.projectKey=mw-jsgeorge-TimesTableApp \ | |
| -Dsonar.sources=source \ | |
| -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \ | |
| -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ | |
| -Dsonar.coverage.cobertura.reportPaths=code-coverage/coverage.xml | |
| # deploy: | |
| # # This job executes only after a successful completion of 'mex-and-unittests' job | |
| # needs: check_test | |
| # name: Generate Deploy Artifacts | |
| # strategy: | |
| # matrix: | |
| # os: [ubuntu-latest, windows-latest] | |
| # runs-on: ${{ matrix.os }} | |
| # steps: | |
| # - name: Check out repository | |
| # uses: actions/checkout@v4 | |
| # - name: Install MATLAB | |
| # uses: matlab-actions/setup-matlab@v2 | |
| # with: | |
| # products: MATLAB_Compiler | |
| # release: R2024a | |
| # - name: Run build | |
| # uses: matlab-actions/run-build@v2 | |
| # with: | |
| # tasks: pcode deploy | |
| # - name: Upload artifact | |
| # uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: app-${{ matrix.os }} | |
| # path: ./*standalone*/*timestable* | |