|
| 1 | +# CONTRIBUTING |
| 2 | + |
| 3 | +## RESOURCES |
| 4 | + |
| 5 | +If you wish to contribute to Zend Framework, please be sure to |
| 6 | +read/subscribe to the following resources: |
| 7 | + |
| 8 | + - [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards) |
| 9 | + - [Contributor's Guide](http://framework.zend.com/participate/contributor-guide) |
| 10 | + - ZF Contributor's mailing list: |
| 11 | + Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html |
| 12 | + |
| 13 | + - ZF Contributor's IRC channel: |
| 14 | + #zftalk.dev on Freenode.net |
| 15 | + |
| 16 | +If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/ZendSkeletonApplication/issues/new). |
| 17 | + |
| 18 | +## Reporting Potential Security Issues |
| 19 | + |
| 20 | +If you have encountered a potential security vulnerability, please **DO NOT** report it on the public |
| 21 | +issue tracker: send it to us at [[email protected]](mailto:[email protected]) instead. |
| 22 | +We will work with you to verify the vulnerability and patch it as soon as possible. |
| 23 | + |
| 24 | +When reporting issues, please provide the following information: |
| 25 | + |
| 26 | +- Component(s) affected |
| 27 | +- A description indicating how to reproduce the issue |
| 28 | +- A summary of the security vulnerability and impact |
| 29 | + |
| 30 | +We request that you contact us via the email address above and give the project |
| 31 | +contributors a chance to resolve the vulnerability and issue a new release prior |
| 32 | +to any public exposure; this helps protect users and provides them with a chance |
| 33 | +to upgrade and/or update in order to protect their applications. |
| 34 | + |
| 35 | +For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). |
| 36 | + |
| 37 | +## RUNNING TESTS |
| 38 | + |
| 39 | +First, use [Composer](https://getcomposer.org) to install all dependencies: |
| 40 | + |
| 41 | +```bash |
| 42 | +$ composer install |
| 43 | +``` |
| 44 | + |
| 45 | +Make sure that `zendframework/zend-test` is installed: |
| 46 | + |
| 47 | +```bash |
| 48 | +$ composer require --dev zendframework/zend-test |
| 49 | +``` |
| 50 | + |
| 51 | +To run tests: |
| 52 | + |
| 53 | +```bash |
| 54 | +$ composer test |
| 55 | +``` |
| 56 | + |
| 57 | +You can turn on conditional tests with the `phpunit.xml` file. |
| 58 | +To do so: |
| 59 | + |
| 60 | + - Copy `phpunit.xml.dist` file to `phpunit.xml` |
| 61 | + - Edit `phpunit.xml` to enable any specific functionality you |
| 62 | + want to test, as well as to provide test values to utilize. |
| 63 | + |
| 64 | +## Running Coding Standards Checks |
| 65 | + |
| 66 | +First, ensure you've installed dependencies via composer: |
| 67 | + |
| 68 | +```bash |
| 69 | +$ composer require --dev squizlabs/php_codesniffer |
| 70 | +``` |
| 71 | + |
| 72 | +To run CS checks only: |
| 73 | + |
| 74 | +```console |
| 75 | +$ composer cs-check |
| 76 | +``` |
| 77 | + |
| 78 | +To attempt to automatically fix common CS issues: |
| 79 | + |
| 80 | +```console |
| 81 | +$ composer cs-fix |
| 82 | +``` |
| 83 | + |
| 84 | +If the above fixes any CS issues, please re-run the tests to ensure |
| 85 | +they pass, and make sure you add and commit the changes after verification. |
| 86 | + |
| 87 | +## Recommended Workflow for Contributions |
| 88 | + |
| 89 | +Your first step is to establish a public repository from which we can |
| 90 | +pull your work into the master repository. We recommend using |
| 91 | +[GitHub](https://github.com), as that is where the component is already hosted. |
| 92 | + |
| 93 | +1. Setup a [GitHub account](http://github.com/), if you haven't yet |
| 94 | +2. Fork the repository (http://github.com/zendframework/ZendSkeletonApplication) |
| 95 | +3. Clone the canonical repository locally and enter it. |
| 96 | + |
| 97 | + ```bash |
| 98 | + $ git clone https://github.com/zendframework/ZendSkeletonApplication.git |
| 99 | + $ cd ZendSkeletonApplication |
| 100 | + ``` |
| 101 | + |
| 102 | +4. Add a remote to your fork; substitute your GitHub username in the command |
| 103 | + below. |
| 104 | + |
| 105 | + ```bash |
| 106 | + $ git remote add {username} [email protected]:{username}/ZendSkeletonApplication.git |
| 107 | + $ git fetch {username} |
| 108 | + ``` |
| 109 | + |
| 110 | +### Keeping Up-to-Date |
| 111 | + |
| 112 | +Periodically, you should update your fork or personal repository to |
| 113 | +match the canonical ZF repository. Assuming you have setup your local repository |
| 114 | +per the instructions above, you can do the following: |
| 115 | + |
| 116 | + |
| 117 | +```bash |
| 118 | +$ git checkout master |
| 119 | +$ git fetch origin |
| 120 | +$ git rebase origin/master |
| 121 | +# OPTIONALLY, to keep your remote up-to-date - |
| 122 | +$ git push {username} master:master |
| 123 | +``` |
| 124 | + |
| 125 | +If you're tracking other branches -- for example, the "develop" branch, where |
| 126 | +new feature development occurs -- you'll want to do the same operations for that |
| 127 | +branch; simply substitute "develop" for "master". |
| 128 | + |
| 129 | +### Working on a patch |
| 130 | + |
| 131 | +We recommend you do each new feature or bugfix in a new branch. This simplifies |
| 132 | +the task of code review as well as the task of merging your changes into the |
| 133 | +canonical repository. |
| 134 | + |
| 135 | +A typical workflow will then consist of the following: |
| 136 | + |
| 137 | +1. Create a new local branch based off either your master or develop branch. |
| 138 | +2. Switch to your new local branch. (This step can be combined with the |
| 139 | + previous step with the use of `git checkout -b`.) |
| 140 | +3. Do some work, commit, repeat as necessary. |
| 141 | +4. Push the local branch to your remote repository. |
| 142 | +5. Send a pull request. |
| 143 | + |
| 144 | +The mechanics of this process are actually quite trivial. Below, we will |
| 145 | +create a branch for fixing an issue in the tracker. |
| 146 | + |
| 147 | +```bash |
| 148 | +$ git checkout -b hotfix/9295 |
| 149 | +Switched to a new branch 'hotfix/9295' |
| 150 | +``` |
| 151 | + |
| 152 | +... do some work ... |
| 153 | + |
| 154 | + |
| 155 | +```bash |
| 156 | +$ git commit |
| 157 | +``` |
| 158 | + |
| 159 | +... write your log message ... |
| 160 | + |
| 161 | + |
| 162 | +```bash |
| 163 | +$ git push {username} hotfix/9295:hotfix/9295 |
| 164 | +Counting objects: 38, done. |
| 165 | +Delta compression using up to 2 threads. |
| 166 | +Compression objects: 100% (18/18), done. |
| 167 | +Writing objects: 100% (20/20), 8.19KiB, done. |
| 168 | +Total 20 (delta 12), reused 0 (delta 0) |
| 169 | +To ssh:// [email protected]/{username}/ZendSkeletonApplication.git |
| 170 | + b5583aa..4f51698 HEAD -> master |
| 171 | +``` |
| 172 | + |
| 173 | +To send a pull request, you have two options. |
| 174 | + |
| 175 | +If using GitHub, you can do the pull request from there. Navigate to |
| 176 | +your repository, select the branch you just created, and then select the |
| 177 | +"Pull Request" button in the upper right. Select the user/organization |
| 178 | +"zendframework" as the recipient. |
| 179 | + |
| 180 | +If using your own repository - or even if using GitHub - you can use `git |
| 181 | +format-patch` to create a patchset for us to apply; in fact, this is |
| 182 | +**recommended** for security-related patches. If you use `format-patch`, please |
| 183 | +send the patches as attachments to: |
| 184 | + |
| 185 | +- [email protected] for patches without security implications |
| 186 | +- [email protected] for security patches |
| 187 | + |
| 188 | +#### What branch to issue the pull request against? |
| 189 | + |
| 190 | +Which branch should you issue a pull request against? |
| 191 | + |
| 192 | +- For fixes against the stable release, issue the pull request against the |
| 193 | + "master" branch. |
| 194 | +- For new features, or fixes that introduce new elements to the public API (such |
| 195 | + as new public methods or properties), issue the pull request against the |
| 196 | + "develop" branch. |
| 197 | + |
| 198 | +### Branch Cleanup |
| 199 | + |
| 200 | +As you might imagine, if you are a frequent contributor, you'll start to |
| 201 | +get a ton of branches both locally and on your remote. |
| 202 | + |
| 203 | +Once you know that your changes have been accepted to the master |
| 204 | +repository, we suggest doing some cleanup of these branches. |
| 205 | + |
| 206 | +- Local branch cleanup |
| 207 | + |
| 208 | + ```bash |
| 209 | + $ git branch -d <branchname> |
| 210 | + ``` |
| 211 | + |
| 212 | +- Remote branch removal |
| 213 | + |
| 214 | + ```bash |
| 215 | + $ git push {username} :<branchname> |
| 216 | + ``` |
| 217 | + |
| 218 | +## Conduct |
| 219 | + |
| 220 | +Please see our [CONDUCT.md](CONDUCT.md) to understand expected behavior when interacting with others in the project. |
0 commit comments