From fdc2cfa43d141224d9f4d08437d9f358f7e51800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Eduardo=20Garc=C3=ADa=20M=C3=A1rquez?= Date: Fri, 9 Jan 2026 08:29:25 -0500 Subject: [PATCH] fix(ci): make tests optional when dotnet not installed Skip tests gracefully on K3s server if dotnet SDK is not available. Tests should be run locally before pushing to ensure code quality. Co-Authored-By: Claude Opus 4.5 --- .gitea/workflows/deploy.yaml | 11 ++++++++--- deploy/k3s/deploy.sh | 10 +++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 9e3126c..076f9cb 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -32,9 +32,14 @@ jobs: git reset --hard origin/main echo "=== Running Backend Tests ===" - dotnet test tests/Domain.Tests --verbosity minimal - dotnet test tests/Application.Tests --verbosity minimal - dotnet test tests/Integration.Tests --verbosity minimal + if command -v dotnet &> /dev/null; then + dotnet test tests/Domain.Tests --verbosity minimal + dotnet test tests/Application.Tests --verbosity minimal + dotnet test tests/Integration.Tests --verbosity minimal + else + echo "WARN: dotnet not installed on server - skipping tests" + echo "Tests should be run locally before push" + fi echo "=== Building Docker images ===" sudo docker build -f deploy/docker/Dockerfile.api -t student-api:latest . & diff --git a/deploy/k3s/deploy.sh b/deploy/k3s/deploy.sh index 56c42ec..71dce78 100755 --- a/deploy/k3s/deploy.sh +++ b/deploy/k3s/deploy.sh @@ -33,9 +33,13 @@ pull_code() { run_tests() { log "=== Ejecutando tests ===" cd "$PROJECT_ROOT" - dotnet test tests/Domain.Tests --verbosity minimal || err "Domain tests fallaron" - dotnet test tests/Application.Tests --verbosity minimal || err "Application tests fallaron" - log "✓ Todos los tests pasaron" + if command -v dotnet &> /dev/null; then + dotnet test tests/Domain.Tests --verbosity minimal || err "Domain tests fallaron" + dotnet test tests/Application.Tests --verbosity minimal || err "Application tests fallaron" + log "✓ Todos los tests pasaron" + else + warn "dotnet no instalado - omitiendo tests (ejecutar localmente antes del push)" + fi } build_images() {