From 31b0b3970aa9cb8ba78f8c50725e38d98bd3c028 Mon Sep 17 00:00:00 2001 From: Leon Hoppe Date: Sun, 6 Jul 2025 13:57:38 +0200 Subject: [PATCH] Feature/test reports --- .gitlab-ci.yml | 29 ++- .idea/.idea.HopFrame/.idea/workspace.xml | 226 ++++++++++------------- 2 files changed, 122 insertions(+), 133 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4ed4dd5..aa87319 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,8 @@ stages: build: stage: build + only: + - pushes script: - dotnet restore - dotnet build --configuration Release --no-restore @@ -18,10 +20,31 @@ build: test: stage: test + only: + - pushes script: - - dotnet test --verbosity normal - dependencies: - - build + - dotnet test HopFrame.sln --logger "trx;LogFilePrefix=testresults" --collect:"XPlat Code Coverage" --results-directory TestResults + - dotnet tool install --global trx2junit + - dotnet tool install --global dotnet-reportgenerator-globaltool + - export PATH="$PATH:/root/.dotnet/tools" + - for file in TestResults/*.trx; do trx2junit "$file"; done + - reportgenerator -reports:"TestResults/**/coverage.cobertura.xml" -targetdir:"coveragereport" -reporttypes:"Cobertura;HtmlInline" + - echo total_coverage=$(grep -o 'line-rate="[0-9.]*"' coveragereport/Cobertura.xml | head -n1 | sed -E 's/line-rate="([0-9.]+)"/\1/' | awk '{printf "%.2f", $1 * 100}') + - tar -cvf coveragereport.tar coveragereport/ + artifacts: + when: always + expire_in: 1 week + paths: + - TestResults/*.xml + - TestResults/**/*.coverage.cobertura.xml + - coveragereport.tar + reports: + junit: + - TestResults/*.xml + coverage_report: + coverage_format: cobertura + path: coveragereport/Cobertura.xml + coverage: '/total_coverage=(\d+(\.\d+)?)/' publish: stage: publish diff --git a/.idea/.idea.HopFrame/.idea/workspace.xml b/.idea/.idea.HopFrame/.idea/workspace.xml index d483158..85f3cbc 100644 --- a/.idea/.idea.HopFrame/.idea/workspace.xml +++ b/.idea/.idea.HopFrame/.idea/workspace.xml @@ -11,11 +11,7 @@