Hi.
I'm Rebecca, a technical writer at MathWorks.
In this video, I will show you how to easily automate
workflows using GitHub actions and MATLAB scripts
to compare simulated models, save results
into printable reports, and attaching them to pull
requests or push events.
When you change text-based files,
GitHub can easily show you a side-by-side comparison.
This is definitely not the case when
you change Simulink models.
So how can the reviewer approve the changes
to these model files?
First, download the files I am using in this video
from the link in the description box below.
Add the M-Files to your GitHub repository.
These scripts will be shortly used
by the workflow you will set up.
Next, create a new workflow and customize it by editing
the YAML file.
Here, you can simply copy the content from the YAML
file you just downloaded.
This particular workflow will be triggered
every time you receive a pull request for the main branch.
This workflow uses a self-hosted runner to execute code.
Using self-hosted runners enables
you to keep your repository private.
It also makes use of any specific configuration
or hardware you have on your machine.
For every pull request to the main branch,
the workflow checks out the repository,
then executes MATLAB scripts.
These scripts use a combination of Git and MATLAB
commands to enable you to find the list of modified
models since your branch diverged from main.
After retrieving the appropriate model revisions,
the scripts compare the models and save the results,
and attach them to your requests.
The workflow finishes by qualifying your change
by running all the tests in your project.
To try the workflow in action, in MATLAB, clone the project
you are collaborating on.
On a new branch, develop your feature.
When it's ready, push the branch to the remote repository.
To merge your branch into main and make
the feature available to your peers, create a pull request
and add information you want to share with your reviewers.
Your pull request triggers the workflow you just set up.
You can follow the progress of the job.
When the job is successful, your reviewers
can access the comparison reports
in the Artifacts section.
To do the same for a simple push event to the main branch,
use the other scripts provided in the link below.
You can now customize continuous integration workflows
to support model comparison review in the repositories
hosted on GitHub.
Download the scripts and try the workflow yourself.
Visit the model comparison documentation to learn more.