|
| 1 | +name: Widgets Toolbox Continuous Integration |
| 2 | + |
| 3 | +# Controls when the workflow will run. |
| 4 | +on: |
| 5 | + # Triggers the workflow on push or pull request events, but only for the master branch. |
| 6 | + push: |
| 7 | + branches: [master] |
| 8 | + pull_request: |
| 9 | + branches: [master] |
| 10 | + |
| 11 | + # This allows the workflow run to be run manually from the Actions tab in GitHub. |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel. |
| 15 | +jobs: |
| 16 | + # Run the Toolbox tests. |
| 17 | + run-tests: |
| 18 | + # Define the job strategy. |
| 19 | + strategy: |
| 20 | + # Set up the job strategy matrix to define the different job configurations. |
| 21 | + matrix: |
| 22 | + # List of platforms on which to run the tests. |
| 23 | + platform: [ubuntu-latest, windows-latest] |
| 24 | + |
| 25 | + # List of MATLAB releases over which to run the tests. |
| 26 | + matlab-version: [R2023b, R2024a, R2024b] |
| 27 | + |
| 28 | + # We don't define any startup options until we reach R2023b (handled separately below). |
| 29 | + # matlab-startup-options: [ '' ] |
| 30 | + |
| 31 | + # Windows/Mac are supported from R2021a onwards. Ubuntu is supported from R2020b onwards. |
| 32 | + # Exclude the Windows job on R2020b. |
| 33 | + |
| 34 | + # Specify the platform that the job will run on. |
| 35 | + runs-on: ${{ matrix.platform }} |
| 36 | + |
| 37 | + # Don't fail the entire run if one job fails. |
| 38 | + continue-on-error: true |
| 39 | + |
| 40 | + # Steps define a sequence of tasks to be executed as part of the job. |
| 41 | + steps: |
| 42 | + # Check out the repository under $GITHUB_WORKSPACE, so that the job can access it. |
| 43 | + - name: Check out the repository |
| 44 | + uses: actions/checkout@v4 |
| 45 | + |
| 46 | + # For Linux jobs, start a display server on the runner. |
| 47 | + - name: Start a display server for jobs running on Linux. |
| 48 | + if: ${{ matrix.platform == 'ubuntu-latest' }} |
| 49 | + run: | |
| 50 | + sudo apt-get install -y xvfb |
| 51 | + Xvfb :99 & |
| 52 | + echo "DISPLAY=:99" >> $GITHUB_ENV |
| 53 | +
|
| 54 | + # Set up MATLAB on the runner. |
| 55 | + - name: Set up MATLAB on the runner. |
| 56 | + uses: matlab-actions/setup-matlab@v2 |
| 57 | + with: |
| 58 | + # The tests require only base MATLAB. |
| 59 | + products: MATLAB |
| 60 | + release: ${{ matrix.matlab-version }} |
| 61 | + |
| 62 | + # Run the Toolbox tests. |
| 63 | + - name: Run the Toolbox tests. |
| 64 | + uses: matlab-actions/run-command@v2 |
| 65 | + with: |
| 66 | + startup-options: ${{ matrix.matlab-startup-options }} |
| 67 | + command: openProject("WidgetsToolbox.prj"); [~,results] = runTestSuite(); failedTests = table(results([results.Failed])); disp(failedTests); results.assertSuccess(); |
0 commit comments