Skip to content
develop
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
cmd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Tide

Build Status Coverage Status License: MIT Contributions Welcome Shipping faster with ZenHub.io

A rising tide lifts all boats. -- United States President, John F. Kennedy (borrowed from the New England Council)

Tide is an automated tool to provide insight into WordPress code and highlight areas to improve the quality of plugins and themes.

We believe the web can be better. With Tide, the code which underpins every website can be more standardized, faster, and more secure. Tide is focused on WordPress because no other platform has as large an impact on the state of the web. Tide raises the quality of code one plugin or theme at a time, by elevating the importance of code quality in the developer consciousness. Because a rising Tide lifts all boats.

Table of Contents

Introduction

The main focus of this documentation is to setup a local development environment. If you want to deploy to a cloud environment, please read our full documentation.

Dependencies

  • Install Composer and test if it works by running composer --version.
  • Install Docker. Note: you may not be able to setup and run Tide properly with legacy Docker Toolbox.
  • Install Go and test if your installation works by following the instructions on the installation page.
  • Install Glide, a package manager for Go. There are a few ways to install Glide:
    • Use the shell script to try an automatically install it. curl https://glide.sh/get | sh
    • Download a versioned release. Glide releases are semantically versioned.
    • Use a system package manager to install Glide. For example, brew install glide can be used if you're using Homebrew on Mac.
    • The latest development snapshot can be installed with go get. For example, go get -u github.com/Masterminds/glide. This is not a release version.
  • Install Make for Windows (Windows only)
    • The make command is not available on Windows by default and you must install it to be able to use the Tide make commands.
    • Add C:\zlib\bin to your $PATH once you've installed the package.

Cloning

Tide needs to be cloned to a directory inside your Go workspace specified by the $GOPATH environment variable. Your $GOPATH defaults to a directory named go inside your home directory, so $HOME/go on Mac/Unix and %USERPROFILE%\go (usually C:\Users\YourName\go) on Windows.

Create the following directory inside your Go workspace:

src/github.com/wptide

Open a shell and change into the directory:

cd $GOPATH/src/github.com/wptide

Clone Tide:

git clone -b develop --recursive https://github.com/wptide/wptide.git

Change to Tide working directory:

cd wptide

Update submodules:

git submodule update --init --recursive

Environment Variables

Copy the .env.dist file to .env.

cp .env.dist .env

If you are running Tide locally, you do not need to change any of these .env values. If you are deploying this into the cloud, make sure to look at the full documentation for which variables you should update and their values.

Create an empty .env.gcp file.

touch .env.gcp

The .env.gcp file overwrites the .env file values and can be left blank if you are running Tide locally. These files are used to store custom values of environment variables for various services. Before setting up any of the services, update the values according to the instructions for each service. The variables and their descriptions can be found at the end of each relevant section in our full documentation.


API

We typically update at minimum the following environment variables in the .env file:

Variable Description
API_ADMIN_EMAIL The email associated with the local admin account. Default is admin@tide.local. Note: unless you setup the Gmail SMTP plugin, any generated emails will not get sent by WordPress.
API_ADMIN_PASSWORD The password associated with the local admin account. Default is wordpress.
API_ADMIN_USER The username associated with the local admin account. Default is admin.
API_KEY The API key used both locally and on GCP to authenticate the audit-server user. Default is uRhZgeYt$v5u0vR5fpcDSWcZU.
API_SECRET The API secret used both locally and on GCP to authenticate the audit-server user. Default is rVvUWQlPQr8trSEd2qdwmE4Eiua$MjLX.

To make local development simple we have added default values for the API_KEY and API_SECRET associated with the audit-server user, which will automatically update the user meta values when make api.setup is ran. However, you are free to change these values and we encourage you to, especially if you plan on deploying to the cloud — in that case you should overwrite these values in the .env.gcp file.

If you are running Tide in production, then you can access the auto generated key and secret from the audit-server user's profile after you setup the API and before you deploy the Kubernetes clusters.

Initialize WordPress

From the project root directory run the following make commands to initialize and setup WordPress.

Install the dependencies as follows:

make api.composer

Then start the API Docker images in isolation:

make api.up

Open a new shell and run the setup script:

make api.setup

You can run the setup script to initialize WordPress for the first time or if you would like a convenient way to update the default values when you change relevant environment variables.

Hosts File

Add the following entry to your hosts file to make sure tide.local is pointed at your local Tide instance:

127.0.0.1 tide.local

You can change the tide.local URL to some other value by modifying the API_AUTH_URL and API_HTTP_HOST variables inside the .env file.

Build Images

Installs the Glide dependencies, creates the Go binaries, and builds all the Docker images:

make build.images

Isolated Build

Lighthouse Image:

make lighthouse.build.image

PHPCS Image:

make phpcs.build.image

Sync Image:

make sync.build.image

Start Servers

It is recommended that you run these Docker containers separately and start the servers in new shells in order to isolate the output. However, you can start all services (API, Lighthouse Server, PHPCS Server, Sync Server) with the following command:

make up

Isolated Start

Lighthouse Server:

make lighthouse.up

PHPCS Server:

make phpcs.up

Sync Server:

make sync.up

Run Audits

Now that all the Tide services are up and running, you can run audits on themes and plugins by doing a GET request to a special endpoint either in your browser or with an app like Postman. This endpoint only initiates an audit for the wporg Tide user and for WordPress.org hosted themes and plugins.

If we want to run an audit against the twentyseventeen theme version 2.1 for example, we would use this endpoint:

http://tide.local/api/tide/v1/audit/wporg/theme/twentyseventeen/2.1

Or for the akismet plugin version 4.1.1:

http://tide.local/api/tide/v1/audit/wporg/plugin/akismet/4.1.1

When you request an audit you will receive a JSON object back that indicates the audit is pending. If the audit has previously been requested and is complete then you will receive a JSON object with information about the theme/plugin and summary reports with links to the full report.

If the audit is pending, your shell should have some output to indicate that the audit is running. Once this output stops and all your services go back to the polling status, you can refresh the API request in the browser and you should see the updated JSON object with completed Tide reports.

For a full list of API Endpoints that can be used with Tide, see the API Endpoints section.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Maintainers

Derek Herman (@valendesigns), and Jeffrey Paul (@jeffpaul)

Contributors

Props: Amit Dudhat (@wpamitkumar), Bartek Makoś (@MakiBM), Brendan Woods (@brendanwoods-xwp), Cathi Bosco (@cathibosco), Daniel Louw (@danlouw), David Cramer (@davidcramer), David Lonjon (@davidlonjon), Derek Herman (@valendesigns), Dušan D. Majkić (@dmajkic), Janki Moradiya (@jankimoradiya), Jeffrey Paul (@jeffpaul), Jonathan Wold (@sirjonathan), Joshua Wold (@jwold), Justin Kopepasah (@kopepasah), Keanan Koppenhaver (@kkoppenhaver), Leo Postovoit (@postphotos), Lubos Kmetko (@luboskmetko), Luke Carbis (@lukecarbis), Meet Makadia (@mrmakadia94), Miina Sikk (@miina), Mike Crantea (@mehigh), Otto Kekäläinen (@ottok), Pierre Gordon (@pierlon), Scott Reilly (@coffee2code), Rheinard Korf (@rheinardkorf), Rob Stinson (@robstino), Sayed Taqui (@sayedtaqui), Ulrich Pogson (@grappler), Utkarsh Patel (@PatelUtkarsh)

Contact Us

Have questions? Don't open an Issue, come join us in the #tide channel in WordPress Slack. Even though Slack is a chat service, sometimes it takes several hours for community members to respond — please be patient.

License

Tide utilizes an MIT license.