Compare commits

...

5 Commits

Author SHA1 Message Date
4361a7fdd9 Añadir .dockerignore 2026-02-01 22:32:59 +00:00
90d236e8f0 Actualizar .gitignore 2026-02-01 22:30:48 +00:00
eb07818665 Actualizar .gitea/workflows/ci.yaml 2026-02-01 22:30:11 +00:00
981d6f4e27 excluded tests folder from linting 2026-02-01 19:58:58 +01:00
d70aee8b10 Fixed pytest coverage report project name bug 2026-02-01 19:57:56 +01:00
4 changed files with 28 additions and 12 deletions

8
.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
.git
.venv
__pycache__
.pytest_cache
tests
.coverage
devcontainer.json
.devcontainer

View File

@@ -2,7 +2,7 @@ name: CI/CD Pipeline
on: on:
push: push:
branches: [main] branches: ['**']
tags: ['v*'] tags: ['v*']
pull_request: pull_request:
@@ -27,22 +27,31 @@ jobs:
run: poetry run ruff check . run: poetry run ruff check .
- name: Run Tests with Coverage - name: Run Tests with Coverage
run: poetry run pytest --cov=my_project --cov-report=term-missing --cov-fail-under=80 run: poetry run pytest --cov --cov-report=term-missing --cov-fail-under=80
publish-container: publish-container:
needs: test-and-lint needs: test-and-lint
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Prepare Docker Metadata
id: meta
run: |
echo "REGISTRY_HOST=${GITEA_SERVER_URL#*://}" >> $GITHUB_OUTPUT
echo "IMAGE_NAME=$(echo ${{ gitea.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
env:
GITEA_SERVER_URL: ${{ gitea.server_url }}
- name: Login to Gitea Container Registry - name: Login to Gitea Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
registry: ${{ gitea.server_url }} registry: ${{ steps.meta.outputs.REGISTRY_HOST }}
# Nota: Quita 'https://' si server_url lo incluye y falla, suele ser solo dominio:puerto username: ${{ github.actor }}
username: ${{ gitea.actor }} password: ${{ secrets.PACKAGES_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image - name: Build and Push Docker Image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
@@ -50,5 +59,5 @@ jobs:
context: . context: .
push: true push: true
tags: | tags: |
${{ gitea.server_url }}/${{ gitea.repository }}:latest ${{ steps.meta.outputs.REGISTRY_HOST }}/${{ steps.meta.outputs.IMAGE_NAME }}:latest
${{ gitea.server_url }}/${{ gitea.repository }}:${{ gitea.ref_name }} ${{ steps.meta.outputs.REGISTRY_HOST }}/${{ steps.meta.outputs.IMAGE_NAME }}:${{ gitea.ref_name }}

1
.gitignore vendored
View File

@@ -2,7 +2,6 @@
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
*$py.class *$py.class
poetry.lock
# --- Distribución y Build --- # --- Distribución y Build ---
dist/ dist/
build/ build/

View File

@@ -22,7 +22,7 @@ build-backend = "poetry.core.masonry.api"
[tool.ruff] [tool.ruff]
line-length = 88 line-length = 88
target-version = "py314" target-version = "py314"
exclude = ["tests"]
[tool.ruff.lint] [tool.ruff.lint]
# E/F: Errores base, I: Imports (isort), D: Docstrings # E/F: Errores base, I: Imports (isort), D: Docstrings
select = ["E", "F", "I", "D"] select = ["E", "F", "I", "D"]