Building a Stress-Free Deployment Pipeline

It’s Thursday afternoon and you’re working through your checklist trying to get a new version of the plugin done before you need to head out for a long weekend.

Just after you deploy your update, you realize that you just pushed out a version that breaks your testing site on activation.

Maybe because you zipped it up on your Mac which ​WordPress doesn’t handle in version 6.4.3​?

Stressed? Yeah, me too 😥

And there goes your weekend…

Over the last two years, I’ve spent hundreds of hours working out the best solutions and safeguards so that I can be confident in plugin deployments.

I believe that deployments should be stress-free and automation is the best way to make that a reality.

Automation is the key to removing stress from deployments

Unfortunately, developers don’t think they can add any automations because:

  • Support noticed some important bugs
  • New Features seem more important
  • Where do you even begin?

Building a continuous integration pipeline for your plugin isn’t as difficult as you think.

Invest time building these automations and they will pay dividends over time.

Here are 4 areas where automation can save you 3-5 hours and unload a ton of stress during your next deployment.

Code Compatibility

One of the most important areas in your pipeline is WordPress and PHP compatibility.

Whenever you start up a new plugin, you have to define the version of WordPress and PHP you guarantee that it is compatible with.

Unfortunately, sometimes bugs are found that need to be retroactively applied to earlier versions as a patch.

Are you being diligent and checking your plugin against those versions?

When you ​add compatibility checks to your process​, you remove the burden of checking your plugin with all versions of WordPress and PHP.

Automate those checks and let them do the heavy lifting

Static Analysis

Sometimes over the lifecycle of plugin development, areas are refactored for improvement and changes are made to the codebase.

Unfortunately, when large refactors are complete, its possible that some code was made obsolete and may never be triggered in any case.

Those useless lines of code should be removed.

But those blocks of code are hard to see within a code review.

Static Analysis will read your codebase without processing it and flag any areas where you have unreachable code, along with other critical issues:

  • Incorrect parameter types
  • Missing class references
  • Inaccessible code

When you ​add static analysis to your pipeline​, you can catch these issues each time a new branch is pushed up to your repository.

Let your automation catch these errors before it goes out to your users.

Automated Testing

Adding tests to your plugin is something that you know you should probably do, but often it’s the first thing to get cut when time gets short.

One of the best ways to make the most of your limited resources—without spending a ton of time—is to ​set up Acceptance tests​.

Acceptance tests perform assertions from your users’ perspective and is the best wholistic test you can do.

Does your plugin work in a fully loaded WordPress instance?

For example, when the plugin is activated, can a user click save on the settings page and see the change?

Test that when you activate the plugin in a real WordPress environment, it doesn’t fail and throw an error for the user.

This is the first test I set up for all my plugins, that way, if this test fails it kills the deployment until I’m able to resolve the issue.

This test alone has saved me more times that I can count!

Deployments

Once you’ve implemented all the steps in your deployment pipeline, the final step is to actually deploy your plugin.

Once your plugin is sent through all these individual checks and they pass, you’ve got the green light to send the version out to your users.

If you have your plugin hosted on GitHub, ​you can use 10up’s deployment action​ to automatically publish your plugin update to the WordPress repository.

You can also configure it to zip up a production-ready version of the plugin and add it directly to the current release so it’s easy for you or others to download for testing or normal use.

In Summary

Your deployment pipeline is an opportunity for you to set up automations that can take a lot of pressure off you and your team.

When you have each of these steps configured and automatically checking code, your deployments are often stress-free.

Deploying your plugin should be easy so you can spend all your mental energy solving problems for your users.

Here’s a list of other newsletter issues that will help you implement each of these steps:

  1. ​WordPress & PHP Compatibility Checks​
  2. ​Improve Your Code Quality with Static Analysis​
  3. ​Add Acceptance Tests to Your WordPress Plugin​
  4. ​How to Add a Deployment Action to your plugin