CI: workflow con tests del proyecto y lint de soluciones#7
Merged
Conversation
Guía para revisoresAgrega un flujo de trabajo de CI de GitHub Actions que ejecuta pruebas y linting para el proyecto loganalyzer y realiza linting del código de soluciones del curso usando uv, ruff y pytest en los push a main y en las pull requests. Diagrama de flujo para el nuevo flujo de trabajo de CI de GitHub Actionsflowchart LR
Trigger[Push to main or Pull request]
Trigger --> JobTestLoganalyzer[Test job test-loganalyzer]
Trigger --> JobLintSoluciones[Lint job lint-soluciones]
subgraph TestLoganalyzer
A1[Checkout repo]
A2[Install uv]
A3[Install Python 3.12]
A4[uv sync --group dev in proyecto]
A5[uv run ruff check src tests]
A6[uv run pytest -v]
A1 --> A2 --> A3 --> A4 --> A5 --> A6
end
subgraph LintSoluciones
B1[Checkout repo]
B2[Install uv]
B3[Install Python 3.12]
B4[uv sync --group dev at repo root]
B5[uv run ruff check modulo-*/soluciones/]
B1 --> B2 --> B3 --> B4 --> B5
end
Cambios a nivel de archivo
Consejos y comandosInteractuar con Sourcery
Personalizar tu experienciaAccede a tu panel de control para:
Obtener ayuda
Original review guide in EnglishReviewer's GuideAdds a GitHub Actions CI workflow that runs tests and linting for the loganalyzer project and lints course solution code using uv, ruff, and pytest on pushes to main and pull requests. Flow diagram for the new GitHub Actions CI workflowflowchart LR
Trigger[Push to main or Pull request]
Trigger --> JobTestLoganalyzer[Test job test-loganalyzer]
Trigger --> JobLintSoluciones[Lint job lint-soluciones]
subgraph TestLoganalyzer
A1[Checkout repo]
A2[Install uv]
A3[Install Python 3.12]
A4[uv sync --group dev in proyecto]
A5[uv run ruff check src tests]
A6[uv run pytest -v]
A1 --> A2 --> A3 --> A4 --> A5 --> A6
end
subgraph LintSoluciones
B1[Checkout repo]
B2[Install uv]
B3[Install Python 3.12]
B4[uv sync --group dev at repo root]
B5[uv run ruff check modulo-*/soluciones/]
B1 --> B2 --> B3 --> B4 --> B5
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hola, he dejado algunos comentarios de alto nivel:
- Considera extraer los pasos duplicados
setup-uv+uv python install+uv syncentretest-loganalyzerylint-soluciones(por ejemplo, mediante una acción compuesta o un workflow reutilizable) para mantener la configuración de CI DRY y más fácil de evolucionar. - Ya que
test-loganalyzerdepende deproyecto/, quizá quieras proteger ese job con una condición (por ejemplo, unifsobrehashFiles('proyecto/**')o filtros depaths) para que el workflow no falle cuando ese directorio aún no esté presente enmain.
Prompt para agentes de IA
Please address the comments from this code review:
## Overall Comments
- Consider factoring out the duplicated `setup-uv` + `uv python install` + `uv sync` steps between `test-loganalyzer` and `lint-soluciones` (e.g., via a composite action or reusable workflow) to keep the CI config DRY and easier to evolve.
- Since `test-loganalyzer` depends on `proyecto/`, you may want to guard that job with a condition (e.g., `if` on `hashFiles('proyecto/**')` or `paths` filters) so the workflow doesn’t fail when that directory is not yet present on `main`.Sourcery es gratuito para open source: si te gustan nuestras revisiones, considera compartirlas ✨
Original comment in English
Hey - I've left some high level feedback:
- Consider factoring out the duplicated
setup-uv+uv python install+uv syncsteps betweentest-loganalyzerandlint-soluciones(e.g., via a composite action or reusable workflow) to keep the CI config DRY and easier to evolve. - Since
test-loganalyzerdepends onproyecto/, you may want to guard that job with a condition (e.g.,ifonhashFiles('proyecto/**')orpathsfilters) so the workflow doesn’t fail when that directory is not yet present onmain.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider factoring out the duplicated `setup-uv` + `uv python install` + `uv sync` steps between `test-loganalyzer` and `lint-soluciones` (e.g., via a composite action or reusable workflow) to keep the CI config DRY and easier to evolve.
- Since `test-loganalyzer` depends on `proyecto/`, you may want to guard that job with a condition (e.g., `if` on `hashFiles('proyecto/**')` or `paths` filters) so the workflow doesn’t fail when that directory is not yet present on `main`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumen
Bloque 4 del rediseño: añade un workflow de GitHub Actions en
.github/workflows/ci.ymlque valida el código del repo en cada push amainy en cada PR.Jobs del workflow
test-loganalyzer— sobreproyecto/:uv sync --group dev.ruff check src tests.pytest -v(corre los 4 ficheros de test del proyecto).lint-soluciones— sobre el resto del repo:ruff check modulo-*/soluciones/.Decisiones
soluciones/— algunas dependen de servicios externos (httpxapuntando a APIs reales en m06, mocks de red en m07). Solo lint sobre ellas, que es lo razonable.ejercicios/— son stubs conraise NotImplementedErrorpor diseño, fallarían siempre.mypypor ahora — el proyecto es pequeño y los tipos están bien anotados, mypy aportaría poco a cambio de tiempo de CI. Si quieres añadirlo, basta con un step extra..python-versiondel repo). Si quieres garantizar compat 3.13 más adelante, se añade fácil.Dependencia con #6
Este workflow asume que existe
proyecto/. Si se mergea antes que la PR #6, el jobtest-loganalyzerfallará en la primera ejecución hasta queproyecto/aparezca enmain. Recomendado: mergear #6 primero.Plan de test