|
1 | | -name: MATLAB Build |
| 1 | +name: Module Test |
2 | 2 |
|
3 | 3 | # Controls when the action will run. |
4 | 4 | on: |
5 | 5 | push: |
6 | 6 | branches: [ release ] |
7 | 7 | pull_request: |
8 | 8 | branches: [ release ] |
9 | | - workflow_dispatch: |
10 | 9 |
|
11 | 10 | jobs: |
12 | | - test: |
| 11 | + RunTests: |
13 | 12 | strategy: |
14 | | - max-parallel: 1 |
15 | 13 | fail-fast: false |
16 | 14 | matrix: |
17 | | - MATLABVersion: [R2023a,R2023b] |
| 15 | + MATLABVersion: [R2024a] |
18 | 16 | runs-on: ubuntu-latest |
19 | 17 | steps: |
20 | | - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 18 | + # Checks-out your repository |
21 | 19 | - uses: actions/checkout@v3 |
22 | 20 |
|
23 | | - # Sets up MATLAB on the GitHub Actions runner |
| 21 | + # Sets up MATLAB |
24 | 22 | - name: Setup MATLAB |
25 | 23 | uses: matlab-actions/setup-matlab@v1 |
26 | 24 | with: |
27 | 25 | release: ${{ matrix.MATLABVersion }} |
28 | 26 |
|
29 | | - # Run SmokeTests |
| 27 | + # Run all the tests |
30 | 28 | - name: Run SmokeTests |
31 | 29 | uses: matlab-actions/run-command@v1 |
32 | 30 | with: |
33 | | - command: openProject(pwd); results = runtests(fullfile("SoftwareTests","SmokeTests.m")); assertSuccess(results); |
34 | | - |
35 | | - # Run FunctionTests |
36 | | - - name: Run FunctionTests |
37 | | - uses: matlab-actions/run-command@v1 |
38 | | - with: |
39 | | - command: openProject(pwd); results = runtests(fullfile("SoftwareTests","FunctionTests.m")); assertSuccess(results); |
| 31 | + command: openProject(pwd); RunAllTests; |
40 | 32 |
|
41 | 33 | # Upload the test results as artifact |
42 | 34 | - name: Upload TestResults |
| 35 | + if: always() |
43 | 36 | uses: actions/upload-artifact@v3.1.3 |
44 | 37 | with: |
45 | 38 | name: TestResults |
46 | 39 | path: ./SoftwareTests/TestResults_${{ matrix.MATLABVersion }}.txt |
47 | 40 |
|
| 41 | + |
| 42 | + CreateBadge: |
| 43 | + if: ${{ always() }} |
| 44 | + needs: [RunTests] |
| 45 | + strategy: |
| 46 | + fail-fast: false |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + |
| 50 | + # Checks-out your repository |
| 51 | + - uses: actions/checkout@v3 |
| 52 | + |
| 53 | + # Sets up R2023b |
| 54 | + - name: Setup MATLAB |
| 55 | + uses: matlab-actions/setup-matlab@v1 |
| 56 | + with: |
| 57 | + release: R2023b |
| 58 | + |
48 | 59 | # Download the test results from artifact |
49 | 60 | - name: Download TestResults |
50 | 61 | uses: actions/download-artifact@v2.1.1 |
|
56 | 67 | - name: Run CreateBadge |
57 | 68 | uses: matlab-actions/run-command@v1 |
58 | 69 | with: |
59 | | - command: openProject(pwd); results = runtests(fullfile("SoftwareTests","CreateBadge.m")); |
| 70 | + command: openProject(pwd); CreateBadge; |
60 | 71 |
|
61 | 72 | # Commit the JSON for the MATLAB releases badge |
62 | 73 | - name: Commit changed files |
|
67 | 78 | git pull |
68 | 79 | git add Images/TestedWith.json |
69 | 80 | git commit Images/TestedWith.json -m "Update CI badges ${{ github.ref_name }}" |
| 81 | + git fetch |
70 | 82 | git push |
0 commit comments