Repository: mendrugory/torip (language: python)

Issue:
Github Actions
Update CI with Github actions


Discussion / hints:

Fix patch:
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100755
index 0000000..9b980fa
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,18 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: enhancement, help wanted
+assignees: ''
+
+---
+
+**Describe what you need**
+<!--
+A clear and concise description about what is needed.
+-->
+
+**Proposed solution**
+<!--
+If you have, describe here your proposal.
+-->
diff --git a/.github/workflows/pythonpublish.yaml b/.github/workflows/pythonpublish.yaml
new file mode 100755
index 0000000..9f5f371
--- /dev/null
+++ b/.github/workflows/pythonpublish.yaml
@@ -0,0 +1,28 @@
+name: Upload Python Package
+
+on:
+  release:
+    types: [created]
+
+jobs:
+  publish:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v1
+    - name: Set up Python
+      uses: actions/setup-python@v1
+      with:
+        python-version: '3.x'
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install setuptools wheel twine
+    - name: Build and publish
+      env:
+        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
+        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
+      run: |
+        echo "Deploying version ${{ github.ref }}"
+        sed -i "s|RELEASE_VERSION|${GITHUB_REF/refs\/tags\//}|g" setup.py
+        python setup.py sdist bdist_wheel
+        twine upload dist/*
diff --git a/.gitignore b/.gitignore
index cf8cfdb..a3655f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,3 +62,5 @@ __pycache__
 .
 ..
 *~
+.pipy-token
+.venv
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 1c56404..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-language: python
-python:
-    - "3.3"
-    - "3.4"
-    - "3.5"
-    - "nightly"
-    - "pypy3"
-install: 
-    - pip install -r requirements.txt
-script:
-    - python -m unittest discover test/
diff --git a/README.md b/README.md
index 1dcac23..40da4a1 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,21 @@
 # torip
+
+![tests](https://github.com/mendrugory/torip/actions/workflows/unittest.yaml/badge.svg)
+
 Python library for Tornado web framework to locate IPs or server names.
 
 Torip will provide you information like country, city, zip code or the url of google maps.
 
 Torip has been developed and tested using Python3.4
 
-
 ## Installation
-```console
+
+```bash
 $ pip install torip
 ```
 
 ## Available APIs
+
 Torip supports the following APIs:
 
 ### [ip-api] [IPAPI]
@@ -33,8 +37,8 @@ from torip.locator import Locator
 locator = Locator(api_name='freegeoip')
 ```
 
-
 ## Example
+
 ```python
 import tornado
 from torip.locator import Locator
@@ -54,7 +58,5 @@ ioloop.add_callback(function)
 ioloop.start()
 ```
 
-
-
 [FGI]:<https://freegeoip.net>
 [IPAPI]: <http://ip-api.com/>
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 363a306..2597b20 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,2 @@
 coverage==4.0.1
-tornado==4.2.1
+tornado==6.1
diff --git a/setup.py b/setup.py
index f754bee..08f5c71 100755
--- a/setup.py
+++ b/setup.py
@@ -1,23 +1,22 @@
 #!venv/bin/python
-import os
 from setuptools import setup, find_packages
 
 
-def read(fname):
-    return open(os.path.join(os.path.dirname(__file__), fname)).read()
-
+with open("README.md", "r") as fh:
+    long_description = fh.read()
 
 setup(
     name="torip",
-    version="0.1.5",
-    author="mendrugory",
-    author_email="mendrugory@gmail.com",
+    version="RELEASE_VERSION",
+    author="Gonzalo Gabriel Jiménez Fuentes",
+    author_email="iam@mendrugory.com",
     description="Library for Tornado web framework to locate IPs or server names.",
     license="MIT License",
     keywords="Tornado IP Locate",
     url="https://github.com/mendrugory/torip",
     packages=find_packages(),
-    long_description=read('README.rst'),
+    long_description=long_description,
+    long_description_content_type="text/markdown",
     install_requires=[
         'tornado'
     ],
diff --git a/venv_creation.bash b/venv_creation.bash
new file mode 100755
index 0000000..846ab65
--- /dev/null
+++ b/venv_creation.bash
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+cd "$(dirname "$0")"
+
+rm -rf venv || true
+virtualenv -p /usr/bin/python3 venv
+venv/bin/pip3 install --upgrade pip
+venv/bin/pip3 install -r requirements.txt


Test patch:
diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml
new file mode 100644
index 0000000..46420e0
--- /dev/null
+++ b/.github/workflows/unittest.yaml
@@ -0,0 +1,25 @@
+name: Unit Testing
+
+on:
+  push:
+  pull_request:
+    types: [opened]
+
+jobs:
+  tests:
+    name: "Python ${{ matrix.python-version }}"
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "pypy3"]
+    steps:
+      - uses: actions/checkout@v2
+      - uses: "actions/setup-python@v2"
+        with:
+          python-version: "${{ matrix.python-version }}"
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install -r requirements.txt
+      - name: Run tests
+        run: python -m unittest discover test/ 
\ No newline at end of file
diff --git a/test/test_torip.py b/test/test_torip.py
index c277d1f..9187e4d 100644
--- a/test/test_torip.py
+++ b/test/test_torip.py
@@ -34,13 +34,7 @@ def test_google_maps_url(self):
     def test_ip_api(self):
         locator = IpApi(self.io_loop)
         result = yield locator.locate(self.ip_api_ip)
-        self.assertEqual('Amsterdam', result['city'])
-
-    @tornado.testing.gen_test
-    def test_freegeoip(self):
-        locator = FreeGeoIp(self.io_loop)
-        result = yield locator.locate(self.ip_freegeoip)
-        self.assertEqual('New York', result['city'])
+        self.assertEqual('Ashburn', result['city'])
 
     @tornado.testing.gen_test
     def test_ip_api_private_address(self):