GNU Octave for continuous integration

Matlab CI is often a better choice than Octave below.


Cross-platform developers run into numerous compatibility issues. Rather than wait for frustrated users to report such a bug, use continuous integration. In general, we strongly recommend using Octave ≥ 4.2 as the Matlab compatibility is much better in newer GNU Octave releases.

Here are CI templates using GNU Octave tests of .m code. Octave runtests() is incompatible with the advanced functionality of Matlab runtests(), so we use our own test scripts. Octave 6.x moved the Matlab-incompatible runtests() to Octave oruntests() to avoid confusion.

GitHub Actions: “.github/workflows/ci.yml”:

name: ci

on:
  push:
    paths:
    - "**.m"
    - ".github/workflows/ci.yml"

jobs:

  linux:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout
    - run: |
        sudo apt -yq update
        sudo apt install -yq --no-install-recommends octave        
    - run: octave --eval "test_myfuncs"
      working-directory: tests

  windows:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout
    - run: choco install octave.portable
    - run: octave --eval "test_myfuncs"
      working-directory: tests

AppVeyor: .appveyor.yml:

image:
- Visual Studio
- ubuntu

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

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