Difference between revisions of "Development workflow - webdev"

From WormBaseWiki
Jump to navigationJump to search
 
(109 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This page describes the development model used by the web development team at WormBase using git as our version control system. This includes our branching strategy and release management.
+
This page describes the development model used by the web development team at WormBase using git as our version control system. This includes our branching strategy and release management. We use git and GitHub to help us manage development.
  
 
= Overview Diagram =
 
= Overview Diagram =
[[File:Git_Workflow_-_WormBase2.png]]
+
[[File:Git_Workflow_-_WormBase4.png]]
  
 
[https://docs.google.com/drawings/d/1j-a-8a_hTIqCiMCRLUcemGqEe_c8LXOZKuioHlE9oX4/edit?usp=sharing Editable version of the diagram]
 
[https://docs.google.com/drawings/d/1j-a-8a_hTIqCiMCRLUcemGqEe_c8LXOZKuioHlE9oX4/edit?usp=sharing Editable version of the diagram]
  
= Branch Strategy =
+
= Contributing =
We use branches to help with our release management, testing strategy, and helping with parallel development among the team.
 
 
 
== Main branches ==
 
Inside the <code>WormBase/website</code> repository, there are three main branches: <code>master</code>, <code>dev</code> and <code>production</code>.
 
  
* <code>master</code>: current, stable code. All new changes brought into master have been tested on [http://staging.wormbase.org staging.wormbase.org] and approved by either the curator requesting the change, or the development lead.
+
Whenever you begin work on a new issue you should create a new branch for it. Any new features should branch off <code>staging</code>. Once the feature is ready for testing, you can submit a pull request to <code>staging</code> for code review. Feature branches aren't necessarily branches in the main repository - they can in the main WormBase repository, or on a developer's fork. [http://wiki.wormbase.org/index.php/Development_workflow_-_webdev#Branch_stratgey Read more on our branching strategy]
  
* <code>dev</code>: any features/changes ready for testing should be pushed to the <code>dev</code> branch. This code gets pushed nightly to [http://staging.wormbase.org staging.wormbase.org].
+
git checkout -b myFeature staging
  
* <code>production</code>: the code currently in production. Branched off of <code>master</code> at each release.
+
Now you can make your changes and commit some code. [http://wiki.wormbase.org/index.php/Development_workflow_-_webdev#Commit_messages Read more on commit messages]
 +
git add /PATH/TO/UPDATED/FILE
 +
git commit -m "Descriptive commit message"
  
== Supporting branches ==
+
When you're ready, you can push your branch to GitHub
Other types of branches used can include feature branches and hotfixes. These branches are only intended to live until the new feature is merged into <code>dev</code> or the fix is completed.
 
  
=== Feature branches ===
+
git push origin myFeature
Any new major features should branch off <code>dev</code>. Once the feature is ready for testing, it can be merged back into <code>dev</code>. These aren't necessarily branches in the main repository - can be local, or on a developer's fork.
 
  
==== Starting a feature ====
+
Continue making changes until your code is ready for a code review. [http://wiki.wormbase.org/index.php/Development_workflow_-_webdev#Is_my_code_ready_for_review.3F Is my code ready for review?]
Create a branch from <code>dev</code> for your work on this feature/issue/bug
 
git checkout -b myFeature dev
 
  
==== Finishing a feature (ready for testing) ====
+
When your code is ready, go to GitHub and create a Pull Request. [http://nathanhoad.net/git-workflow-forks-remotes-and-pull-requests More info on Pull Requests.]
When you're ready to incorporate your feature and have it tested on [http://staging.wormbase.org staging.wormbase.org], you can push your feature branch back to <code>dev</code>
 
  
For a smaller feature:
+
# Go to the repository where you pushed your changes
git checkout dev
+
# Using the drop down, switch to your branch (e.g. myFeature)
git merge --squash myFeature
+
# Click the green '''Compare & review''' button
git commit -v #reference the github issue in your commit message here
+
# After reviewing all the changes, click on '''Create pull request''' in the header to send the pull request
 +
# In the description, write a short summary of the issues (along with a link to the issue) and changes made along with some links for testing
 +
#* [http://wiki.wormbase.org/index.php/Development_workflow_-_webdev#What_info_should_I_include_in_a_Pull_Request.3F What info should I include in a Pull Request?]
  
You can use <code>--squash</code> to remove any checkpoint commits you may have added to your branch during development, ie. you may have committed debug statements, or broken changes you have since removed.
+
Wait for another member of the web development team to review and merge your pull request. If more changes are requested, you can push more commits to the same branch and it will be added to the pull request.
  
If your feature is larger and would benefit from having the work broken down into several commits, you can rebase instead:
+
Once your pull request is merged, locally bring in the changes and delete your issue branch
  git checkout myFeature
+
  git checkout staging
  git rebase --interactive dev
+
git pull
 +
  git branch -d myFeature
  
This will open your editor with a list of commits. Each line has the operation to perform (<code>pick</code> or <code>squash</code>), the SHA1 for the commit, and the commit message. By default, each commit has the <code>pick</code> operation:
+
Go to the original github issue:
pick 8af9b68 Update search
+
# Add the '''Under testing''' label to your issue
pick c180b1b bug fix
+
# Comment on the issue to notify all involved that it is ready for testing. Add links for testing for the ease of testers.
pick 36afac4 work on field titles
+
# Another member of the WormBase group will close the issue once they have tested it
  
Changing the operation to <code>squash</code> will squash that commit.
+
Note: You can view all merged pull requests using this link: https://github.com/WormBase/website/pulls?q=is%3Apr+is%3Amerged
pick 8af9b68 Update search
+
== Is my code ready for review? ==
squash c180b1b bug fix
 
pick 36afac4 work on field titles
 
  
When you save and close the editor, a new editor will pop up for a commit message for the combined commit. Reference the github issue for this feature here.
+
Before you send a Pull Request, please make sure you have completed the following:
  
Now, comment on the github issue to notify all parties involved that the feature will be ready for testing on [http://staging.wormbase.org staging] soon.
+
* Written tests (API tests or REST tests) demonstrating the problem in the issue. [http://wiki.wormbase.org/index.php/Unit_Testing More info on testing]
 
+
* Fix the problem (ie pass the tests)
==== Moving a feature to <code>master</code> (pass testing) ====
+
* Complete the issue as much as possible without curators seeing an example
Once all features currently on the <code>dev</code> branch have been tested on staging and approved by either the requesting curator or the development lead, <code>dev</code> can be merged onto the <code>master</code>.
+
* Code style meeting the [http://wiki.wormbase.org/index.php/Coding_standards WormBase coding standards] (indentation, comments, no debug statements)
 
 
git checkout master
 
git merge dev
 
 
 
=== Hotfixes ===
 
If a major bugfix is needed in production, create a hotfix branch from production. When finished, the branch needs to be merged back into <code>production</code> and <code>dev</code>
 
 
 
==== Begining a fix ====
 
git checkout -b hotfix-issXXX production
 
  
Fix the bug and commit the fix in one or more commits. Reference the github issue:
+
== What info should I include in a Pull Request? ==
git commit -m "Severe production bug
 
* search redirecting to home page
 
* fix #XXX"
 
  
==== Closing the fix ====
+
To help your reviewer understand your code, please try to include the following in the Pull Request description
The fix needs to be merged back to both <code>production</code> and <code>dev</code>
 
git checkout dev
 
git merge hotfix-issXXX
 
  
git checkout production
+
* A link to the issue being addressed
git merge hotfix-issXXX
+
* Short summary of the problem
 +
* Some links to use for testing
 +
* Any other information that may be needed to testing (ie wormbase_local.conf changes, extra files needed, etc)
  
 +
== Commit messages ==
 +
git commit -m "COMMIT MESSAGE GOES HERE"
  
= Note on Commit Messages =
+
Keep your commit message as descriptive as possible, reference any issues affected by the issue number (#YYY):
 +
This is a summary of my commit.
 +
* here is a breakdown of the different changes
 +
* mention github users (@tharris) when appropriate
 +
* related to #529
 +
* #945
  
 
Here is a template originally written by Tim Pope at tpope.net:
 
Here is a template originally written by Tim Pope at tpope.net:
Line 103: Line 91:
 
</pre>
 
</pre>
  
== issues and commits ==
+
= Code Review =
[https://github.com/blog/831-issues-2-0-the-next-generation issues 2.0 the next generation]
+
 
 +
All changes must go through a code review before being merged to the staging branch. At WormBase, this is done using Pull Requests. All members of the core development team are expected to keep an eye on the open Pull Requests and reviewing the ones they are assigned.
 +
 
 +
* Test out the pull request (check out the branch)
 +
* Take a quick look at the code (are there comments? anything obvious missing)
 +
* Run the tests written for this issue
 +
* Leave a comment on the PR if you notice anything that needs to be fixed
 +
* Merge the PR if you think it looks good
 +
** Begin by merging staging into the feature branch.
 +
** If there are conflicts, ask the owner of the PR to help resolve them.
 +
 
 +
= Testing =
 +
All issues need to be tested and closed by at least one person who is not the developer who made the change. Ideally, it would be the curator asking for the feature/fix.
 +
 
 +
'''If you would like to help test''':
 +
* Look at the [https://github.com/WormBase/website/issues?labels=under+testing&state=open open issues 'under testing'].
 +
* All the changes for these issues are available for testing on [http://staging.wormbase.org staging.wormbase.org].
 +
* You can test out the changes and leave any feedback you have in the issue comments.
 +
* If you think this feature/fix is ready for production, please '''close the issue'''.
 +
 
 +
= Branch Strategy =
 +
We use branches to help with our release management, testing strategy, and helping with parallel development among the team.
 +
 
 +
== Main branches ==
 +
Inside the <code>WormBase/website</code> repository, there are three main branches: <code>master</code>, <code>staging</code> and <code>production</code>.
 +
 
 +
* <code>master</code>: current, stable code. All new changes brought into master have been tested on [http://staging.wormbase.org staging.wormbase.org] and approved by either the curator requesting the change, or the development lead.
 +
 
 +
* <code>staging</code>: all changes get pushed to the <code>staging</code> branch after code review. This code gets pushed immediately to [http://staging.wormbase.org staging.wormbase.org].
 +
 
 +
* <code>production</code>: the code currently in production. Branched off of <code>master</code> at each release.
 +
 
 +
== Feature branches ==
 +
Any new features should branch off <code>staging</code>. Read more on feature branches in [http://wiki.wormbase.org/index.php/Development_workflow_-_webdev#Contributing our contribution guidelines]
 +
 
 +
== Hotfixes ==
 +
If a major bugfix is needed in production, create a hotfix branch from production. When finished, the branch needs to be merged (via PR/code review) back into <code>production</code> and <code>staging</code>
 +
 
 +
=== Begining a fix ===
 +
git checkout -b hotfix-issXXX production
 +
 
 +
Fix the bug and commit the fix in one or more commits. Reference the github issue:
 +
git commit -m "Severe production bug
 +
* search redirecting to home page
 +
* fix #XXX"
  
Link to an issue whenever a commit is related to that issue <code>#xxx</code>.
+
=== Closing the fix ===
 +
To close the fix, send a Pull Request to both the <code>production</code> and <code>staging</code> for code review. The reviewer will merge the branch.
  
Using <code>fix #xxx</code> will close the issue when this commit is pushed to master and notify that the issue will be closed [https://github.com/blog/1386-closing-issues-via-commit-messages].
+
= Development Timeline =
The following synonyms are supported:
+
 
fixes #xxx
+
See: [https://docs.google.com/document/d/1zIOm95tV9A14n9xnkPkMgiOTGcOIzx161y9UbDZvfW4/pub WormBase Release Workflow]
fixed #xxx
 
fix #xxx
 
closes #xxx
 
close #xxx
 
closed #xxx
 
  
 
= Release Management =
 
= Release Management =
 
When production is ready to updated for release WSXXX:
 
When production is ready to updated for release WSXXX:
 +
 +
# Create a new [https://github.com/WormBase/website/pull/new/WormBase:master...staging pull request from staging to master].
 +
# Review all changes going into new release. Merge in the pull request.
 +
# Create a new [https://github.com/WormBase/website/pull/new/WormBase:production...master pull request from master to production].
 +
# Review all changes going into new release. Merge in the pull request.
 +
# Tag production branch with appropriate release name.
 +
 +
 
  git checkout production
 
  git checkout production
git merge master
 
 
  git tag -a WSXXX
 
  git tag -a WSXXX
  
Line 128: Line 163:
 
* [https://github.com/WormBase/website/issues github issue tracker]
 
* [https://github.com/WormBase/website/issues github issue tracker]
 
* [https://docs.google.com/drawings/d/1j-a-8a_hTIqCiMCRLUcemGqEe_c8LXOZKuioHlE9oX4/edit?usp=sharing workflow diagram]
 
* [https://docs.google.com/drawings/d/1j-a-8a_hTIqCiMCRLUcemGqEe_c8LXOZKuioHlE9oX4/edit?usp=sharing workflow diagram]
 +
 +
[[Category:Development General (Web Dev)]]
 +
[[Category:Getting Started (Web Dev)]]

Latest revision as of 20:00, 11 August 2014

This page describes the development model used by the web development team at WormBase using git as our version control system. This includes our branching strategy and release management. We use git and GitHub to help us manage development.

Overview Diagram

Git Workflow - WormBase4.png

Editable version of the diagram

Contributing

Whenever you begin work on a new issue you should create a new branch for it. Any new features should branch off staging. Once the feature is ready for testing, you can submit a pull request to staging for code review. Feature branches aren't necessarily branches in the main repository - they can in the main WormBase repository, or on a developer's fork. Read more on our branching strategy

git checkout -b myFeature staging

Now you can make your changes and commit some code. Read more on commit messages

git add /PATH/TO/UPDATED/FILE
git commit -m "Descriptive commit message"

When you're ready, you can push your branch to GitHub

git push origin myFeature

Continue making changes until your code is ready for a code review. Is my code ready for review?

When your code is ready, go to GitHub and create a Pull Request. More info on Pull Requests.

  1. Go to the repository where you pushed your changes
  2. Using the drop down, switch to your branch (e.g. myFeature)
  3. Click the green Compare & review button
  4. After reviewing all the changes, click on Create pull request in the header to send the pull request
  5. In the description, write a short summary of the issues (along with a link to the issue) and changes made along with some links for testing

Wait for another member of the web development team to review and merge your pull request. If more changes are requested, you can push more commits to the same branch and it will be added to the pull request.

Once your pull request is merged, locally bring in the changes and delete your issue branch

git checkout staging
git pull
git branch -d myFeature

Go to the original github issue:

  1. Add the Under testing label to your issue
  2. Comment on the issue to notify all involved that it is ready for testing. Add links for testing for the ease of testers.
  3. Another member of the WormBase group will close the issue once they have tested it

Note: You can view all merged pull requests using this link: https://github.com/WormBase/website/pulls?q=is%3Apr+is%3Amerged

Is my code ready for review?

Before you send a Pull Request, please make sure you have completed the following:

  • Written tests (API tests or REST tests) demonstrating the problem in the issue. More info on testing
  • Fix the problem (ie pass the tests)
  • Complete the issue as much as possible without curators seeing an example
  • Code style meeting the WormBase coding standards (indentation, comments, no debug statements)

What info should I include in a Pull Request?

To help your reviewer understand your code, please try to include the following in the Pull Request description

  • A link to the issue being addressed
  • Short summary of the problem
  • Some links to use for testing
  • Any other information that may be needed to testing (ie wormbase_local.conf changes, extra files needed, etc)

Commit messages

git commit -m "COMMIT MESSAGE GOES HERE"

Keep your commit message as descriptive as possible, reference any issues affected by the issue number (#YYY):

This is a summary of my commit.
* here is a breakdown of the different changes
* mention github users (@tharris) when appropriate
* related to #529
* #945

Here is a template originally written by Tim Pope at tpope.net:

Short (50 chars or less) summary of changes

More detailed explanatory text, if necessary.  Wrap it to about 72
characters or so.  In some contexts, the first line is treated as the
subject of an email and the rest of the text as the body.  The blank
line separating the summary from the body is critical (unless you omit
the body entirely); tools like rebase can get confused if you run the
two together.

Further paragraphs come after blank lines.

 - Bullet points are okay, too

 - Typically a hyphen or asterisk is used for the bullet, preceded by a
   single space, with blank lines in between, but conventions vary here

Code Review

All changes must go through a code review before being merged to the staging branch. At WormBase, this is done using Pull Requests. All members of the core development team are expected to keep an eye on the open Pull Requests and reviewing the ones they are assigned.

  • Test out the pull request (check out the branch)
  • Take a quick look at the code (are there comments? anything obvious missing)
  • Run the tests written for this issue
  • Leave a comment on the PR if you notice anything that needs to be fixed
  • Merge the PR if you think it looks good
    • Begin by merging staging into the feature branch.
    • If there are conflicts, ask the owner of the PR to help resolve them.

Testing

All issues need to be tested and closed by at least one person who is not the developer who made the change. Ideally, it would be the curator asking for the feature/fix.

If you would like to help test:

  • Look at the open issues 'under testing'.
  • All the changes for these issues are available for testing on staging.wormbase.org.
  • You can test out the changes and leave any feedback you have in the issue comments.
  • If you think this feature/fix is ready for production, please close the issue.

Branch Strategy

We use branches to help with our release management, testing strategy, and helping with parallel development among the team.

Main branches

Inside the WormBase/website repository, there are three main branches: master, staging and production.

  • master: current, stable code. All new changes brought into master have been tested on staging.wormbase.org and approved by either the curator requesting the change, or the development lead.
  • staging: all changes get pushed to the staging branch after code review. This code gets pushed immediately to staging.wormbase.org.
  • production: the code currently in production. Branched off of master at each release.

Feature branches

Any new features should branch off staging. Read more on feature branches in our contribution guidelines

Hotfixes

If a major bugfix is needed in production, create a hotfix branch from production. When finished, the branch needs to be merged (via PR/code review) back into production and staging

Begining a fix

git checkout -b hotfix-issXXX production

Fix the bug and commit the fix in one or more commits. Reference the github issue:

git commit -m "Severe production bug
* search redirecting to home page
* fix #XXX"

Closing the fix

To close the fix, send a Pull Request to both the production and staging for code review. The reviewer will merge the branch.

Development Timeline

See: WormBase Release Workflow

Release Management

When production is ready to updated for release WSXXX:

  1. Create a new pull request from staging to master.
  2. Review all changes going into new release. Merge in the pull request.
  3. Create a new pull request from master to production.
  4. Review all changes going into new release. Merge in the pull request.
  5. Tag production branch with appropriate release name.


git checkout production
git tag -a WSXXX

Links