22 Commits
Author SHA1 Message Date
Pierre Geeraert 4d728c8e68 addign this for the syntax but this solution is too slow
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Gitea Actions Demo / changes (push) Has been cancelled
Gitea Actions Demo / Build-dockerfile (push) Has been cancelled
2025-12-04 16:44:46 +00:00
Pierre Geeraert ef3aed4ba2 Good now , but still long, let's try again
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m52s
2025-12-04 16:24:33 +00:00
Pierre Geeraert 8f30fdb88c should be good now
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m53s
2025-12-04 16:16:31 +00:00
Pierre Geeraert d4b67906cd try again the path
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 9m29s
2025-12-04 16:03:56 +00:00
Pierre Geeraert 075fa32ea2 shunt as I need this to run to debug first
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m20s
2025-12-04 16:00:50 +00:00
Pierre Geeraert f71f678662 fix path
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 16:00:02 +00:00
Pierre Geeraert 457857df32 changing gitignore
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m7s
2025-12-04 15:57:03 +00:00
Pierre Geeraert 49adc84f5c cache issue 2025-12-04 15:56:33 +00:00
Pierre Geeraert a2a9a8c3a0 renaming dockerfile
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m16s
2025-12-04 15:53:11 +00:00
Pierre Geeraert a62db898aa fixing path
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m14s
2025-12-04 15:50:08 +00:00
Pierre Geeraert a2a6e5c5fe avoid runnign if requirements is modified
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m20s
2025-12-04 15:15:28 +00:00
Pierre Geeraert b9307efba2 work on a different workflow just for requirements 2025-12-04 15:06:03 +00:00
Pierre Geeraert 52ccff4086 try different caching method
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4m40s
2025-12-04 14:24:29 +00:00
Pierre Geeraert 7f59856da3 adding share_task
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 14:21:26 +00:00
Pierre Geeraert 10dc913080 adding the check_and_create_destination_folder function but not applied yet to incremental
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 14:17:09 +00:00
Pierre Geeraert 1d2f190459 rename url var
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5m17s
2025-12-04 11:42:14 +00:00
Pierre Geeraert 859ab9cfaf add proxy on the othe rrequest as well
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m9s
2025-12-04 11:34:32 +00:00
Pierre Geeraert 924d3dabb9 add proxy on requests module
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4m15s
2025-12-03 12:41:50 +00:00
Pierre Geeraert b227337ced 1.526 SyntaxError: expected ':'
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m2s
2025-12-03 12:27:18 +00:00
Pierre Geeraert 717ffb4b8a urlparse was its own built-in (i.e., NOT pip-installable) module in Python 2, and was moved to urllib.parse
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 4m45s
2025-12-03 12:17:13 +00:00
Pierre Geeraert 08121fc701 remove Webcal-python/
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 3m55s
2025-12-03 12:10:01 +00:00
Pierre Geeraert 460f18d85a add proxy for the first part and try to develop the second part 2025-12-03 12:08:56 +00:00
9 changed files with 193 additions and 32 deletions
+16
View File
@@ -0,0 +1,16 @@
FROM gitea.tryton.geeraert.eu/pi-ux-ce/python:3
ENV PYTHONUNBUFFERED 1
WORKDIR /code/
# Copy only the requirements file first (Changes infrequently)
COPY requirements.txt ./
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip
RUN --mount=type=cache,target=/root/.cache/pip pip list --outdated
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade wheel
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade setuptools
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
+15
View File
@@ -0,0 +1,15 @@
django
psycopg2
requests
proxmoxer
docker
kubernetes
ruamel.yaml
pyyaml
django-bootstrap-v5
jinja2
watchdog
celery
redis
lxml
requests
+84 -4
View File
@@ -2,10 +2,89 @@ name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
push:
#paths-ignore:
# - 'requirements.txt'
issue_comment:
types: [created]
jobs:
# Job to check for file changes and set an output
changes:
runs-on: ubuntu-latest
outputs:
requirements_changed: ${{ steps.filter.outputs.requirements }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
requirements:
- 'requirements.txt'
Build-dockerfile:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.requirements_changed == 'true' }}
steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Compute next version
id: versioning
run: |
latest="${{ vars.PYTHON_VERSION }}"
next_version=$(echo "$latest" | awk -F. -v OFS=. '{$NF += 1 ; print}')
echo "next_version=$next_version" >> $GITHUB_ENV
echo "Variables used :"
echo "------------------------------------------------"
echo "Next version: $next_version"
- uses: actions/cache@v3
with:
path: /root/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
cache-source: /root/.cache/pip
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to gitea
uses: docker/login-action@v3
with:
registry: gitea.tryton.geeraert.eu
username: ${{ secrets.USERNAME_GITEA }}
password: ${{ secrets.PASSWORD_GITEA }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:.gitea/python_build"
push: true
tags: |
gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:latest
gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:${{ env.next_version }}
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:buildcache
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:buildcache,mode=max
- name: update version in the variable
run: |
curl -X PUT -H "Content-Type: application/json" \
--user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
https://gitea.tryton.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/PYTHON_VERSION \
-d "{\"Value\":\"$next_version\"}"
Explore-Gitea-Actions:
runs-on: ubuntu-latest
steps:
@@ -27,12 +106,13 @@ jobs:
echo "------------------------------------------------"
echo "Next version: $next_version"
- name: Cache pip
uses: actions/cache@v3
- uses: actions/cache@v3
with:
path: /root/.cache/pip
key: pip
restore-keys: pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
+2
View File
@@ -2,3 +2,5 @@
*/.idea
venv/*
*__pycache__*
Webcal-python/*
.idea/*
+57 -7
View File
@@ -16,6 +16,11 @@ import mimetypes
import ruamel.yaml
import yaml
from urllib import request as urlrequest
from urllib import parse as urlparse
proxy_url = 'http://gluetun-svc.gluetun.svc:8888'
proxy = urlrequest.ProxyHandler({
@@ -23,7 +28,12 @@ proxy = urlrequest.ProxyHandler({
'https': proxy_url # Add the handler for HTTPS
})
destination_folder = "/tmp/stash"
proxies = {
"http" : proxy_url,
"https" : proxy_url
}
destination_folder = "/tmp/stash/"
def hello(request):
return HttpResponse('<h1>Hello stash!</h1>')
@@ -32,23 +42,45 @@ def form(request):
def album(request):
return render(request, 'album_form.html',{})
def check_and_create_destination_folder(name):
#check if the output directory exist and create if not
if not os.path.isdir(destination_folder):
os.makedirs(destination_folder)
#check if the named directory exist and create if not
destination_named_folder = os.path.join(destination_folder,name)
if not os.path.isdir(destination_named_folder):
os.makedirs(destination_named_folder)
return destination_named_folder
def album_form(request):
name = request.GET.get('name')
url = request.GET.get('url')
external_galleries = request.GET.get('external_galleries')
album_downloader(name=name,url=url,external_galleries=external_galleries)
album_downloader.delay(name=name,url=url,external_galleries=external_galleries)
text_generated = "successfully sent to the album downloader"
return HttpResponse(text_generated, content_type="text/plain")
@shared_task()
def album_downloader(name,url,external_galleries):
print(name+" "+url+" "+external_galleries)
opener = urlrequest.build_opener(proxy)
urlrequest.install_opener(opener)
req = urlrequest.Request(url)
urlcurl = urlrequest.urlopen(req).read()
page = requests.get(url)
page = requests.get(url,proxies=proxies)
webpage = html.fromstring(page.content)
#create the prerequisites folder
destination_named_folder = check_and_create_destination_folder(name=name)
#get all URLs from the code source (searching for href tag on the code)
#https://stackoverflow.com/questions/21455349/xpath-query-get-attribute-href-from-a-tag
@@ -57,18 +89,36 @@ def album_downloader(name,url,external_galleries):
#search for the href that contains the galleries
webpage_all_album_url = webpage.xpath("//a[contains(@href,'pornpics.com/galleries/')]/@href")
#print(webpage_all_album_url[3])
#print(webpage_all_album_url)
#print(webpage_all_album_url)
for album in webpage_all_album_url:
print("Album "+album)
print("")
page = requests.get(album)
page = requests.get(album,proxies=proxies)
webpage = html.fromstring(page.content)
print(webpage.xpath("//a[contains(@href,'cdni.pornpics.com/1280/')]/@href"))
images_list = webpage.xpath("//a[contains(@href,'cdni.pornpics.com/1280/')]/@href")
images_downloader.delay(name=name,images_url_list=images_list,destination_named_folder=destination_named_folder)
print(images_list)
return 0
@shared_task()
def images_downloader(name,images_url_list,destination_named_folder):
for image_url in images_url_list:
split = urlparse.urlsplit(image_url)
#filename = destination_folder + split.path.split("/")[-1]
filename = os.path.join(destination_named_folder,split.path.split("/")[-1])
print("downloading: "+filename+" -- "+image_url)
opener = urlrequest.build_opener(proxy)
urlrequest.install_opener(opener)
urlrequest.urlretrieve(image_url, filename )
return 0
def incremental(request):
return render(request, 'incremental_form.html',{})
@@ -10915,7 +10915,6 @@
<div class="col mb-5">
<div class="card h-100">
<!-- Sale badge-->
<div class="badge bg-dark text-white position-absolute" style="top: 0.5rem; right: 0.5rem">Sale</div>
<!-- Product image-->
<img class="card-img-top" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTUHI8m7S7bMhMC2WldjOFV4e9pjeK0m9asEw&s" alt="..." />
<!-- Product details-->
@@ -10941,7 +10940,7 @@
<div class="card-body p-4">
<div class="text-center">
<!-- Product name-->
<h5 class="fw-bolder">Popular Item</h5>
<h5 class="fw-bolder">Celeb CX ????</h5>
<!-- Product reviews-->
<div class="d-flex justify-content-center small text-warning mb-2">
<div class="bi-star-fill"></div>
@@ -10951,7 +10950,7 @@
<div class="bi-star-fill"></div>
</div>
<!-- Product price-->
$40.00
https://celeb.cx
</div>
</div>
<!-- Product actions-->
@@ -10963,17 +10962,15 @@
<div class="col mb-5">
<div class="card h-100">
<!-- Sale badge-->
<div class="badge bg-dark text-white position-absolute" style="top: 0.5rem; right: 0.5rem">Sale</div>
<!-- Product image-->
<img class="card-img-top" src="https://dummyimage.com/450x300/dee2e6/6c757d.jpg" alt="..." />
<img class="card-img-top" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRlAP1QLW33zVG3dF-EmGalwc7L0uMUJEzRBA&s" alt="..." />
<!-- Product details-->
<div class="card-body p-4">
<div class="text-center">
<!-- Product name-->
<h5 class="fw-bolder">Sale Item</h5>
<h5 class="fw-bolder">Reddit</h5>
<!-- Product price-->
<span class="text-muted text-decoration-line-through">$50.00</span>
$25.00
https://www.reddit.com/
</div>
</div>
<!-- Product actions-->
@@ -10990,7 +10987,7 @@
<div class="card-body p-4">
<div class="text-center">
<!-- Product name-->
<h5 class="fw-bolder">Fancy Product</h5>
<h5 class="fw-bolder">Regifs</h5>
<!-- Product price-->
$120.00 - $280.00
</div>
+11
View File
@@ -0,0 +1,11 @@
services:
db:
image: django:local
restart: always
volumes:
- type: bind
target: /code
source: ./django_code
command: python manage.py runserver 0.0.0.0:7000
ports:
- 7000:7000
+1 -11
View File
@@ -1,19 +1,9 @@
FROM gitea.tryton.geeraert.eu/pi-ux-ce/python:3
FROM gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:latest
ENV PYTHONUNBUFFERED 1
WORKDIR /code/
# Copy only the requirements file first (Changes infrequently)
COPY requirements.txt ./
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip
RUN --mount=type=cache,target=/root/.cache/pip pip list --outdated
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade wheel
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade setuptools
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
# Copy the rest of your application code (Changes frequently, invalidates subsequent cache)
COPY . ./
RUN python django_code/manage.py migrate
+1 -1
View File
@@ -12,4 +12,4 @@ watchdog
celery
redis
lxml
requests
requests