ci/increase-coverage into main #24
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: MATLAB CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| jobs: | |
| test: | |
| name: Run MATLAB Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Start virtual display server | |
| run: | | |
| sudo apt-get install -y xvfb | |
| Xvfb :99 & | |
| echo "DISPLAY=:99" >> $GITHUB_ENV | |
| - name: Set up MATLAB | |
| uses: matlab-actions/setup-matlab@v2 | |
| - name: Run tests | |
| uses: matlab-actions/run-command@v2 | |
| with: | |
| command: | | |
| openProject("uihtml-debugger.prj"); | |
| runTests; | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: always() | |
| with: | |
| files: code-coverage/coverage.xml | |
| fail_ci_if_error: false | |
| package: | |
| name: Package and Release | |
| needs: test | |
| if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up MATLAB | |
| uses: matlab-actions/setup-matlab@v2 | |
| - name: Package Toolbox | |
| uses: matlab-actions/run-command@v2 | |
| with: | |
| command: | | |
| prjFile = 'uihtml-debugger.prj'; | |
| tag = getenv('GITHUB_REF_NAME'); | |
| if startsWith(tag, 'v') | |
| version = tag(2:end); | |
| fprintf('Updating toolbox version to %s\n', version); | |
| matlab.addons.toolbox.toolboxVersion(prjFile, version); | |
| end | |
| matlab.addons.toolbox.packageToolbox(prjFile, 'uihtml-debugger.mltbx'); | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| files: uihtml-debugger.mltbx | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Artifact (on main) | |
| uses: actions/upload-artifact@v4 | |
| if: github.ref == 'refs/heads/main' | |
| with: | |
| name: uihtml-debugger-mltbx | |
| path: uihtml-debugger.mltbx |