aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2022-06-26 15:50:22 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2022-06-26 17:37:27 +0200
commit5e00f7eb42f2c533bd0b99acba5a2b8b0e9829fb (patch)
tree2219077e2356ef97768f1344d76bd129d57995e7
parent0d5ae1108e33fe9a6f5b6f7e7414bc933cf2891a (diff)
downloadjnfilter-5e00f7eb42f2c533bd0b99acba5a2b8b0e9829fb.tar.gz
jnfilter-5e00f7eb42f2c533bd0b99acba5a2b8b0e9829fb.tar.bz2
jnfilter-5e00f7eb42f2c533bd0b99acba5a2b8b0e9829fb.zip
feat: Adiocina processo na pipeline para gerar rpm
Esse vai ser a forma padrao de dar deploy no `gabrielgio.me`.
-rw-r--r--.build.yml24
-rw-r--r--.gitlab-ci.yml14
-rw-r--r--Makefile15
-rw-r--r--jnfilter/main.py (renamed from main.py)9
-rw-r--r--requirements.txt3
-rw-r--r--setup.py23
-rw-r--r--test/dev-requirements.txt0
-rw-r--r--test/test_main.py0
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