CI CD - COS-301/graduates GitHub Wiki
Welcome to the CI/CD Wiki!
Table Of Contents
- Git Procedures
- 1.1 Forking
- 1.2 Keeping up to date
- 1.3 Commiting
- 1.4 Pull Requests
- Pipeline Overview
- 2.1 Workflows
- 2.1.1 index.yml
- 2.1.2 nxtests.yml
- 2.1.3 metatests.yml
- 2.1.4 full.yml
- 2.1 Workflows
- Code Coverage
- 3.1 How it works
Git Procedures
Forking
The first step to interacting with the repository is to make a fork of it, and then clone it to a local directory.
Keeping your fork up to date
Your fork should be kept up to date with the parent repository by fetching upstream daily. This is important so that you can fetch any fixes made by the other teams and ensures your code will work when you make a pull request.
Use:
git fetch --all
and then:
git pull upstream develop
Committing changes
Changes made in your local clone of the repo should be constantly committed with descriptions of the changes.
Making a pull request
Pull requests should be made constantly and in small increments i.e. minor changes and not many major changes to the code at once. Before a pull request is made, one should fetch from upstream to make sure the repo is up to date and any relevant fixes made by other teams are included. Once this is done, the pull request should be made using the right gitmojis, your feature team, and then a description of the pull request. (e.g. ✅ (Shorts-DB): Integration Tests). After this, labels must be added. This includes priority, roles, scope, status, and type. Then reviewers and assignees need to be added, the reviewer should be your DevOps member of the team or a member of the CI/CD team.
Pipeline Overview
Workflows
:page_facing_up:
index.ymlThis workflow is run on every PR to the repo's develop and main branches.
The jobs run by default are the build, lint, unit, and e2e which are found in the nxtests.yml file.
All tests are run with an affected tag if run through this workflow.
This workflow also has a dispatch so that individual jobs can be run manually on any branch.
:page_facing_up:
nxtests.ymlThis is set up to be a reusable workflow that is called from files like index.yml and full.yml using conditional blocks.
The environment that is used is ubuntu-latest with Yarn and Node.
All binaries for respective packages are cached using the yarn.lock
Shas are derived for use with the affected tag.
:page_facing_up:
meta.ymlThis workflow runs on every PR when it is opened, reopened, and labeled.
The aim of this workflow is to ensure proper PR standards.
Workflow checks for if all labels, projects, and milestones have been set.
:page_facing_up:
full.ymlThis workflow is run on every push/commit to the repo's main, develop, and any release branches.
Tests run are test-all in index.yml.
This is used to check the entire repo and not only the affected portions.
:page_facing_up:
deploy.ymlThis workflow is run on every push/commit to the repo's release branches.
This workflow is used to automatically deploy the latest changes to the host.
Code Coverage
how it works
Jest coverage reports are created in the coverage folder in lcov format, defined in the jest.preset.js
- Reports are generated using the --coverage flag on the jest test command (nx test or nx run-many --target=test), these reports are located in /coverage folder.
- These reports are then sent to Codecov through the Github action codecov/codecov-action@v2
- Coverage reports can then be previewed on https://codecov.io/gh/COS-301/graduates or by clicking the badge in the README