TS6941
TS6941
com 1
ni.com
Continuous Integration with Jenkins and LabVIEW
Ryan Sparks
National Instruments
ni.com 3
Is this presentation for you?
• You work on medium to large projects
ni.com 4
What is Continuous Integration?
• Definition:
Continuous Integration (CI) is a development practice that requires
developers to integrate code into a shared repository several times
a day. Each check-in is then verified by an automated build, allowing
teams to detect problems early.
• Possible Components:
• Frequent commits to source code control
• Unit Testing
• Compiling (llb, exe, VI package, etc)
• Functional Testing
ni.com 5
Benefits of Continuous Integration
• Unit Testing & Functional Testing
• Find Bugs Sooner
o Reduce Debugging Time
• Automate the Testing
o Reduce Validation Cycle
ni.com 6
Example Workflow
Unit Testing
Developers
Source Control
Build
CI Tool
Functional Test
ni.com 7
Continuous Integration Tools
• Apache Continuum
• CruiseControl
• Hudson
• Jenkins
• Travis CI
• Bamboo
• And many more…
ni.com 8
Case Study: VeriStand Custom Devices
• Plug-In to extend VeriStand
• LabVIEW Project
• Multiple Targets
o My Computer
o PXI
o cRIO
• Multiple build specifications
• 5-100’s of VIs
ni.com 9
Case Study: Engine Simulation Custom Device
• For each major revision we would:
1. Open LabVIEW 2013 & code base
2. Build all build specifications
3. Install and test the code on a functional system
4. Repeat steps 1-3 for LabVIEW 2014
• Difficulties
• Manual loading and starting of builds
• LabVIEW locked while building
• Manual tracking of build failures/successes
• Manual tracking of testing failures/successes
ni.com 10
Implementing CI with Jenkins
• Automate build & test process with Jenkins
• Existing batch file & VI implementation by JKI
• Feature Highlights:
• Open Source
• Web-Based GUI
• Simple Job Configuration
• Multiple Build Executors
ni.com 11
NI Real-Time Test SE Build Server
ni.com 12
Demo - Creating & Configuring a Jenkins Job
ni.com 13
Understanding Build.bat
• Core of the build process
• Parameterized for enabling/disabling features
• Receives commands from Autobuild.csv
• Calls a VI to execute commands
• Identifies LabVIEW version of source code
• Iterates through higher versions of LabVIEW
• Moves built files to a release folder
ni.com 18
Understanding Autobuild.csv
• Create and place at root of repository
• Contains commands to be executed
• Command components are tab-delimited
• Each line is a separate command
• Supports four commands
• Build specification
o Ex: Source\MyExample.lvproj<TAB>My Computer<TAB>Release Build
• Directory to mass compile
o Ex: mc<TAB>Source
• VI to run
o Ex: vi<TAB>Test\myVI.vi
• VI Package
o Ex: vipm<TAB>Code\mypackage.vipb
ni.com 19
The Progression of a Job
Developers
Source Control
Jenkins
ni.com 20
The Progression of a Job
Build.bat
Autobuild.csv
ni.com 21
Case Study: Engine Simulation Custom Device
• Automate builds & functional testing
• Two Jenkins jobs
ni.com 22
Demo – Implementing JUnit Reporting
ni.com 23
Setting Up Your CI Server
• VM or spare computer (recommended)
• CI Tool supporting batch commands
• Jenkins is available at www.jenkins-ci.org
• LabVIEW, modules, toolkits, and drivers required for your applications
• Batch and supporting files
• Available on our github repo
• https://github.com/NIVeriStandAdd-Ons/Jenkins-Autobuild
• JKI & OpenG dependencies
• Getting started guide*
• Junit XML API*
ni.com 26
Barriers to Entry
• Another tool to learn
o Installation and configuration
o Not specifically designed for G environments
• Adding functionality can be tricky
• No LabVIEW API
• No direct integration with LabVIEW
ni.com 27
LabVIEW CI Web Service – Project Goals
• Lower the bar for LabVIEW developers to use Continuous Integration
• Better Build Tools
• Better Setup Experience
• Leverage Jenkins as much as possible
• Better way to interact with Jenkins
ni.com 28
LabVIEW CI Web Service
Jenkins
ni.com 29
The Job
ni.com 30
LabVIEW CI Project Builder
ni.com 31
Roadmap
• NIWeek 2015 (Estimate)
• CI Web Service, delivered as VI packages
o LabVIEW Build Extension
o VI Analyzer Extension
• Alfred in the Tools Menu
• Supporting documentation
• CLA Summit 2016
• Alfred as Project Provider (new build specification)
• VI Tester Extension with JUnit results
• Improved installer experience
ni.com 32
Questions?
ni.com 33
ni.com 34