Introduction
We know from our client engagements and discussions with industry peers that the understanding and use of Continuous Integration, or CI, varies greatly. From no awareness, to “we'd like to be doing that”, to highly integrated solutions to advocates. In this first blog in the series, we're addressing those readers who are new to CI.
We’ll introduce the concept of Continuous Integration and then discuss some of its most popular and high-value applications. We’ll provide some ideas and explain their benefits.
As mentioned, this is the first of a series of blogs on CI topics. In the next blog we will move beyond the basics and explore ways of taking your Continuous Integration setup to the next level. Beyond that, we plan to explore some of the more complex ideas in greater depth, so follow us on Linkedin, Twitter or Facebook to find out more. Also, if you are interested in attending a workshop on CI, or receiving more information on this topic, please sign up to the ITDev Continuous Integration Interest Group.
What is Continuous Integration?
Continuous integration is a concept commonly associated with Agile software development methodologies, but both CI and the associated software tools have wider applications. As a concept, CI means not building different parts of your design in isolation, but continuously integrating them together to avoid a lengthy and unpredictable integration and debug task later in the project.
Of course, continuously integrating design elements that are under development could be a recipe for chaos, which is why a structured approach with supporting tooling is essential. Automated testing throughout the hierarchy helps to ensure that each change has the desired impact and reduces the risk of breaking the overall design. If something does get broken, then the automated testing will hopefully detect the issue and allow the designer to fix it whilst the change is still fresh in their mind and before it impacts anyone else.
What is a Continuous Integration server?
A Continuous Integration server is responsible for managing automated tasks for a project. These tasks are typically associated with compiling and testing software, but there is potential for this to be extended. Many people now use CI servers as part of their system and hardware development workflows; for example, to schedule simulations and to build, deploy and run automated hardware tests incorporating FPGA designs as well as multiple software elements. Tasks can be scheduled to run on a timed basis, such as nightly, or whenever a new change is committed to the associated revision control system.
If you’re not familiar with revision control, then I would highly recommend learning more about it. Feel free to contact us and we’ll be happy to provide more information on the subject. There are highly capable free tools for revision control such as Subversion (SVN) and Git, which are well worth a look. If you’re running Windows, then also take a look at TortoiseSVN and TortoiseGit, which provide some nice graphical productivity tools for working with SVN and git.
As well as automatically performing builds and tests on a regular basis, CI servers typically provide dashboards and email notifications to share the status of the project with the team. These features are key to ensuring that action is taken swiftly to correct any bugs before they start to impact other developers. If you’re looking to try out CI for the first time, take a look at Jenkins, which is a very popular free CI tool.
Top 5 classic applications of Continuous Integration
Before we move on to more novel and advanced ideas for CI, it’s important that we cover the basics. These are often the highest value elements and worth getting in place first. In some cases these are even prerequisites for other CI tasks; for example, it’s hard to run system tests if you don’t have a working build.
It’s worth noting that projects vary in complexity, team size, quality requirements, timescales and so on. Not every idea will deliver the same benefits on every project, but hopefully, this list gives you a starting point for evaluating cost versus benefit within your team, project, or organisation. If you’d like some advice on likely costs and benefits based on our experience of CI, both internally and with clients, do get in touch. We’re more than happy to provide an initial consultation free of charge.
So, on with the list…
1. Automated Builds
Fundamental to CI is building your code. Since building your code is something you’ll have to do anyway, this shouldn’t require much of a time investment. To automate your builds, you just need to be using a command line scripted flow, rather than building via a graphical IDE. If you have a complex build flow, setting up CI delivers even greater benefits, saving you time with every build. Once it’s set up, the latest build will always be available to everyone who needs it and if someone breaks the build, you’ll find out who it was and what they did whilst it’s still fresh enough in their mind to fix it quickly.
2. System Tests
System tests will help you quickly identify any integration issues with your code and help to detect any regressions caused by subsequent changes. If you have automated testing, then moving it into a CI system should be straightforward and gives you the benefit of knowing, sooner rather than later, exactly which change broke your test.
For added benefit, combine your tests with tools such as Valgrind to monitor for memory management and threading issues whilst your tests are running.
3. Unit Tests
Unit tests are focussed on the lower levels of your code and help you to; (a) achieve a higher level of test coverage, (b) associate tests with individual methods or classes, which is great for reuse, and (c) identify the cause of test failures more quickly.
4. Static Code Analysis / Linting
Static code analysis, or linting, tools will not verify that your design meets your requirements, but they will tell you if your design has violated certain rules. These rules are configurable to suit your project, but the intent is always to avoid bugs and improve code quality. Running these tools as part of your CI testing will help to maintain code quality, which has the benefit of making the ongoing development and maintenance of your code easier, less risky and less time-consuming. If run at the right time, it can also save time spent in peer reviews, as some issues will have already been identified by the tools and hopefully corrected before the manual review process begins – more on that later.
5. Performance Testing
Different projects will have their own definitions of performance; it could be speed, picture quality, accuracy, reliability and so on. Whatever performance means to you, adding performance tests to your CI setup can be extremely beneficial. Knowing the impact of every change on your performance catches issues early and delivers invaluable insights into the impact of different approaches, features and implementations. CI tools can often be set up to allow performance to be visualised and approaches that allow the performance of different code branches to be evaluated and compared will inform your decision making when faced with complex trade-offs. Keep reading for more on branch testing.
How can ITDev help?
As a provider of software and electronics design services, we have been using CI tools and Agile processes at ITDev since 2010. We have extensive experience in deploying them on a wide range of projects spanning embedded systems, software development and FPGA design. We have used them to analyse complex performance trade-offs and to ensure high quality and high efficiency in our development.
We offer advice and assistance to companies considering investing in CI and other workflow improvements. We can also use our experience and library of in-house scripts to quickly deliver ready to use CI environments customised to fit your own project requirements. Initial discussions are always free of charge, so if you have any questions, or would like to find out more, we would be delighted to speak to you. If you are interested in attending a workshop on CI, or receiving more information on this topic, please sign up to the ITDev Continuous Integration Interest Group.
Follow us on Linkedin, Twitter or Facebook to find out about our future blog posts containing tips for getting even more from your CI environment. Finally, if you’re interested in how CI can be used in FPGA design, why not also take a look at our FPGA Design Flow tour.