Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Continuous Integration #57

Open
mwakok opened this issue Feb 18, 2021 · 2 comments
Open

Enable Continuous Integration #57

mwakok opened this issue Feb 18, 2021 · 2 comments

Comments

@mwakok
Copy link
Contributor

mwakok commented Feb 18, 2021

Continous integration allows for the automatic testing and building of our scripts and application when we push new code to the GitHub repository and/or generate pull requests.

Resources:

  • General Matlab pipeline. Matlab offers support for the following CI platforms: Azure DevOps, CircleCI, Jenkins.

  • Travis CI and Matlab
    Travis is also an option. However, Travis has recently decided to change their free plans. It will not support open source code unconditionally, but uses some system of credits.

@mwakok
Copy link
Contributor Author

mwakok commented Feb 18, 2021

WIP: I have implemented a simple CI pipeline using Travis (branch maurits/add_testing) following these steps:

  • Create Travis account via GitHub Login. Provide access to the repository during setup.
  • Add travis configuration file to the repository. I have adapted the provided documentation and created a .travis.yml in the repository with the content:
language: matlab
matlab:
  - R2020b
script: matlab -batch "addpath(genpath(pwd)); results = runtests('IncludeSubfolders',true); assertSuccess(results);"

With this script, Travis will deploy a Linux server and install Matlab (version R2020b). It will then find all test in the repository and execute the command "runtests". A test is a Matlab file that begins or ends with the string "test". As a naming convention (similar to what is practiced for Python), I have created test names composed of the script being tested, prefixed with the string"test_". For example, a script called load_data.m is tested by test_load_data.m.

  • Add a build badge to the README that shows whether the tests have passed (see here)

@mwakok
Copy link
Contributor Author

mwakok commented Feb 18, 2021

GitHub actions now support CI for Matlab (since Jan 2021)! Although the workflows are not yet available in the GitHub market, examples to run tests and generate coverage reports are provided.

This would circumvent the issue with Travis not supplying unlimited builds for open source projects. I will test this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant