Github Workflow
Branching Strategy
When working on any feature, it is critical to follow a structured branching strategy to maintain code integrity and simulate a professional working environment. Here's the approach we will enforce:
-
Feature Branches:
- Each developer must work on a separate feature branch derived from the
masterbranch. - The
masterbranch should remain untouched and is reserved for production-ready code only. - To start working on a feature:
- Create a new branch from
masternamed asfeature/your-feature-name. - Develop your feature on this branch.
- Create a new branch from
- Each developer must work on a separate feature branch derived from the
-
Preview Branch:
- In addition to the
masterbranch, I will create apreviewbranch. - The
previewbranch will be used for online previews of the latest code before merging intomaster. - It serves as an intermediate step for testing features in a near-production environment.
- In addition to the
Pull Requests (PRs)
Pull Requests are a vital part of our workflow and will be strictly enforced to ensure code quality and collaboration. The following rules apply:
-
Creating a PR:
- After completing your feature development, first, ensure your local
masterbranch is up-to-date by rebasing it with the repository'smasterbranch. - Once your local
masteris rebased, switch back to your feature branch, rebase it ontomaster, and resolve any conflicts. - Push your feature branch to GitHub and create a Pull Request (PR) from your feature branch to the
previewbranch (ormaster, depending on the situation).
- After completing your feature development, first, ensure your local
-
Code Review Process:
- Each PR must be reviewed by at least one other team member, who will act as a guarantor.
- The guarantor is responsible for conducting a thorough code review, including:
- Harmful Code Check: Ensure there are no vulnerabilities or malicious code.
- Code Complexity Check: Identify and flag overly complex or poorly structured code.
- Code Standard Compliance: Ensure that the code follows our agreed-upon development standards and best practices.
- PRs should not be merged until they have been approved by the guarantor.
-
Merging Process:
- Merging permissions are restricted to the team lead (myself).
- Once a PR is reviewed and approved, I will be responsible for merging it into the
previewormasterbranch, depending on the state of the project. - This ensures that all code entering the
masterbranch is of high quality and production-ready.
CI/CD Integration
Over the next two days, I will set up our Continuous Integration/Continuous Deployment (CI/CD) pipeline. This system will:
-
Automatic Builds and Deployments:
- Regularly build and deploy the code from the
previewandmasterbranches. - The
previewbranch will be deployed to an online preview environment with a public URL for team testing. - The
masterbranch will be reserved for production deployments.
- Regularly build and deploy the code from the
-
Regular Testing and Feedback:
- The CI/CD pipeline will include automated tests to ensure that new code does not introduce bugs or regressions.
- Team members will receive feedback on their commits, helping maintain code quality.
Additional Notes
- Communication: Always communicate any blockers or issues as soon as they arise. The sooner we address problems, the smoother our development process will be.
- Consistency: Following this workflow consistently will help us maintain a high standard of code quality and streamline our development process.