Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting started with continuous integration and WordPress

Getting started with continuous integration and WordPress

These are the slides from a talk given at WordCamp San Diego 2018.

Writing high-quality WordPress code is hard to do. It requires constant effort on our part and good self-awareness to know when we slipped up. But, if your business has any sort of success (which we all want!), you're going to work with more and more people. And many of them are likely to touch with your code.

This is going to put a strain on your development processes. It becomes harder to maintain a certain level of code quality. And you’re no longer the only person pushing code. You're now part of a team and you need a way to standardize all of the things you once did on your own.

That's the goal of continuous integration. It lets you automate your different development workflows from testing to deployment. This ensures that the quality of your code stays consistent.

This talk will go over the basics of continuous integration. We'll also go over some of the tools that are available. And then we'll finish by looking at how you put these tools together to create your own continuous integration environment.

You can read the companion article at: https://carlalexander.ca/continuous-integration-wordpress


Carl Alexander

April 14, 2018

More Decks by Carl Alexander

Other Decks in Technology


  1. Getting started with continuous integration and WordPress

  2. Carl Alexander

  3. @twigpress

  4. carlalexander.ca

  5. None
  6. Growing pains

  7. Writing high-quality WordPress code is hard to do Growing pains

  8. Requires constant effort Growing pains

  9. Even harder on a team Growing pains

  10. No longer alone pushing code Growing pains

  11. Need to standardize Growing pains

  12. Goal of continuous integration Growing pains

  13. Ensures code quality stays consistent Growing pains

  14. Minimizes maintenance work Growing pains

  15. Automates your different development workflows Growing pains

  16. What is it?

  17. Part of a larger practice What is it?

  18. What is it? Continuous deployment

  19. What is it? Continuous integration

  20. Processes

  21. Processes Continuous integration

  22. Checks out code from your repository Processes

  23. Compiles your JavaScript or preprocessed CSS Processes

  24. Processes Continuous integration

  25. Can mean different things to different people Processes

  26. Runs unit tests Processes

  27. Processes Continuous integration

  28. This is where things can vary Processes

  29. Not everyone has a staging server Processes

  30. Not everyone does acceptance testing Processes

  31. Prerequisites

  32. Continuous integration can’t exists on its own Prerequisites

  33. Relies on other processes and tools to do its job

  34. Version control system Prerequisites

  35. Automated test suite Prerequisites

  36. Automated test suite Prerequisites

  37. Code quality tools Prerequisites

  38. Why do we need it?

  39. We want to commit code often Why do we need

  40. Lots of benefits to doing it Why do we need

  41. Not without issues either Why do we need it?

  42. Can’t let it affect code quality Why do we need

  43. Need to prevent errors Why do we need it?

  44. Helps prevent both issues Why do we need it?

  45. Questions

  46. Piecing it together

  47. Two types of continuous integration workflows Piecing it together

  48. Local

  49. Why would you want to put together a local workflow?

  50. Easier to get up and running Local

  51. Lets you test things on your own Local

  52. Still useful if you move to a service Local

  53. GrumPHP Local

  54. Best (and only) tool Local

  55. Runs code quality tools whenever you commit code Local

  56. Uses git hooks to do it Local

  57. Can’t commit code without tools running Local

  58. Same as if it was done elsewhere Local

  59. Has limitations Local

  60. Hosted services

  61. Systems hosted in the cloud Hosted services

  62. Very broad category Hosted services

  63. Will look at the ones with WordPress support Hosted services

  64. A lot of the common features Hosted services

  65. Free tier Hosted services

  66. Important when evaluating Hosted services

  67. Often don’t need more than that Hosted services

  68. Different levels of support for open source projects Hosted services

  69. YAML configuration Hosted services

  70. Easy to read Hosted services

  71. Integrates with your version control system Hosted services

  72. Needs to know when someone commits code Hosted services

  73. Validate commits on different branches Hosted services

  74. Only supports git Hosted services

  75. WP-CLI support Hosted services

  76. Comparing services

  77. Comparing services • Bitbucket Pipelines • Buddy • CircleCI •

    GitLab CI • Travis CI
  78. Bitbucket Pipelines Comparing services

  79. Buddy Comparing services

  80. Comparing services

  81. Comparing services

  82. CircleCI Comparing services

  83. GitLab CI Comparing services

  84. Travis CI Comparing services

  85. Questions

  86. Your first workflow

  87. WP-CLI scaffold command Your first workflow

  88. $ wp scaffold plugin-tests my-plugin --ci=<service> Your first workflow

  89. $ wp scaffold theme-tests my-theme --ci=<service> Your first workflow

  90. What do you get? Your first workflow

  91. Continuous integration configuration file Your first workflow

  92. Rules for PHP code sniffer Your first workflow

  93. Configuration file for PHPUnit Your first workflow

  94. Connect your repository to your chosen service Your first workflow

  95. Workflow consists of two processes Your first workflow

  96. Checks for code style issues Your first workflow

  97. Runs WordPress unit tests Your first workflow

  98. Does this on a mix of PHP and WordPress versions

    Your first workflow
  99. Varies depending on the continuous integration service Your first workflow

  100. All the services support PHP 5.6 or newer versions Your

    first workflow
  101. A modern approach

  102. Huge topic A modern approach

  103. Lots of different services A modern approach

  104. You can customize them any way that you want A

    modern approach
  105. Automate the processes that you already have A modern approach

  106. WP-CLI is a great way to get started if you

    don’t have any A modern approach
  107. Great foundation for any workflow A modern approach

  108. Questions

  109. Thank you!