Integrate Process into GitHub
This example shows how to integrate your process into GitHub® by using pipeline generator version 1. Pipeline generator version 2 is recommended for enhanced file propagation and artifact management capabilities. The setup and requirements for pipeline generator version 2 are shown in Process Integration and Artifact Management for GitHub.
Pipeline Generator Version 1
In this example, you connect a project to GitHub and generate a GitHub Actions workflow file for the project and its process model by using version 1 of the pipeline generator. You specify the pipeline generator options to create pipelines that separate tasks into different jobs and use other custom pipeline behaviors.
Set Up GitHub Project and Runner
To set up the CI system, you must set up a source-controlled remote repository where you store your project and a build agent that can run your pipeline on that repository. For this example, you can use GitHub as both your remote repository and CI system, and then create a self-hosted GitHub runner to run your pipelines.
In GitHub, create a private GitHub repository. For information, see Quickstart for repositories in the GitHub documentation. Make sure GitHub Actions is enabled for your repository.
Create a self-hosted runner. See the GitHub documentation for Adding self-hosted runners.
Install MATLAB®, Simulink®, Simulink Check™, the CI Support Package for Simulink, and any other products that your process requires on the machine that your GitHub runner is running on. Make sure that your GitHub runner machine can access and run MATLAB before you continue.
For information on licensing considerations, Docker® containers, and virtual displays, see Tips for Setting Up CI Agents.
Connect MATLAB Project to GitHub
You must connect your MATLAB project to your remote repository so that you can push your changes to the remote GitHub repository and allow GitHub to automate a CI pipeline for the project.
Open a project in MATLAB. For this example, open an example project that uses the process defined by an example process model.
processAdvisorExampleStart
The process model,
processmodel.m
, is at the root of the project and defines a process with common model-based design tasks. You can use the Process Advisor app to run the tasks in the process on your local machine. For information on how to create and customize a process model for your development and verification workflow, see Customize Your Process Model.Connect your project, remote repository, and CI platform by adding the remote URL to your local repository. For more information, see Share Git Repository to Remote. Typically, a remote URL has the format,
https://github.com/user/repo.git
.
Generate Pipeline Configuration File
You generate the GitHub Actions workflow file by using the pipeline generator.
In MATLAB, configure the pipeline generation options by creating a
padv.pipeline.GitHubOptions
object and specifying the location of your MATLAB installation for your runner.The
padv.pipeline.GitHubOptions
object stores the options for the pipeline generator. You can modify the other properties of the object to customize how the pipeline generator creates your pipeline configuration file. For example, you can create apadv.pipeline.GitHubOptions
object for a GitHub runner that uses a MATLAB installation at/opt/matlab/r2025a
.GitHubOptions = padv.pipeline.GitHubOptions GitHubOptions.MatlabInstallationLocation = "/opt/matlab/r2025a";
By default,
GitHubOptions
specifies aSingleStage
pipeline architecture that runs all the tasks in the process within a single stage in CI. To change the number of stages or the grouping of tasks in the CI pipeline, specify thePipelineArchitecture
property of yourpadv.pipeline.GitHubOptions
object.Generate a pipeline configuration file for your project by calling the
padv.pipeline.generatePipeline
function on yourpadv.pipeline.GitHubOptions
object.padv.pipeline.generatePipeline(GitHubOptions)
By default, the generated pipeline configuration file is named
simulink_pipeline.yml
and is located under the project root, in the subfolder derived > pipeline.The generated pipeline configuration file uses the following GitHub Actions:
checkout@v4
cache@v4
upload-artifact@v4
download-artifact@v4
Use Pipeline Configuration File in GitHub Actions Workflow
To use the generated pipeline configuration file in your GitHub repository, you must create a workflow and update the workflow file.
In GitHub, create a GitHub Actions workflow by creating a directory
.github/workflows
and creating a new YAML filegithub-actions-demo.yml
. See https://docs.github.com/en/actions/quickstart#creating-your-first-workflow.In MATLAB, open your generated pipeline configuration file and copy the file contents.
In GitHub, paste the contents of
simulink_pipeline.yml
inside thegithub-actions-demo.yml
file.Check the new
github-actions-demo.yml
file into your repository by committing the changes and creating a pull request.
After you commit your changes, GitHub automatically runs the workflow file,
github-actions-demo.yml
. You can see your process running
when you click on the Actions tab. For information on the
GitHub workflow results, see https://docs.github.com/en/actions/quickstart#viewing-your-workflow-results.
See Also
padv.pipeline.generatePipeline
| padv.pipeline.GitHubOptions