SAS-GCLI-TOOLS Update

The first step in setting up CI/CD is being able to perform common tasks from the CLI. Here are a set of tools to do just that.

SAS-GCLI-TOOLS Update

Over the past several months, I have been working hard to make CI/CD more accessible in LabVIEW. I wrote a little bit about it here. As part of that I released a series of G CLI tools on VIPM. I recently updated the existing ones and added a few more.

Updates

The big feature update that I made was hiding the front panels when the tools run. Originally I liked seeing the windows pop up. It helped reassure me that the tools were running correctly. Lately, I've found I don't need that reassurance, and leaving the front panels open can occasionally cause some problems, so I decided it was better to run them hidden and close them when done.

The other big change I made was behind the scenes. I while ago I switched to launching VMs on demand for CI/CD, and I hadn't touched some of these projects in a while, so I had to update them for that.

A minor change was to standardize the folder structure in my repos. All of these are single VIs. They are pretty small and targeted so it made sense to keep it all in one VI. I originally just had a flat folder structure - just to keep it simple. The problem is that when doing that, VIPM wanted to pick up every file in that directory including readmes, licenses, gitignore, project files, etc. I had to manually exclude them all and if I happened to add a file and forgot to exclude it, then it got picked up in the next build, and suddenly vilib was getting polluted with these files when installing my package. The solution was to move the VI into a Source folder that contained only the VI and point the vipb file there.

New Testing Paradigm

Previously I was doing some manual testing for these VIs and I didn't have many automated tests. I was able to write a few tests calling the tools via G CLI using System Exec. That worked until I went to run those tests from the CLI as part of my build process. Apparently, nested calls to G CLI are not supported, so I had to find another way. I've been learning Python recently and I had just finished a book on using Pytest, so I decided to use Pytest to call my tools from the CLI and test the output.

Currently, I'm not thoroughly testing them using Pytest: I am only verifying the install. After my package is built, I grab a fresh virtual machine with LabVIEW and VIPM installed. I install my new package and then call it using G CLI with no parameters. I verify that the help message gets displayed and that it generates an error due to missing parameters. I do that using the Python Approvals Library. With these tests, I am only verifying that the package installs correctly and grabs all the correct dependencies and launches. I will still need to add some tests in the future to automate verifying that the tool actually does what it is supposed to do. At the moment I am still doing that manually, and using Pytest now I have the framework set up so it can easily be automated.

New Tools

I also added 2 new tools that I recently found uses for.

VIP Installer

So when I started using Pytest to test my installation process, I needed a way to install a package via G CLI. I had a tool to install a VIPC, but not one to install a single package file. So I wrote a simple tool to do that. For general dependency management, I recommend sticking with VIPC files.

Switcheroo

I have been working on version 2.0 of Approval Testing in LabVIEW. As part of that, I wanted to incorporate more testing. I wanted to be able to run the same unit tests on the source library and the installed library. I wrote about doing something similar with PPLs. I hadn't written a nice clean G CLI tool for it, so I went ahead and did that.

Learn More About CI/CD

If CI/CD seems overwhelming, don't feel bad - it is. Luckily we've worked out a lot of the issues and have some resources to help you out.

  • I've been documenting the tools and everything I have been learning both here on the blog and at https://sas-gcli-tools.gitlab.io/
  • If you'd like more hands-on instruction, we do have a CI/CD workshop.
  • I am also now offering CI/CD as a service - where we (SAS) manage your runner infrastructure for you.

If you are interested in the workshop, CI\CD as a service, or just need some advice, please reach out and we can talk about it.