From 579f002203ea2e77d3a064a57f7a88e7ddbec9fb Mon Sep 17 00:00:00 2001 From: Oyhs-co Date: Sun, 6 Apr 2025 13:20:50 -0500 Subject: [PATCH 1/5] refactor: migrate the project from Go to Python for some microservices - se eliminaron archivos go.mod y main.go de algunos microservicios - se migra todo el backend a python --- backend/api/Auth-service/{go.mod => app.py} | 0 .../api/{Auth-service/src/main.go => Documents-service/app.py} | 0 backend/api/Gateway/{go.mod => app.py} | 0 backend/api/Notifications-service/{go.mod => app.py} | 0 .../src/main.go => Projetcs-service/app.py} | 0 backend/index.md | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename backend/api/Auth-service/{go.mod => app.py} (100%) rename backend/api/{Auth-service/src/main.go => Documents-service/app.py} (100%) rename backend/api/Gateway/{go.mod => app.py} (100%) rename backend/api/Notifications-service/{go.mod => app.py} (100%) rename backend/api/{Notifications-service/src/main.go => Projetcs-service/app.py} (100%) create mode 100644 backend/index.md diff --git a/backend/api/Auth-service/go.mod b/backend/api/Auth-service/app.py similarity index 100% rename from backend/api/Auth-service/go.mod rename to backend/api/Auth-service/app.py diff --git a/backend/api/Auth-service/src/main.go b/backend/api/Documents-service/app.py similarity index 100% rename from backend/api/Auth-service/src/main.go rename to backend/api/Documents-service/app.py diff --git a/backend/api/Gateway/go.mod b/backend/api/Gateway/app.py similarity index 100% rename from backend/api/Gateway/go.mod rename to backend/api/Gateway/app.py diff --git a/backend/api/Notifications-service/go.mod b/backend/api/Notifications-service/app.py similarity index 100% rename from backend/api/Notifications-service/go.mod rename to backend/api/Notifications-service/app.py diff --git a/backend/api/Notifications-service/src/main.go b/backend/api/Projetcs-service/app.py similarity index 100% rename from backend/api/Notifications-service/src/main.go rename to backend/api/Projetcs-service/app.py diff --git a/backend/index.md b/backend/index.md new file mode 100644 index 0000000..e69de29 From 5af938139e4c96d5c67a4d375fc42aaba3c51f40 Mon Sep 17 00:00:00 2001 From: Oyhs-co Date: Sun, 6 Apr 2025 13:38:11 -0500 Subject: [PATCH 2/5] =?UTF-8?q?ci:=20add=20Flake8=20linter=20workflow=20-?= =?UTF-8?q?=20se=20a=C3=B1adio=20flake8.yml=20y=20su=20configuracion=20-?= =?UTF-8?q?=20se=20a=C3=B1adio=20.flake8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/flake8.yml | 22 ++++++++++++++++++++++ backend/.flake8 | 3 +++ 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/flake8.yml create mode 100644 backend/.flake8 diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml new file mode 100644 index 0000000..9e6894d --- /dev/null +++ b/.github/workflows/flake8.yml @@ -0,0 +1,22 @@ +name: Flake8 Linter + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.13.2' + + - name: Install dependencies + run: | + pip install flake8 + + - name: Run Flake8 + run: flake8 . \ No newline at end of file diff --git a/backend/.flake8 b/backend/.flake8 new file mode 100644 index 0000000..6a500ec --- /dev/null +++ b/backend/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length = 88 +exclude = .git,__pycache__,venv,*.egg,build,dist,.tox,.mypy_cache,.pytest_cache,.venv,*.pyc,*.pyo,*.pyd,.env,.venv,*.db,*.sqlite3,*.log,.coverage,.hypothesis \ No newline at end of file From 737fe3035f027e63cfebfd99b66eaaf1bf691a09 Mon Sep 17 00:00:00 2001 From: Oyhs-co Date: Sat, 12 Apr 2025 08:51:21 -0500 Subject: [PATCH 3/5] ci: add SonarCloud configuration for code quality analysis --- .github/workflows/sonar.yml | 48 +++++++++++++++++++++++++++++++++++++ sonar-project.properties | 18 ++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/sonar.yml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 0000000..2b27545 --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,48 @@ +name: Monorepo Test & SonarCloud + +on: + push: + branches: [ main , Development ] + pull_request: + types: [opened, synchronize, reopened] + +jobs: + sonarcloud: + name: Unified Coverage + SonarCloud + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install global test deps + run: | + python -m pip install --upgrade pip + pip install pytest pytest-cov + + - name: Install service dependencies + run: | + pip install -r auth-service/requirements.txt + pip install -r project-service/requirements.txt + pip install -r notification-service/requirements.txt + + - name: Run all tests with per-service coverage + run: | + pytest \ + --cov=auth-service \ + --cov=project-service \ + --cov=notification-service \ + --cov-report=xml \ + auth-service/tests project-service/tests notification-service/tests + + - name: SonarCloud Analysis + uses: SonarSource/sonarcloud-github-action@v2 + with: + projectBaseDir: . + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..275874e --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,18 @@ +sonar.projectKey=ISCODEVUTB_TaskHub +sonar.organization=deviscoutb +sonar.host.url=https://sonarcloud.io +sonar.token=${SONAR_TOKEN} + +# Incluye todos los microservicios +sonar.sources=auth-service,project-service,notification-service +sonar.tests=auth-service/tests,project-service/tests,notification-service/tests + +# Incluir solo archivos de test dentro de tests/ +sonar.test.inclusions=**/tests/**/*.py + +# Excluir posibles archivos compilados o cachés +sonar.exclusions=**/__pycache__/**,**/*.pyc + +# Coverage report +# Lo ideal es un coverage.xml generado de forma combinada +sonar.python.coverage.reportPaths=coverage.xml From 36ecae046438b9608a23ebc2997f999c109b5468 Mon Sep 17 00:00:00 2001 From: Oyhs-co Date: Sat, 12 Apr 2025 08:56:38 -0500 Subject: [PATCH 4/5] fix: add condition to install service dependencies --- .github/workflows/sonar.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 2b27545..679bd51 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -26,6 +26,7 @@ jobs: pip install pytest pytest-cov - name: Install service dependencies + if: ${{ github.event_name == 'null' }} run: | pip install -r auth-service/requirements.txt pip install -r project-service/requirements.txt From ce0974872970a71916b202b871aaef8c93bad191 Mon Sep 17 00:00:00 2001 From: Oyhs-co Date: Sat, 12 Apr 2025 08:59:24 -0500 Subject: [PATCH 5/5] fix: update Python version to 3.13 in SonarCloud workflow --- .github/workflows/sonar.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 679bd51..47dfa76 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.13' - name: Install global test deps run: | @@ -33,6 +33,7 @@ jobs: pip install -r notification-service/requirements.txt - name: Run all tests with per-service coverage + if: ${{ github.event_name == 'null' }} run: | pytest \ --cov=auth-service \