@@ -16,37 +16,57 @@ jobs:
16
16
MATLABVersion : [R2024a,R2024b]
17
17
runs-on : ubuntu-latest
18
18
steps :
19
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
19
+ # Checks-out your repository
20
20
- uses : actions/checkout@v3
21
21
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
23
31
- name : Setup MATLAB
24
32
uses : matlab-actions/setup-matlab@v2
25
33
with :
26
34
release : ${{ matrix.MATLABVersion }}
35
+ products : Simulink Simscape Simscape_Electrical Simscape_Battery
27
36
28
- # Run SmokeTests
37
+ # Run all the tests
29
38
- name : Run SmokeTests
30
39
uses : matlab-actions/run-command@v2
31
40
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;
39
42
40
43
# Upload the test results as artifact
41
44
- name : Upload TestResults
42
- uses : actions/upload-artifact@v4
45
+ uses : actions/upload-artifact@v3.1.3
43
46
with :
44
47
name : TestResults
45
48
path : ./SoftwareTests/TestResults_${{ matrix.MATLABVersion }}.txt
46
49
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
+
47
67
# Download the test results from artifact
48
68
- name : Download TestResults
49
- uses : actions/download-artifact@v4
69
+ uses : actions/download-artifact@v2.1.1
50
70
with :
51
71
name : TestResults
52
72
path : ./SoftwareTests/
@@ -55,14 +75,16 @@ jobs:
55
75
- name : Run CreateBadge
56
76
uses : matlab-actions/run-command@v1
57
77
with :
58
- command : openProject(pwd); results = runtests(fullfile("SoftwareTests"," CreateBadge.m")) ;
78
+ command : openProject(pwd); CreateBadge;
59
79
60
80
# Commit the JSON for the MATLAB releases badge
61
81
- name : Commit changed files
62
82
continue-on-error : true
63
83
run : |
64
84
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
65
85
git config user.email "<>"
86
+ git pull
87
+ git add Images/TestedWith.json
66
88
git commit Images/TestedWith.json -m "Update CI badges ${{ github.ref_name }}"
67
89
git fetch
68
90
git push
0 commit comments