diff --git a/.build.yml b/.build.yml
new file mode 100644
index 0000000000000000000000000000000000000000..79061c07b418b51fca6e40280287bbd2a97c4f15
--- /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 23dbe2b00365b80eac50f2e76b77ea70ac45796b..0000000000000000000000000000000000000000
--- 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 0000000000000000000000000000000000000000..ed3ae00513fdc9488283866254e4160dd8110dc4
--- /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
rename from main.py
rename to jnfilter/main.py
index 1f909b0b8e5a89fb1241094d1ad906469c8968fd..9795b8cd1f470689f01eafc7e8f1af3092295c9c 100644
--- a/main.py
+++ b/jnfilter/main.py
@@ -1,11 +1,13 @@
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()
@@ -87,3 +89,6 @@
@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 092f079d3dd2bf9c4e743c7681767edc87b415b5..0000000000000000000000000000000000000000
--- 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 0000000000000000000000000000000000000000..96868e598f0a49eedf64aa4fa9bf060539da141f
--- /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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
Binary files /dev/null and b/test/dev-requirements.txt differ
diff --git a/test/test_main.py b/test/test_main.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
Binary files /dev/null and b/test/test_main.py differ