diff options
-rw-r--r-- | .build.yml | 24 | ||||
-rw-r--r-- | .gitlab-ci.yml | 14 | ||||
-rw-r--r-- | Makefile | 15 | ||||
-rw-r--r-- | jnfilter/main.py (renamed from main.py) | 9 | ||||
-rw-r--r-- | requirements.txt | 3 | ||||
-rw-r--r-- | setup.py | 23 | ||||
-rw-r--r-- | test/dev-requirements.txt | 0 | ||||
-rw-r--r-- | test/test_main.py | 0 |
8 files changed, 69 insertions, 19 deletions
diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000..79061c0 --- /dev/null +++ b/.build.yml @@ -0,0 +1,24 @@ +image: fedora/36 +packages: + - rsync + - make + +secrets: + - 008c4f67-b864-47f8-9790-cd32f2ae8516 + +environment: + deploy: builds@gabrielgio.me + +tasks: + - deps: | + cd jnfilter + make install_deps + - build: | + cd jnfilter + make + - deploy: | + cd jnfilter + sshopts="ssh -o StrictHostKeyChecking=no" + rsync --rsh="$sshopts" -rP dist/*.rpm $deploy:/var/www/artifacs.gabrielgio.me/jnfilter/ + + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 23dbe2b..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,14 +0,0 @@ -pages: - image: - name: pandoc/alpine - entrypoint: - - "" - stage: build - script: - - mkdir public - - pandoc -s --include-in-header=docs/bamboo.min.css -s README.md -o public/index.html - artifacts: - paths: - - public - only: - - master diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ed3ae00 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ + +rpm: rpm_dist + rpmbuild -bb \ + ./build/bdist.linux-x86_64/rpm/SPECS/jnfilter.spec \ + --define "_topdir $(PWD)/build/bdist.linux-x86_64/rpm/" + +rpm_dist: + python setup.py bdist_rpm + +clean: + python setup.py clean --all + rm -rf dist jnfilter.egg-info + +install_deps: + dnf install -y rpmdevtools rpmlint python diff --git a/main.py b/jnfilter/main.py index 1f909b0..9795b8c 100644 --- a/main.py +++ b/jnfilter/main.py @@ -1,12 +1,14 @@ import re +import httpx +import uvicorn + from functools import reduce from typing import List, Iterator from xml.etree.ElementTree import ElementTree, fromstring, tostring, register_namespace - -import httpx from fastapi import FastAPI from starlette.responses import Response, PlainTextResponse + app = FastAPI() URL = "https://jovemnerd.com.br/feed-nerdcast/" @@ -87,3 +89,6 @@ async def titles(): @app.get("/series") async def titles(): return [i[0] for i in RegexCollection.items()] + +def run(): + uvicorn.run(app=app, host="0.0.0.0", port=32000) diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 092f079..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -httpx==0.21.1 -fastapi==0.70.0 -uvicorn==0.15.0 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..96868e5 --- /dev/null +++ b/setup.py @@ -0,0 +1,23 @@ +from setuptools import setup + +requirements = [ + 'httpx==0.21.1', + 'fastapi==0.70.0', + 'uvicorn==0.15.0' +] + + +setup(name='jnfilter', + version='0.2.0', + description='A FastAPI server to filter Nercast podcast feed', + url='https://git.sr.ht/~gabrielgio/jnfilter', + author='Gabriel Arakaki Giovanini', + author_email='mail@gabrielgio.me', + license='MIT', + packages=['jnfilter'], + entry_points=""" + [console_scripts] + jnfilterd=jnfilter.main:run + """, + install_requires=requirements, + zip_safe=False) diff --git a/test/dev-requirements.txt b/test/dev-requirements.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/dev-requirements.txt diff --git a/test/test_main.py b/test/test_main.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/test_main.py |