Source code management¶
Git is a version control system for tracking changes in computer files or a folder and coordinating work on those files among multiple people.
Git/Version Control System is the basic tool in software development.
The main purpose of Git is to manage software development projects and its files, as they are changing over time. It stores the information in a repository.
To install git check this .
GitHub is a web-based hosting service for version control using Git. It provides access control and several collaboration features such as issue tracking, feature requests, documentation, and wikis for every project.
With git, we can collaborate with other developers, track all our work via commits, and revert to any previous version of our code even if we accidentally delete something.
GitHub projects can be public or private and every publicly shared code is freely open to everyone. We can have private projects as well, though, they require a paid GitHub plan. Public repositories on Github are often used to share Open Source Software
It is the most-widely used web-based hosting service, and it has the largest number of open-source projects.
GitLab is a web-based and self-based hosting service for version control using Git. Gitlab is free and open-source.
Gitlab offers unlimited free public/private repositories, where as Github offers unlimited public repositories only(private repositories require a paid plan)
GitLab offers all the features of Github plus builtin CI/CD service (Continuous Integration & Continuous Delivery), and more authentication levels.
Gitlab(Community Edition) is open-source and can be installed in private servers.
Continuous Integration (CI) is a development practice which automates the build and testing process of the code. Continuous Integration automates the build and testing processes. The main objective of CI is to test code for every push made to the repository. We need to have a testing framework for the test in CI.
Each push is verified by an automated build and tests, individual changes are immediately tested and reported on when they are added to a repository, allowing developers to detect problems early.
CI encourages developers to integrate their code into a main branch of a shared repository. Instead of building out features in isolation and integrating them at the end of a development cycle, code is integrated with the shared repository by each developer multiple times throughout the day.
CI makes code integration a simple, fast process that is part of the everyday development workflow in order to reduce integration costs and respond to defects early.
Gitlab Continuous Integration(CI) is a open-source CI service that is included in gitlab and can be used for all projects in gitlab.
To use GitLab CI, you first need to add a
.gitlab-ci.yml file to the root directory of your repository, as well as configure your GitLab project to use a Runner. Afterwards, every commit or push will trigger the CI pipeline that has three stages: build, test and deploy.
To set up .gitlab-ci.yml file follow this official doc
Circleci is a cloud-based continuous integration server. It supports containers, OSX, Linux and can run within a private cloud or our own data center. that supports any language that builds on Linux or macOS.
It is available in both cloud-based and self-hosted.
- Setting up CircleCI:
- Sign-in to circleci.com and link your project.
- After that activate the service hook to that repo in the profile page of cirlceci .
- Add circle.yml to the project
Travis CI is a hosted continous integration service used to build and test the projects hosted at github.com. It is free for all open-source projects hosted on Github.com .
Travis CI builds and runs the tests every time we push the code to the github repo or put a pull request to the repo.
To use travis-ci we must add a file
.travis.yml to our repository. And link our github account with travis-ci by logging in to travis-ci website
language: python python: - 2.7 - 3.6 # command to install dependencies install: - pip install -r requirements.txt # command to run tests script: - pytest # or py.test To test for Python versions 3.5 and below branches: - master - dev
This file will get our project tested on all the listed Python versions by running the given script, and it will build the master and dev branch only.
The CI Environment uses separate virtualenv instances for each Python version.
By default Travis CI uses
pip to manage Python dependencies. If you have a requirements.txt file, Travis CI runs
pip install -r requirements.txt during the
install phase of the build.
Python projects need to provide the
script key in their .travis.yml to specify what command to run tests with.