isabella232 / wp-github-pull-request-travis-ci-trac-sync

Sync from GitHub Pull Requests to WordPress Trac via Travis CI (see Trac #34694)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sync from GitHub Pull Requests to WordPress Trac via Travis CI

This script facilitates contributing to WordPress Core via GitHub Pull Requests. See WordPress Trac #34694.

Caveat: This is intended for users in trusted contributor teams as it requires the user to open open an internal (intra-repo) pull request from feature branch to master. It will not work when opening a pull request from a fork due to Travis CI's security restrictions on environment variables. So any pull requests from external contributors will need to be manually applied to a feature branch by a repo contributor and then open an intra-repo pull request (while closing the original inter-repo pull request).

Installation

  1. Clone the develop.git.wordpress.org repo onto GitHub and enable Travis CI for it. See instructions in Contributing to WordPress Core via GitHub.
  2. Create a bot user on WordPress.org (e.g. xwp-bot) and request that the XML_RPC privilege be granted for that user.
  3. Ensure the patch from Trac #34694 is applied to WordPress Core; if not already upstreamed, make it the first commit to each feature branch.
  4. Edit the Travis CI settings for your WordPress GitHub clone to add the following environment variables:

For more information, see Streamlining Contributions to WordPress Core via GitHub.

Usage

Once configured, a developer with write access to the GitHub repo can contribute to WordPress Core as follows:

  1. Ensure that a Trac ticket exists.
  2. Push commits to a feature branch on GitHub named after the Trac ticket (e.g. trac-12345).
  3. Open pull request to master; this must be an internal (intra-repo) pull request, not from a fork (inter-repo).
  4. Watch Travis CI run its tests, and when completed look at Trac to see the patch uploaded.

As a bonus, the changes in the pull request will also have the following checks run:

  • Modified PHP files will be checked for syntax errors.
  • PHP changes will be checked with PHP_CodeSniffer against the WordPress-Core and WordPress-Docs standards.
  • JS changes will be checked with JSCS against the wordpress preset.

Note that if there are no PHP files modified in a pull request, the PHPUnit tests will be skipped altogether, drastically speeding up the build time.

Background

For the initial post that describes the approach, as linked above, see Streamlining Contributions to WordPress Core via GitHub.

For a prior post describing the manual workflow that is being streamlined here, also as linked above, see Contributing to WordPress Core via GitHub.

See also the WordPress Trac #34694: Facilitate automated testing in context of pull requests and diffs.

Credits

Written by Weston Ruter (westonruter), XWP.

The functionality incorporates logic from trac-attach.sh by Andrew Nacin (nacin) and Michael Adams (mdawaffe).

License GPLv2.

About

Sync from GitHub Pull Requests to WordPress Trac via Travis CI (see Trac #34694)


Languages

Language:Shell 68.7%Language:PHP 31.3%