Matlab CI services include Travis-CI. It’s important to note that Travis-CI and Circle-CI have a rather finite build quota (even for open source projects) that you might use up quickly. GitHub Actions Matlab CI is often a better choice for open source Matlab projects.
Matlab on Travis-CI
is useful to automatically unit test Matlab code on each
git push as with other coding languages.
As typical for CI, we use a “.travis.yml” file in the Git repo to control Travis-CI behavior.
language: matlab matlab: - latest script: - matlab -batch "r = runtests('IncludeSubfolders',true); assert(~isempty(r)); assertSuccess(r)"
Matlab CI with compiled program
Using Matlab with code from compiled languages takes a few extra parameters. Use a modern Ubuntu version compatible with the Matlab version to get more modern library versions when we use compiled code with the Matlab tests.
dist: bionic # Matlab R2020a libstdc++ needs Ubuntu 18.04 language: matlab matlab: - latest git: - depth: 3 - quiet: true addons: apt: packages: - gfortran - libhdf5-dev snaps: - name: cmake confinement: classic before_script: - export PATH=/snap/bin:$PATH script: - matlab -batch "r = runtests('IncludeSubfolders',true); assert(~isempty(r)); assertSuccess(r)"
Here we assumed the compiled project code for Matlab uses CMake, Fortran and HDF5.