GNU Octave for continuous integration

Some of the most common corner cases cross-platform developers for Matlab / GNU Octave run into are over filesep and .exe suffixes. Rather than wait for 1 / N frustrated users to report such a bug, one can use GNU Octave with popular Windows continuous integration services such as Travis-CI, AppVeyor or Azure Pipelines. In general, we strongly recommend using Octave ≥ 4.2 as the Matlab compatibility is much better in newer GNU Octave releases.

GNU Octave CI

Here are CI templates using GNU Octave tests of .m code. Note that Octave runtests is quite distinct from Matlab runtests, so we use our own test scripts.

AppVeyor

Make an .appveyor.yml including:

image:
- Visual Studio 2017
- ubuntu1804

build: off

init:
- cmd: choco install octave.portable
- sh: sudo apt-get install -yq --no-install-suggests --no-install-recommends octave > /dev/null

test_script:
- octave-cli test_myfuncs.m

Travis-CI

Make a .travis.yml including:

language: c
group: travis_latest

addons:
  apt:
    packages:
    - octave

matrix:
  include:
  - os: linux
  - os: windows
    language: sh
    before_install:
    - choco install octave.portable
  - os: osx
    before_install:
    - brew install octave > /dev/null

script:
- octave-cli test_myfuncs.m

For advanced users, consider setting up a Docker image to avoid the repeated GNU Octave installs.

Notes

For non-Windows laptops developing for Windows, the typical workaround is to use a Windows virtual machine.