@@ -16,37 +16,57 @@ jobs:
1616 MATLABVersion : [R2024a,R2024b]
1717 runs-on : ubuntu-latest
1818 steps :
19- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
19+ # Checks-out your repository
2020 - uses : actions/checkout@v3
2121
22- # Sets up MATLAB on the GitHub Actions runner
22+ # Sets up a display server
23+ - name : Start display server
24+ if : ${{ always() }}
25+ run : |
26+ sudo apt-get install xvfb
27+ Xvfb :99 &
28+ echo "DISPLAY=:99" >> $GITHUB_ENV
29+
30+ # Sets up MATLAB
2331 - name : Setup MATLAB
2432 uses : matlab-actions/setup-matlab@v2
2533 with :
2634 release : ${{ matrix.MATLABVersion }}
35+ products : Simulink Simscape Simscape_Electrical Simscape_Battery
2736
28- # Run SmokeTests
37+ # Run all the tests
2938 - name : Run SmokeTests
3039 uses : matlab-actions/run-command@v2
3140 with :
32- command : openProject(pwd); results = runtests(fullfile("SoftwareTests","SmokeTests.m")); assertSuccess(results);
33-
34- # Run FunctionTests
35- - name : Run FunctionTests
36- uses : matlab-actions/run-command@v2
37- with :
38- command : openProject(pwd); results = runtests(fullfile("SoftwareTests","FunctionTests.m")); assertSuccess(results);
41+ command : openProject(pwd); RunAllTests;
3942
4043 # Upload the test results as artifact
4144 - name : Upload TestResults
42- uses : actions/upload-artifact@v4
45+ uses : actions/upload-artifact@v3.1.3
4346 with :
4447 name : TestResults
4548 path : ./SoftwareTests/TestResults_${{ matrix.MATLABVersion }}.txt
4649
50+ badge :
51+ if : ${{ always() }}
52+ needs : [test]
53+ strategy :
54+ fail-fast : false
55+ runs-on : ubuntu-latest
56+ steps :
57+
58+ # Checks-out your repository
59+ - uses : actions/checkout@v3
60+
61+ # Sets up R2024b
62+ - name : Setup MATLAB
63+ uses : matlab-actions/setup-matlab@v1
64+ with :
65+ release : R2024b
66+
4767 # Download the test results from artifact
4868 - name : Download TestResults
49- uses : actions/download-artifact@v4
69+ uses : actions/download-artifact@v2.1.1
5070 with :
5171 name : TestResults
5272 path : ./SoftwareTests/
@@ -55,14 +75,16 @@ jobs:
5575 - name : Run CreateBadge
5676 uses : matlab-actions/run-command@v1
5777 with :
58- command : openProject(pwd); results = runtests(fullfile("SoftwareTests"," CreateBadge.m")) ;
78+ command : openProject(pwd); CreateBadge;
5979
6080 # Commit the JSON for the MATLAB releases badge
6181 - name : Commit changed files
6282 continue-on-error : true
6383 run : |
6484 git config user.name "${{ github.workflow }} by ${{ github.actor }}"
6585 git config user.email "<>"
86+ git pull
87+ git add Images/TestedWith.json
6688 git commit Images/TestedWith.json -m "Update CI badges ${{ github.ref_name }}"
6789 git fetch
6890 git push
0 commit comments