¿Buscando una versión en Español?
Getting Started with CI/CD
About
I often get questions about how to get started with Continuous Integration and Continuous Delivery (CI/CD) in LabVIEW. Many developers see the value in it, but are unsure how to get started. The first step is usually to be able to use the CLI to automate various development tasks. That is what these tools are for.
SAS G-CLI Tools is a set of Open Source G-CLI tools for common LabVIEW Tasks. Each is provided in its own VIPM package, so you can install just the ones you want. Each G-CLI tool is also Open Source and hosted in it's own GitLab repository, so you can fork them and modify them all you want to match your specific workflow.
These tools are useful for automating your testing and build process in LabVIEW. Using these tools, you can write a simple bash script to run your unit tests and then if they pass build your executable and package it up. This helps you create a robust and repeatable process. These essential tools are the building blocks of a CI/CD pipeline.
Why?
CI/CD is the best investment you can make in risk management for your project. It prevents the 2 major sources of software defects: building the THING wrong and building the WRONG thing. Regularly running unit tests via CI helps to ensure that the software works as you intend and that you are building the THING right. Continuously delivering software to you users using CD ensures that you can get quick feedback from your users to make sure you are all on the same page and building the RIGHT thing.
Setting up CI/CD can be daunting. There are a lot of moving parts. There's also not a lot of good documentation out there. This project hopes to change that.
New to CI?
Starting out with CI can be overwhelming. If you are completely new to it all, here is how I recommend getting started.
- Checkout our introductory videos. It will give you a good overview of what is possible and what is involved.
- Map out your current process. Think about what happens after you make a change to your software. What steps do you take in order to verify that change works and didn't break anything. Then how do you build your application and distribute it. Write it all down.
- Look through the list of G-CLI tools here and connect the steps in your process to the G-CLI tools. Write a bash script that calls each of the steps in order. The goal is a single batch script that developers run locally that will run your tests and build your program and installer.
- Once you have that script, then head to the Setting up Static Runners section. It will walk you through how to setup a GitLab Runner and get it to execute your script.
- Also checkout one of our Sample Projects. It will provide some inspiration and/or a useful starting point.
- Collect feedback and improve. Once you have a pipeline in place, then it easy to tweak existing steps and add now ones.
At some point after step 3 it is worth checking out the sample projects. They may do exactly what need. They will at least show you what is possible and point you in the right direction of putting all the pieces together.
Already using some form of CI?
Head to our sample projects to see these tools in use. The examples are all GitLab repositories that you can fork and experiment with. You'll also want to check out the section on Setting Up Dynamic Runners
Introductory Videos
These G-CLI tools are one of the first steps in setting up a CI/CD Pipeline. Here are some introductory videos to GitLab CI and CI/CD in general. None of these are specifically about SAS-GCLI-Tools, but they provide some good and necessary background information. These links are here to help get you up and running with the rest of that CI/CD pipeline setup.
- CI Intro/Demo Webinar - A webinar on CI/CD using GitLab
- NI Connect 2023 Panel on CI - A panel discussion about CI at NI Connect, featuring Sam Taggart, Jim Kring, Joerg Hampel, and Chris Roebuck
- GDevCon #2 Panel Discussion on CI - Some good general thoughts and an overview of CI along with some use cases.
- LAF Presentation on Getting Quicker Feedback - Getting Started With CI - A good overview of CI.
- GLA 2022 - What is this CD thing? - A demo of a couple options for extending your CI pipeline to actually deploying code.
- Setting Up a GitLab Runner - A walkthrough of setting up a GitLab Runner
Here are some other alternative options worth exploring:
- Exploring BLT - A demonstration of BLT, which is an alternative way to do a lot of CI type things.
- Getting Started with GitHub Actions - A handson presentation that walks you through setting up a GitHub agent (similar to a GitLab Runner)
- Niko Naredi on Azure DevOps - This presentation by Niko is basically what I outline here for GitLab except it is for Azure DevOps.
Installation
Each of these G-CLI Tools is available on VIPM. That is the easiest way to install them.
Here are the links to download the latest packages from VIPM.
Liscensing
All of the tools are licensed under the MIT license. A license file is included in each VIPM installation package.
Verifying G-CLI Works
You need to make sure that G-CLI is in your PATH. Instructions for that differ based on what shell you are using.
To test G-CLI you can simply do the following:
g-cli echo -- "hello world"
Supported Versions
- LabVIEW -These tools are packaged with VIPM using LabVIEW 2020, so they should work with any LabVIEW bitness, version 2020 or later.
- OS - These tools are Windows only at the moment, although the latest G-CLI apparently also works on Linux, so perhaps that may work. If you try it and find out, please let me know. I'm still on Windows 10, but there is no reason they shouldn't work with Windows 11.
- G-CLI - 2.4.0.4 or later.