CONTINUOUS INTEGRATION WITH WORDPRESS SERIES
This is the first part of a 6-part series of posts about continuous integration with WordPress. You can find out more information about why I’m doing this here.
- What is continuous integration and what does it have to do with WordPress?
- Using Github and Travis CI to begin your continuous integration journey
- What is the difference between unit tests and integration tests?
- Writing unit tests to improve your code
- Writing integration tests and making your code robust (everywhere)
- Additional tests you can do for your WordPress projects
- Continuous integration with WordPress resources
So, what is continuous integration?
Continuous integration (CI) is a practice that requires developers (especially teams of developers) to integrate their code multiple times a day or as often as possible into a single repository. Every commit into this central repository will trigger an automated build that will check and verify that the code still works.
To verify the code, you usually run a number of tests. There are a couple of tests that you can run including the testing of coding standards. Coding standards may not affect your code working in production but it does allow for teams work more efficiently with each other – one purpose of continuous integration.
The main tests you want to run are called unit tests and integration tests. I’ll describe the differences of each in part 3.
- Continuous Integration: Improving Software Quality and Reducing Risk
- Continuous Integration on ThoughtWorks
Why do I need continuous integration?
There are so many reasons why CI is important for you, your team, your business and / or your open source project. It’s essentially a process that will level up your entire workflow and allow you build projects more efficiently. Here are some of the benefits that I think are key:
- Smaller regular commits allow for you to find out when an issue was introduced and allow you to fix it quickly.
- Automated builds mean that testing becomes a non-event (basically your team can’t forget to have tested the software as it is done for them).
- Testing in different environments makes sure your code is working as expected in as many places that you can think of.
- Bugs are found and communicated early on which means you can fix them quickly.
- Bugs are generally found before they go into production.
- Troubleshoot less and code more – my personal favourite.
To me, it’s quite clear that continuous integration is key to every project and that moving teams of people onto a CI workflow will literally take your project to the next level.
How can WordPress plugin and theme developers benefit from continuous integration?
Having spent some time with this over the last couple of months the benefits are so clear to me. The benefits of CI far outweigh the implementation of it and your end-users will thank you for it (by buying more, thanking you more or using your software more). Here are some of the benefits:
- Your code will work most of the time as you’ve tried to break it with unit tests.
- Your code quality generally improves especially if your tests check for coding standards.
- If your plugin / theme relies on other plugins or themes you’re able to verify that your code works with different versions of their code. This includes new releases.
- You’re able to verify that your code works in different software environments (think PHP versions).
- The most important benefit is that you’re able to test that your code works with different versions of WordPress. You can even check your code works with WordPress in different environments as well.
- You can test a future version of WordPress before it’s launched so that your plugin / theme is ready when it is released.
I hope this has helped understand the clear benefits of using continuous integration with your WordPress project. In the next part, we will be setting up a quick project and then will implement continuous with GitHub and Travis CI. I’m a big fan of doing practical learning and so you’ll get your hands dirty from the start.