Backend Development Flow
This page decribes the standard development flow we follow in the Rails project's repository.
From a higher point of view, we follow a sort of trunk based development in which a branch is needed for each feature/fix/enhancement/etc. For each branch, a Pull Request allow bringing the branch commits to the main branch, using "Squash & Merge" method. Once the branch has been merged and the main CI/CD build successfully passed, a draft release is ready to be pushed to production environment.
1. THEORETICAL PART
1. JIRA:
- a task describing the requirements must be present in Jira and linked to the PR (as explained in GITHUB Pull Request Creation dot 3)
- any edit to the task logic/requirements must be reported on Jira task, no matter the reason
- if some doubts are present during code writing or before starting it, you have to report them
- if doubts change requirements, they must be reported on Jira task
- after the GitHub PR merge, the Jira task must be updated in
Status(Approved) field
2. PRACTICAL PART
1. GITHUB:
1. Branch initialisation
- for any changes, a new branch from
mainmust be opened - a merged/deleted branch must not be used
- the convention on branch naming is:
fix/...,feature/...,enhancement/...,update/..., then Jira task identifier (PROJECT-ID) just after the/, a dash-after it and then the branch name as words spaced by dashes-(not underscore). For examplefeature/TWPRO-10-new-billing-logicsa.fixis used for bug fixing b.featureis used for a new behaviour of the application c.enhancementis used for an improvement invisible for the outside (ex: refactoring or better performance) d.updateis used for gems/Ruby version update
2. Pull Request Creation
- PR can be opened (in draft state) with the first commits, in order to have CI feedback and to obtain incremental reviews
- for PR code reviews see dedicated section
- the convention on PR naming is to add a prefix
[core][admin][main][graph][etc]to specify with sub-project would be intentionally modified (modifying [core] it's implied that other parts of the projects would change) - apart from the Jira task link, no description is needed in the GitHub PR, a comprehensible title would be ok (and good looking, so no
Fix/venue_model😬)
3. Development
4. Code review flow
- let your code be ready for another developer's review
- see CODE REVIEW
5. Merge
- each PR must pass CI-tests and must be approved by another backend developer
- assign the proper GitHub label
- if the branch is a lot of commits behind
mainor there are conflicts, update the branch frommain - all PR must be merged using "Squash & Merge" method, using
#{PR title} (##{PR number})as commit title and empty description - remember to delete the branch (if not automatically done by GitHub)
6. Release
- when
mainbuild sucessfully pass, a release is ready to be deployed - following the trunk based development strategy, the less PRs we include in each release, the better.
PLEASE try to release your changes as soon as possible to keep that number to 1
!!!info Non-code changes If non-code changes PR are merged (documentation, comments), it's up to the author to choose between releasing it immediately or waiting for the next merge to happen. !!! - to release changes on production, follow this
2. TESTING:
- everything must be properly tested
- everything must be properly tested
- EVERYTHING MUST BE PROPERLY TESTED
1. unit testing:
- add unit tests to the new feature or changes on the code using rspec
- check that the tests coverage for the new feature is sufficient using undercover
2. manual testing:
- manual tests have to be done for each PR, with a local production database, with Postman client or similar
- also response timing has to be tested, query and EPs have to be as fast as possible and preload data
3. active admin:
- view/edit/index/create methods must be created
- pages have to be fast on loading and processing
- pages have to be usable and administration-friendly
3. testing environments:
- if deep testing are required, a test environments are available
maincommits' deploy is automatically done after CI build passingmainbranch can be used to test the whole app, from B2C and B2B clients