Repository: Zapix/mtpylon (language: python)

Issue:
Configure deploy package and documentation
- [x] Configure deploy of package to pypi on tag release
- [x] Configure deploy of documentation to readthedocs on tag relase
- [x] Configure upload coverage to codecov
- [x] Configure coverage badge on commit
- [x] Configure badge with version on tag release


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/python-package.yml b/.github/workflows/deploy-pypi.yml
similarity index 66%
rename from .github/workflows/python-package.yml
rename to .github/workflows/deploy-pypi.yml
index f50c10b..bbcbe7d 100644
--- a/.github/workflows/python-package.yml
+++ b/.github/workflows/deploy-pypi.yml
@@ -1,10 +1,8 @@
-name: Python package
+name: Deploy Pypi
 
 on:
-  push:
-    branches: [ dev ]
-  pull_request:
-    branches: [ dev ]
+  release:
+    types: [released]
 
 jobs:
   build:
@@ -23,7 +21,7 @@ jobs:
     - name: Install dependencies
       run: |
         python -m pip install --upgrade pip
-        pip install flake8 pytest mypy
+        pip install flake8 pytest mypy pytest-cov
         if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
     - name: Lint with flake8
       run: |
@@ -37,3 +35,22 @@ jobs:
     - name: Test with pytest
       run: |
         pytest
+    - name: Install pypa/build
+      run: >-
+        python -m
+        pip install
+        build
+        --user
+    - name: Build a binary wheel and a source tarball
+      run: >-
+        python -m
+        build
+        --sdist
+        --wheel
+        --outdir dist/
+    - name: Deploy to PyPi
+      uses: pypa/gh-action-pypi-publish@master
+      with:
+        password: ${{ secrets.PYPI_API_TOKEN }}
+
+
diff --git a/README.md b/README.md
index 2e32e33..de67b66 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,5 @@
 # mtpylon
 Library to build backend with MTProto's protocol
+
+![Running Tests](https://github.com/Zapix/mtpylon/workflows/Running%20Tests/badge.svg)
+[![codecov](https://codecov.io/gh/Zapix/mtpylon/branch/dev/graph/badge.svg?token=4TWNMM7PCP)](https://codecov.io/gh/Zapix/mtpylon)


Test patch:
diff --git a/.github/workflows/deploy-test-pypi.yml b/.github/workflows/deploy-test-pypi.yml
new file mode 100644
index 0000000..e294857
--- /dev/null
+++ b/.github/workflows/deploy-test-pypi.yml
@@ -0,0 +1,57 @@
+name: Deploy Test Pypi
+
+on:
+  release:
+    types: [prereleased]
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: [3.9]
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install flake8 pytest mypy pytest-cov
+        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+    - name: Lint with flake8
+      run: |
+        # stop the build if there are Python syntax errors or undefined names
+        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
+        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
+        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
+    - name: Chek types with pychek
+      run: |
+        mypy mtpylon tests
+    - name: Test with pytest
+      run: |
+        pytest
+    - name: Install pypa/build
+      run: >-
+        python -m
+        pip install
+        build
+        --user
+    - name: Build a binary wheel and a source tarball
+      run: >-
+        python -m
+        build
+        --sdist
+        --wheel
+        --outdir dist/
+    - name: Deploy To Test PyPi
+      uses: pypa/gh-action-pypi-publish@master
+      with:
+        password: ${{ secrets.TEST_PYPI_API_TOKEN }}
+        repository_url: https://test.pypi.org/legacy/
+
+
diff --git a/.github/workflows/running-tests.yml b/.github/workflows/running-tests.yml
new file mode 100644
index 0000000..51ab12f
--- /dev/null
+++ b/.github/workflows/running-tests.yml
@@ -0,0 +1,49 @@
+name: Running Tests
+
+on: [push]
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: [3.9]
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install flake8 pytest mypy pytest-cov
+        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+    - name: Lint with flake8
+      run: |
+        # stop the build if there are Python syntax errors or undefined names
+        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
+        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
+        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
+    - name: Chek types with pychek
+      run: |
+        mypy mtpylon tests
+    - name: Test with pytest
+      run: |
+        pytest --cov=./ --cov-report=xml
+    - name: Show structure
+      run: |
+        ls -al
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v1.2.1
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        files: ./coverage.xml
+        flags: unittests
+        env_vars: OS,PYTHON
+        name: codecov-umbrella
+        fail_ci_if_error: true
+        path_to_write_report: ./coverage/codecov_report.txt
+        verbose: true