diff --git a/Dockerfile b/Dockerfile index bf9bf448..3fb32d00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.8-alpine -ARG buildDeps='g++ gnupg curl' +ARG buildDeps='g++ gnupg curl libffi-dev openssl-dev' WORKDIR /usr/src/app diff --git a/README.md b/README.md index 0338ae95..9581e61e 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,17 @@ as well as its correspondent options. python cli.py gen_swagger_json -f ~/Downloads/swagger.json ``` +## Semantic versioning + +### Style +We use [angular commit message style](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits) as the standard commit message style. + +### Release +1. The release is automatically done by the [TimeTracker CI](https://dev.azure.com/IOET-DevOps/TimeTracker-API/_build?definitionId=1&_a=summary) although can also be done manually. The variable `GH_TOKEN` is required to post releases to Github. The `GH_TOKEN` can be generated following [these steps](https://help.github.com/es/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). + +2. We use the command `semantic-release publish` after a successful PR to make a release. Check the library +[python-semantic-release](https://python-semantic-release.readthedocs.io/en/latest/commands.html#publish) for details of underlying operations. + ## Run as docker container 1. Build image ```bash diff --git a/requirements/time_tracker_api/prod.txt b/requirements/time_tracker_api/prod.txt index f1221c4a..aad33b0d 100644 --- a/requirements/time_tracker_api/prod.txt +++ b/requirements/time_tracker_api/prod.txt @@ -23,6 +23,9 @@ flask-restplus==0.12.1 #CLI support Flask-Script==2.0.6 +#Semantic versioning +python-semantic-release==5.1.0 + # The Debug Toolbar Flask-DebugToolbar==0.11.0 diff --git a/setup.cfg b/setup.cfg index 824945c8..dd7700da 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,6 +2,10 @@ testpaths = tests addopts = -p no:warnings +[semantic_release] +version_variable = time_tracker_api/__init__.py:__version__ +upload_to_pypi = false + [coverage:run] branch = True source = diff --git a/time_tracker_api/__init__.py b/time_tracker_api/__init__.py index 7b8489e1..ce7c881f 100644 --- a/time_tracker_api/__init__.py +++ b/time_tracker_api/__init__.py @@ -3,6 +3,8 @@ from flask import Flask +__version__ = '0.0.2' + flask_app: Flask = None diff --git a/time_tracker_api/api.py b/time_tracker_api/api.py index 18d19b97..90dec35f 100644 --- a/time_tracker_api/api.py +++ b/time_tracker_api/api.py @@ -5,12 +5,15 @@ from flask import current_app as app from flask_restplus import Api, fields from flask_restplus._http import HTTPStatus +from time_tracker_api import __version__ faker = Faker() -api = Api(version='1.0.1', - title="TimeTracker API", - description="API for the TimeTracker project") +api = Api( + version=__version__, + title="TimeTracker API", + description="API for the TimeTracker project" +) # Common models structure audit_fields = {