Slide 1

Slide 1 text

Getting started with continuous integration and WordPress

Slide 2

Slide 2 text

Carl Alexander

Slide 3

Slide 3 text

@twigpress

Slide 4

Slide 4 text

carlalexander.ca

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Growing pains

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

Requires constant effort Growing pains

Slide 9

Slide 9 text

Even harder on a team Growing pains

Slide 10

Slide 10 text

No longer alone pushing code Growing pains

Slide 11

Slide 11 text

Need to standardize Growing pains

Slide 12

Slide 12 text

Goal of continuous integration Growing pains

Slide 13

Slide 13 text

Ensures code quality stays consistent Growing pains

Slide 14

Slide 14 text

Minimizes maintenance work Growing pains

Slide 15

Slide 15 text

Automates your different development workflows Growing pains

Slide 16

Slide 16 text

What is it?

Slide 17

Slide 17 text

Part of a larger practice What is it?

Slide 18

Slide 18 text

What is it? Continuous deployment

Slide 19

Slide 19 text

What is it? Continuous integration

Slide 20

Slide 20 text

Processes

Slide 21

Slide 21 text

Processes Continuous integration

Slide 22

Slide 22 text

Checks out code from your repository Processes

Slide 23

Slide 23 text

Compiles your JavaScript or preprocessed CSS Processes

Slide 24

Slide 24 text

Processes Continuous integration

Slide 25

Slide 25 text

Can mean different things to different people Processes

Slide 26

Slide 26 text

Runs unit tests Processes

Slide 27

Slide 27 text

Processes Continuous integration

Slide 28

Slide 28 text

This is where things can vary Processes

Slide 29

Slide 29 text

Not everyone has a staging server Processes

Slide 30

Slide 30 text

Not everyone does acceptance testing Processes

Slide 31

Slide 31 text

Prerequisites

Slide 32

Slide 32 text

Continuous integration can’t exists on its own Prerequisites

Slide 33

Slide 33 text

Relies on other processes and tools to do its job Prerequisites

Slide 34

Slide 34 text

Version control system Prerequisites

Slide 35

Slide 35 text

Automated test suite Prerequisites

Slide 36

Slide 36 text

Automated test suite Prerequisites

Slide 37

Slide 37 text

Code quality tools Prerequisites

Slide 38

Slide 38 text

Why do we need it?

Slide 39

Slide 39 text

We want to commit code often Why do we need it?

Slide 40

Slide 40 text

Lots of benefits to doing it Why do we need it?

Slide 41

Slide 41 text

Not without issues either Why do we need it?

Slide 42

Slide 42 text

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

Slide 43

Slide 43 text

Need to prevent errors Why do we need it?

Slide 44

Slide 44 text

Helps prevent both issues Why do we need it?

Slide 45

Slide 45 text

Questions

Slide 46

Slide 46 text

Piecing it together

Slide 47

Slide 47 text

Two types of continuous integration workflows Piecing it together

Slide 48

Slide 48 text

Local

Slide 49

Slide 49 text

Why would you want to put together a local workflow? Local

Slide 50

Slide 50 text

Easier to get up and running Local

Slide 51

Slide 51 text

Lets you test things on your own Local

Slide 52

Slide 52 text

Still useful if you move to a service Local

Slide 53

Slide 53 text

GrumPHP Local

Slide 54

Slide 54 text

Best (and only) tool Local

Slide 55

Slide 55 text

Runs code quality tools whenever you commit code Local

Slide 56

Slide 56 text

Uses git hooks to do it Local

Slide 57

Slide 57 text

Can’t commit code without tools running Local

Slide 58

Slide 58 text

Same as if it was done elsewhere Local

Slide 59

Slide 59 text

Has limitations Local

Slide 60

Slide 60 text

Hosted services

Slide 61

Slide 61 text

Systems hosted in the cloud Hosted services

Slide 62

Slide 62 text

Very broad category Hosted services

Slide 63

Slide 63 text

Will look at the ones with WordPress support Hosted services

Slide 64

Slide 64 text

A lot of the common features Hosted services

Slide 65

Slide 65 text

Free tier Hosted services

Slide 66

Slide 66 text

Important when evaluating Hosted services

Slide 67

Slide 67 text

Often don’t need more than that Hosted services

Slide 68

Slide 68 text

Different levels of support for open source projects Hosted services

Slide 69

Slide 69 text

YAML configuration Hosted services

Slide 70

Slide 70 text

Easy to read Hosted services

Slide 71

Slide 71 text

Integrates with your version control system Hosted services

Slide 72

Slide 72 text

Needs to know when someone commits code Hosted services

Slide 73

Slide 73 text

Validate commits on different branches Hosted services

Slide 74

Slide 74 text

Only supports git Hosted services

Slide 75

Slide 75 text

WP-CLI support Hosted services

Slide 76

Slide 76 text

Comparing services

Slide 77

Slide 77 text

Comparing services • Bitbucket Pipelines • Buddy • CircleCI • GitLab CI • Travis CI

Slide 78

Slide 78 text

Bitbucket Pipelines Comparing services

Slide 79

Slide 79 text

Buddy Comparing services

Slide 80

Slide 80 text

Comparing services

Slide 81

Slide 81 text

Comparing services

Slide 82

Slide 82 text

CircleCI Comparing services

Slide 83

Slide 83 text

GitLab CI Comparing services

Slide 84

Slide 84 text

Travis CI Comparing services

Slide 85

Slide 85 text

Questions

Slide 86

Slide 86 text

Your first workflow

Slide 87

Slide 87 text

WP-CLI scaffold command Your first workflow

Slide 88

Slide 88 text

$ wp scaffold plugin-tests my-plugin --ci= Your first workflow

Slide 89

Slide 89 text

$ wp scaffold theme-tests my-theme --ci= Your first workflow

Slide 90

Slide 90 text

What do you get? Your first workflow

Slide 91

Slide 91 text

Continuous integration configuration file Your first workflow

Slide 92

Slide 92 text

Rules for PHP code sniffer Your first workflow

Slide 93

Slide 93 text

Configuration file for PHPUnit Your first workflow

Slide 94

Slide 94 text

Connect your repository to your chosen service Your first workflow

Slide 95

Slide 95 text

Workflow consists of two processes Your first workflow

Slide 96

Slide 96 text

Checks for code style issues Your first workflow

Slide 97

Slide 97 text

Runs WordPress unit tests Your first workflow

Slide 98

Slide 98 text

Does this on a mix of PHP and WordPress versions Your first workflow

Slide 99

Slide 99 text

Varies depending on the continuous integration service Your first workflow

Slide 100

Slide 100 text

All the services support PHP 5.6 or newer versions Your first workflow

Slide 101

Slide 101 text

A modern approach

Slide 102

Slide 102 text

Huge topic A modern approach

Slide 103

Slide 103 text

Lots of different services A modern approach

Slide 104

Slide 104 text

You can customize them any way that you want A modern approach

Slide 105

Slide 105 text

Automate the processes that you already have A modern approach

Slide 106

Slide 106 text

WP-CLI is a great way to get started if you don’t have any A modern approach

Slide 107

Slide 107 text

Great foundation for any workflow A modern approach

Slide 108

Slide 108 text

Questions

Slide 109

Slide 109 text

Thank you!