1- name : " MATLAB: test and coverage"
1+ ---
2+ name : ' MATLAB: test and coverage'
23
34# Installs
45# - MATLAB github action
@@ -11,53 +12,59 @@ name: "MATLAB: test and coverage"
1112
1213on :
1314 push :
14- branches : [" master", " main", " dev" ]
15+ branches : [master, main, dev]
1516 pull_request :
16- branches : ["*" ]
17+ branches : ['*' ]
1718
1819jobs :
1920 matlab_tests :
2021
2122 strategy :
2223 matrix :
23- os : [ubuntu-latest] # "macos-latest" or "windows-latest" don't work (yet?)
24- matlab-version : ["R2020a"] # add more versions if needed: "R2021a"
24+ version : [R2021a, R2021b, R2022a, R2022b, R2023a]
25+ os : [ubuntu-latest, macos-latest, windows-latest]
2526 fail-fast : false # Don't cancel all jobs if one fails
2627
2728 runs-on : ${{ matrix.os }}
2829
2930 steps :
30- - name : Install MATLAB ${{ matrix.matlab-version }}
31- uses :
matlab-actions/[email protected] 32- with :
33- release : ${{ matrix.matlab-version }}
34-
35- - uses : actions/checkout@v3
36- with :
37- submodules : true
38- fetch-depth : 1
39-
40- - name : Install Moxunit and MOcov
41- run : |
42- git clone https://github.com/MOxUnit/MOxUnit.git --depth 1
43- git clone https://github.com/MOcov/MOcov.git --depth 1
44-
45- - name : Run tests
46- uses :
matlab-actions/[email protected] 47- with :
48- command :
49- cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows'));
50- run run_tests_ci;
51-
52- - name : Check logs
53- run : |
54- cat test_report.log | grep 0
55- bash <(curl -s https://codecov.io/bash)
56-
57- - name : Code coverage
58- uses : codecov/codecov-action@v3
59- with :
60- file : coverage.xml # optional
61- flags : matlab # optional
62- name : codecov-umbrella # optional
63- fail_ci_if_error : true # optional (default = false)
31+ - name : Install MATLAB
32+ uses :
matlab-actions/[email protected] 33+ with :
34+ release : ${{ matrix.version }}
35+
36+ - uses : actions/checkout@v3
37+ with :
38+ submodules : true
39+ fetch-depth : 1
40+
41+ - name : Install Moxunit and MOcov
42+ run : |
43+ git clone https://github.com/MOxUnit/MOxUnit.git --depth 1
44+ git clone https://github.com/MOcov/MOcov.git --depth 1
45+
46+ - name : Run tests
47+ uses :
matlab-actions/[email protected] 48+ with :
49+ command : cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); run run_tests_ci;
50+
51+ - name : Check logs unix
52+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
53+ run : grep -q 0 test_report.log || { echo "Some tests failed. Check the 'Run tests' step to know which ones." >&2; exit 1; }
54+ - name : Check logs windows
55+ if : matrix.os == 'windows-latest'
56+ run : |
57+ if (-not (Get-Content test_report.log | Select-String -Pattern "0")) {
58+ throw "Some tests failed. Check the 'Run tests' step to know which ones."
59+ }
60+
61+ - name : Code coverage
62+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
63+ # no coverage on windows as long as MOcov does not support it
64+ # see https://github.com/MOcov/MOcov/issues/28
65+ uses : codecov/codecov-action@v3
66+ with :
67+ file : coverage.xml # optional
68+ flags : ${{ matrix.os }}_matlab-${{ matrix.version }}
69+ name : codecov-umbrella # optional
70+ fail_ci_if_error : true # optional (default = false)
0 commit comments