|
| 1 | +--- |
| 2 | +name: CI matlab |
| 3 | + |
| 4 | +# - Installs |
| 5 | +# - MATLAB github action |
| 6 | +# - MOcov |
| 7 | +# - checks out MOXunit |
| 8 | +# - Runs tests |
| 9 | +# - If tests pass, uploads coverage to codecov |
| 10 | + |
| 11 | +# Controls when the action will run. |
| 12 | +# Triggers the workflow: |
| 13 | +# - on push for the master branch |
| 14 | +# - on pull request for all branches |
| 15 | +on: |
| 16 | + push: |
| 17 | + branches: [master] |
| 18 | + pull_request: |
| 19 | + branches: ['*'] |
| 20 | + workflow_dispatch: |
| 21 | + |
| 22 | +# cancel previous runs on the same branch / PR |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + |
| 29 | + tests: |
| 30 | + |
| 31 | + strategy: |
| 32 | + matrix: |
| 33 | + # Note that some older versions (e.g R2020a, R2020b...) may not be available on all OS |
| 34 | + matlab_version: [R2020b, R2022a, R2023b, R2025a] |
| 35 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 36 | + fail-fast: false # Don't cancel all jobs if one fails |
| 37 | + |
| 38 | + runs-on: ${{ matrix.os }} |
| 39 | + |
| 40 | + steps: |
| 41 | + # use matlab-actions/setup-matlab to setup a specific version of MATLAB |
| 42 | + # https://github.com/matlab-actions/setup-matlab |
| 43 | + - name: Install MATLAB |
| 44 | + uses: matlab-actions/setup-matlab@v2 |
| 45 | + with: |
| 46 | + release: ${{ matrix.matlab_version }} |
| 47 | + - name: Checkout repository |
| 48 | + uses: actions/checkout@v4 |
| 49 | + - name: Install CoSMoMVPA |
| 50 | + uses: matlab-actions/run-command@v2 |
| 51 | + with: |
| 52 | + command: cd('mvpa'); cosmo_set_path(); cd ..; savepath(); exit(0); |
| 53 | + |
| 54 | + - name: Download MOxUnit, MOcov, MOdox |
| 55 | + run: | |
| 56 | + git clone https://github.com/MOxUnit/MOxUnit.git --depth 1 |
| 57 | + git clone https://github.com/MOcov/MOcov.git --depth 1 |
| 58 | + git clone https://github.com/MOdox/MOdox.git --depth 1 |
| 59 | + - name: Install MOxUnit, MOcov, MOdox |
| 60 | + uses: matlab-actions/run-command@v2 |
| 61 | + with: |
| 62 | + command: origin=pwd(); disp(pwd); dir; pp=[origin '/']; cd([pp 'MOxUnit/MOxUnit']); moxunit_set_path(); cd([pp 'MOcov/MOcov']); addpath(pwd); cd([pp 'MOdox/MOdox']); addpath(pwd); savepath(); disp('Path is now'); disp(path); cd(origin); |
| 63 | + |
| 64 | + # use matlab-actions/setup-matlab to run a matlab command |
| 65 | + # https://github.com/matlab-actions/setup-matlab |
| 66 | + - name: Run tests |
| 67 | + uses: matlab-actions/run-command@v2 |
| 68 | + with: |
| 69 | + command: result=cosmo_run_tests('-verbose', '-cover', 'mvpa', '-with_coverage', '-cover_xml_file', 'coverage.xml'); exit(~result); |
| 70 | + |
| 71 | + - name: Code coverage |
| 72 | + uses: codecov/codecov-action@v5 |
| 73 | + with: |
| 74 | + files: coverage.xml |
| 75 | + flags: ${{ matrix.os }}_matlab-${{ matrix.matlab_version }} |
| 76 | + name: codecov-matlab |
| 77 | + fail_ci_if_error: false |
| 78 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments