Skip to content
This repository has been archived by the owner on Oct 10, 2018. It is now read-only.

Latest commit

 

History

History
39 lines (27 loc) · 2.92 KB

CONTRIBUTING.md

File metadata and controls

39 lines (27 loc) · 2.92 KB

Local Development Setup

You may use your preferred local development environment for this project. Below are the steps to setup the AMP theme in your WP local install:

  1. git clone https://github.com/xwp/ampnews ampnews to clone the AMP theme repository in your themes directory.
  2. cd ampnews and npm install to install the dev-lib which is used to run code sniffers (WPCS, ESLint) and PHPUnit in a pre-commit hook (macOS/Linux only) as well as on Travis. If you are working in a macOS or Linux environment, it is advised to install the pre-commit hook ./node_modules/wp-dev-lib/install-pre-commit-hook.sh which will run the code sniffers and PHPUnit (if possible) locally before staged changes are committed (More info here).

Branching Strategy

The branching strategy should follow GitFlow schema. The upcoming releases are managed in this repository Projects. Here is what a development cycle typically looks like:

  1. Issues to be completed for the upcoming release are added in the "To Do" column.
  2. Once the acceptance criteria are completed, this issue is assigned (may be self-assigned) and moved to the "In Progress" column.
  3. A git branch off develop is created named using the issue number (eg. add/123)
  4. Once development is completed, a PR against develop is created, a reviewer is added and the issue is moved to the "Ready for Review" column.
  5. Once code review is completed, the issue may go back to "In Progress" if changes need to be applied or moved to "QA" and its status change to "closed" if approved.
  6. Once in QA, the issue may be "reopened" and go back to "In Progress" if items are needing to be addressed, or moved to "Merge Ready" if the issue passes QA.
  7. The branch is merged into the develop and removed. The issue is then moved to the "Done" column.

Code Standards

Code must follow the WPCS, ESlint according the repo config files. All code will have extensive inline documentation appropriated to each language used.

Integration Tests

PHPUnit is used to write AMP theme integration tests. The WordPress Automated Testing Suite needs to be setup in order to run the tests. Instructions may be found here for PHP and here for JavaScript.

Please run these tests in an environment with WordPress unit tests installed, like VVV.

Run tests:

$ phpunit

Run tests with an HTML coverage report:

$ phpunit --coverage-html /tmp/report

When you push a commit to your PR, Travis CI will run the PHPUnit tests and sniffs against the WordPress Coding Standards.