avrotize 2.21.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- avrotize/__init__.py +66 -0
- avrotize/__main__.py +6 -0
- avrotize/_version.py +34 -0
- avrotize/asn1toavro.py +160 -0
- avrotize/avrotize.py +152 -0
- avrotize/avrotocpp/CMakeLists.txt.jinja +77 -0
- avrotize/avrotocpp/build.bat.jinja +7 -0
- avrotize/avrotocpp/build.sh.jinja +7 -0
- avrotize/avrotocpp/dataclass_body.jinja +108 -0
- avrotize/avrotocpp/vcpkg.json.jinja +21 -0
- avrotize/avrotocpp.py +483 -0
- avrotize/avrotocsharp/README.md.jinja +166 -0
- avrotize/avrotocsharp/class_test.cs.jinja +266 -0
- avrotize/avrotocsharp/dataclass_core.jinja +293 -0
- avrotize/avrotocsharp/enum_test.cs.jinja +20 -0
- avrotize/avrotocsharp/project.csproj.jinja +30 -0
- avrotize/avrotocsharp/project.sln.jinja +34 -0
- avrotize/avrotocsharp/run_coverage.ps1.jinja +98 -0
- avrotize/avrotocsharp/run_coverage.sh.jinja +149 -0
- avrotize/avrotocsharp/testproject.csproj.jinja +19 -0
- avrotize/avrotocsharp.py +1180 -0
- avrotize/avrotocsv.py +121 -0
- avrotize/avrotodatapackage.py +173 -0
- avrotize/avrotodb.py +1383 -0
- avrotize/avrotogo/go_enum.jinja +12 -0
- avrotize/avrotogo/go_helpers.jinja +31 -0
- avrotize/avrotogo/go_struct.jinja +151 -0
- avrotize/avrotogo/go_test.jinja +47 -0
- avrotize/avrotogo/go_union.jinja +38 -0
- avrotize/avrotogo.py +476 -0
- avrotize/avrotographql.py +197 -0
- avrotize/avrotoiceberg.py +210 -0
- avrotize/avrotojava/class_test.java.jinja +212 -0
- avrotize/avrotojava/enum_test.java.jinja +21 -0
- avrotize/avrotojava/testproject.pom.jinja +54 -0
- avrotize/avrotojava.py +2156 -0
- avrotize/avrotojs.py +250 -0
- avrotize/avrotojsons.py +481 -0
- avrotize/avrotojstruct.py +345 -0
- avrotize/avrotokusto.py +364 -0
- avrotize/avrotomd/README.md.jinja +49 -0
- avrotize/avrotomd.py +137 -0
- avrotize/avrotools.py +168 -0
- avrotize/avrotoparquet.py +208 -0
- avrotize/avrotoproto.py +359 -0
- avrotize/avrotopython/dataclass_core.jinja +241 -0
- avrotize/avrotopython/enum_core.jinja +87 -0
- avrotize/avrotopython/pyproject_toml.jinja +18 -0
- avrotize/avrotopython/test_class.jinja +97 -0
- avrotize/avrotopython/test_enum.jinja +23 -0
- avrotize/avrotopython.py +626 -0
- avrotize/avrotorust/dataclass_enum.rs.jinja +74 -0
- avrotize/avrotorust/dataclass_struct.rs.jinja +204 -0
- avrotize/avrotorust/dataclass_union.rs.jinja +105 -0
- avrotize/avrotorust.py +435 -0
- avrotize/avrotots/class_core.ts.jinja +140 -0
- avrotize/avrotots/class_test.ts.jinja +77 -0
- avrotize/avrotots/enum_core.ts.jinja +46 -0
- avrotize/avrotots/gitignore.jinja +34 -0
- avrotize/avrotots/index.ts.jinja +0 -0
- avrotize/avrotots/package.json.jinja +23 -0
- avrotize/avrotots/tsconfig.json.jinja +21 -0
- avrotize/avrotots.py +687 -0
- avrotize/avrotoxsd.py +344 -0
- avrotize/cddltostructure.py +1841 -0
- avrotize/commands.json +3496 -0
- avrotize/common.py +834 -0
- avrotize/constants.py +87 -0
- avrotize/csvtoavro.py +132 -0
- avrotize/datapackagetoavro.py +76 -0
- avrotize/dependencies/cpp/vcpkg/vcpkg.json +19 -0
- avrotize/dependencies/cs/net90/dependencies.csproj +29 -0
- avrotize/dependencies/go/go121/go.mod +6 -0
- avrotize/dependencies/java/jdk21/pom.xml +91 -0
- avrotize/dependencies/python/py312/requirements.txt +13 -0
- avrotize/dependencies/rust/stable/Cargo.toml +17 -0
- avrotize/dependencies/typescript/node22/package.json +16 -0
- avrotize/dependency_resolver.py +348 -0
- avrotize/dependency_version.py +432 -0
- avrotize/generic/generic.avsc +57 -0
- avrotize/jsonstoavro.py +2167 -0
- avrotize/jsonstostructure.py +2864 -0
- avrotize/jstructtoavro.py +878 -0
- avrotize/kstructtoavro.py +93 -0
- avrotize/kustotoavro.py +455 -0
- avrotize/openapitostructure.py +717 -0
- avrotize/parquettoavro.py +157 -0
- avrotize/proto2parser.py +498 -0
- avrotize/proto3parser.py +403 -0
- avrotize/prototoavro.py +382 -0
- avrotize/prototypes/any.avsc +19 -0
- avrotize/prototypes/api.avsc +106 -0
- avrotize/prototypes/duration.avsc +20 -0
- avrotize/prototypes/field_mask.avsc +18 -0
- avrotize/prototypes/struct.avsc +60 -0
- avrotize/prototypes/timestamp.avsc +20 -0
- avrotize/prototypes/type.avsc +253 -0
- avrotize/prototypes/wrappers.avsc +117 -0
- avrotize/structuretocddl.py +597 -0
- avrotize/structuretocpp/CMakeLists.txt.jinja +76 -0
- avrotize/structuretocpp/build.bat.jinja +3 -0
- avrotize/structuretocpp/build.sh.jinja +3 -0
- avrotize/structuretocpp/dataclass_body.jinja +50 -0
- avrotize/structuretocpp/vcpkg.json.jinja +11 -0
- avrotize/structuretocpp.py +697 -0
- avrotize/structuretocsharp/class_test.cs.jinja +180 -0
- avrotize/structuretocsharp/dataclass_core.jinja +156 -0
- avrotize/structuretocsharp/enum_test.cs.jinja +36 -0
- avrotize/structuretocsharp/json_structure_converters.cs.jinja +399 -0
- avrotize/structuretocsharp/program.cs.jinja +49 -0
- avrotize/structuretocsharp/project.csproj.jinja +17 -0
- avrotize/structuretocsharp/project.sln.jinja +34 -0
- avrotize/structuretocsharp/testproject.csproj.jinja +18 -0
- avrotize/structuretocsharp/tuple_converter.cs.jinja +121 -0
- avrotize/structuretocsharp.py +2295 -0
- avrotize/structuretocsv.py +365 -0
- avrotize/structuretodatapackage.py +659 -0
- avrotize/structuretodb.py +1125 -0
- avrotize/structuretogo/go_enum.jinja +12 -0
- avrotize/structuretogo/go_helpers.jinja +26 -0
- avrotize/structuretogo/go_interface.jinja +18 -0
- avrotize/structuretogo/go_struct.jinja +187 -0
- avrotize/structuretogo/go_test.jinja +70 -0
- avrotize/structuretogo.py +729 -0
- avrotize/structuretographql.py +502 -0
- avrotize/structuretoiceberg.py +355 -0
- avrotize/structuretojava/choice_core.jinja +34 -0
- avrotize/structuretojava/class_core.jinja +23 -0
- avrotize/structuretojava/enum_core.jinja +18 -0
- avrotize/structuretojava/equals_hashcode.jinja +30 -0
- avrotize/structuretojava/pom.xml.jinja +26 -0
- avrotize/structuretojava/tuple_core.jinja +49 -0
- avrotize/structuretojava.py +938 -0
- avrotize/structuretojs/class_core.js.jinja +33 -0
- avrotize/structuretojs/enum_core.js.jinja +10 -0
- avrotize/structuretojs/package.json.jinja +12 -0
- avrotize/structuretojs/test_class.js.jinja +84 -0
- avrotize/structuretojs/test_enum.js.jinja +58 -0
- avrotize/structuretojs/test_runner.js.jinja +45 -0
- avrotize/structuretojs.py +657 -0
- avrotize/structuretojsons.py +498 -0
- avrotize/structuretokusto.py +639 -0
- avrotize/structuretomd/README.md.jinja +204 -0
- avrotize/structuretomd.py +322 -0
- avrotize/structuretoproto.py +764 -0
- avrotize/structuretopython/dataclass_core.jinja +363 -0
- avrotize/structuretopython/enum_core.jinja +45 -0
- avrotize/structuretopython/map_alias.jinja +21 -0
- avrotize/structuretopython/pyproject_toml.jinja +23 -0
- avrotize/structuretopython/test_class.jinja +103 -0
- avrotize/structuretopython/test_enum.jinja +34 -0
- avrotize/structuretopython.py +799 -0
- avrotize/structuretorust/dataclass_enum.rs.jinja +63 -0
- avrotize/structuretorust/dataclass_struct.rs.jinja +121 -0
- avrotize/structuretorust/dataclass_union.rs.jinja +81 -0
- avrotize/structuretorust.py +714 -0
- avrotize/structuretots/class_core.ts.jinja +78 -0
- avrotize/structuretots/enum_core.ts.jinja +6 -0
- avrotize/structuretots/gitignore.jinja +8 -0
- avrotize/structuretots/index.ts.jinja +1 -0
- avrotize/structuretots/package.json.jinja +39 -0
- avrotize/structuretots/test_class.ts.jinja +35 -0
- avrotize/structuretots/tsconfig.json.jinja +21 -0
- avrotize/structuretots.py +740 -0
- avrotize/structuretoxsd.py +679 -0
- avrotize/xsdtoavro.py +413 -0
- avrotize-2.21.1.dist-info/METADATA +1319 -0
- avrotize-2.21.1.dist-info/RECORD +171 -0
- avrotize-2.21.1.dist-info/WHEEL +4 -0
- avrotize-2.21.1.dist-info/entry_points.txt +3 -0
- avrotize-2.21.1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
# PowerShell script to run tests with code coverage and generate reports
|
|
3
|
+
# Generated for project: {{ project_name }}
|
|
4
|
+
|
|
5
|
+
param(
|
|
6
|
+
[Parameter(HelpMessage="Minimum coverage threshold (default: 85)")]
|
|
7
|
+
[int]$Threshold = 85,
|
|
8
|
+
|
|
9
|
+
[Parameter(HelpMessage="Generate HTML report")]
|
|
10
|
+
[switch]$HtmlReport = $false,
|
|
11
|
+
|
|
12
|
+
[Parameter(HelpMessage="Open HTML report in browser")]
|
|
13
|
+
[switch]$OpenReport = $false,
|
|
14
|
+
|
|
15
|
+
[Parameter(HelpMessage="Fail build if coverage below threshold")]
|
|
16
|
+
[switch]$FailOnLowCoverage = $true
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
Write-Host "๐งช Running tests with code coverage for {{ project_name }}..." -ForegroundColor Green
|
|
20
|
+
|
|
21
|
+
# Clean previous coverage results
|
|
22
|
+
$coverageDir = "./coverage"
|
|
23
|
+
if (Test-Path $coverageDir) {
|
|
24
|
+
Remove-Item $coverageDir -Recurse -Force
|
|
25
|
+
Write-Host "๐งน Cleaned previous coverage results" -ForegroundColor Yellow
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Run tests with coverage collection
|
|
29
|
+
Write-Host "๐ Collecting code coverage..." -ForegroundColor Blue
|
|
30
|
+
$testResult = dotnet test --collect:"XPlat Code Coverage" --results-directory:"$coverageDir" --logger:"console;verbosity=detailed"
|
|
31
|
+
$testExitCode = $LASTEXITCODE
|
|
32
|
+
|
|
33
|
+
if ($testExitCode -ne 0) {
|
|
34
|
+
Write-Host "โ Tests failed!" -ForegroundColor Red
|
|
35
|
+
exit $testExitCode
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
# Find coverage file
|
|
39
|
+
$coverageFile = Get-ChildItem -Recurse -Path $coverageDir -Name "*.cobertura.xml" | Select-Object -First 1
|
|
40
|
+
if (-not $coverageFile) {
|
|
41
|
+
Write-Host "โ No coverage file found!" -ForegroundColor Red
|
|
42
|
+
exit 1
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
$coverageFilePath = Join-Path $coverageDir $coverageFile
|
|
46
|
+
Write-Host "๐ Coverage file: $coverageFilePath" -ForegroundColor Green
|
|
47
|
+
|
|
48
|
+
# Parse coverage percentage
|
|
49
|
+
$coverage = Select-Xml -Path $coverageFilePath -XPath "/coverage/@line-rate"
|
|
50
|
+
$coveragePercent = [math]::Round([double]$coverage.Node.Value * 100, 2)
|
|
51
|
+
|
|
52
|
+
Write-Host "๐ Line Coverage: $coveragePercent%" -ForegroundColor $(if ($coveragePercent -ge $Threshold) { "Green" } else { "Red" })
|
|
53
|
+
|
|
54
|
+
# Parse branch coverage
|
|
55
|
+
$branchCoverage = Select-Xml -Path $coverageFilePath -XPath "/coverage/@branch-rate"
|
|
56
|
+
$branchPercent = [math]::Round([double]$branchCoverage.Node.Value * 100, 2)
|
|
57
|
+
Write-Host "๐ฟ Branch Coverage: $branchPercent%" -ForegroundColor $(if ($branchPercent -ge $Threshold) { "Green" } else { "Red" })
|
|
58
|
+
|
|
59
|
+
# Generate HTML report if requested
|
|
60
|
+
if ($HtmlReport) {
|
|
61
|
+
Write-Host "๐ Generating HTML coverage report..." -ForegroundColor Blue
|
|
62
|
+
|
|
63
|
+
# Check if reportgenerator is installed
|
|
64
|
+
$reportGenExists = Get-Command reportgenerator -ErrorAction SilentlyContinue
|
|
65
|
+
if (-not $reportGenExists) {
|
|
66
|
+
Write-Host "โฌ๏ธ Installing ReportGenerator..." -ForegroundColor Yellow
|
|
67
|
+
dotnet tool install -g dotnet-reportgenerator-globaltool
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
$htmlReportPath = Join-Path $coverageDir "html"
|
|
71
|
+
reportgenerator "-reports:$coverageFilePath" "-targetdir:$htmlReportPath" "-reporttypes:Html"
|
|
72
|
+
|
|
73
|
+
Write-Host "๐ HTML report generated: $htmlReportPath/index.html" -ForegroundColor Green
|
|
74
|
+
|
|
75
|
+
if ($OpenReport) {
|
|
76
|
+
$indexPath = Join-Path $htmlReportPath "index.html"
|
|
77
|
+
Start-Process $indexPath
|
|
78
|
+
Write-Host "๐ Opened coverage report in browser" -ForegroundColor Green
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
# Coverage summary
|
|
83
|
+
Write-Host ""
|
|
84
|
+
Write-Host "๐ Coverage Summary:" -ForegroundColor Cyan
|
|
85
|
+
Write-Host " Line Coverage: $coveragePercent% (Threshold: $Threshold%)" -ForegroundColor White
|
|
86
|
+
Write-Host " Branch Coverage: $branchPercent%" -ForegroundColor White
|
|
87
|
+
Write-Host " Status: $(if ($coveragePercent -ge $Threshold) { "โ
PASSED" } else { "โ FAILED" })" -ForegroundColor $(if ($coveragePercent -ge $Threshold) { "Green" } else { "Red" })
|
|
88
|
+
|
|
89
|
+
# Fail if coverage is below threshold and FailOnLowCoverage is set
|
|
90
|
+
if ($FailOnLowCoverage -and $coveragePercent -lt $Threshold) {
|
|
91
|
+
Write-Host ""
|
|
92
|
+
Write-Host "โ Coverage $coveragePercent% is below the required threshold of $Threshold%" -ForegroundColor Red
|
|
93
|
+
exit 1
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Write-Host ""
|
|
97
|
+
Write-Host "โ
Coverage analysis completed successfully!" -ForegroundColor Green
|
|
98
|
+
exit 0
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Shell script to run tests with code coverage and generate reports
|
|
3
|
+
# Generated for project: {{ project_name }}
|
|
4
|
+
|
|
5
|
+
# Default values
|
|
6
|
+
THRESHOLD=85
|
|
7
|
+
HTML_REPORT=false
|
|
8
|
+
OPEN_REPORT=false
|
|
9
|
+
FAIL_ON_LOW_COVERAGE=true
|
|
10
|
+
|
|
11
|
+
# Parse command line arguments
|
|
12
|
+
while [[ $# -gt 0 ]]; do
|
|
13
|
+
case $1 in
|
|
14
|
+
--threshold)
|
|
15
|
+
THRESHOLD="$2"
|
|
16
|
+
shift 2
|
|
17
|
+
;;
|
|
18
|
+
--html-report)
|
|
19
|
+
HTML_REPORT=true
|
|
20
|
+
shift
|
|
21
|
+
;;
|
|
22
|
+
--open-report)
|
|
23
|
+
OPEN_REPORT=true
|
|
24
|
+
HTML_REPORT=true
|
|
25
|
+
shift
|
|
26
|
+
;;
|
|
27
|
+
--no-fail)
|
|
28
|
+
FAIL_ON_LOW_COVERAGE=false
|
|
29
|
+
shift
|
|
30
|
+
;;
|
|
31
|
+
*)
|
|
32
|
+
echo "Unknown option: $1"
|
|
33
|
+
echo "Usage: $0 [--threshold N] [--html-report] [--open-report] [--no-fail]"
|
|
34
|
+
exit 1
|
|
35
|
+
;;
|
|
36
|
+
esac
|
|
37
|
+
done
|
|
38
|
+
|
|
39
|
+
echo "๐งช Running tests with code coverage for {{ project_name }}..."
|
|
40
|
+
|
|
41
|
+
# Clean previous coverage results
|
|
42
|
+
COVERAGE_DIR="./coverage"
|
|
43
|
+
if [ -d "$COVERAGE_DIR" ]; then
|
|
44
|
+
rm -rf "$COVERAGE_DIR"
|
|
45
|
+
echo "๐งน Cleaned previous coverage results"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# Run tests with coverage collection
|
|
49
|
+
echo "๐ Collecting code coverage..."
|
|
50
|
+
dotnet test --collect:"XPlat Code Coverage" --results-directory:"$COVERAGE_DIR" --logger:"console;verbosity=detailed"
|
|
51
|
+
TEST_EXIT_CODE=$?
|
|
52
|
+
|
|
53
|
+
if [ $TEST_EXIT_CODE -ne 0 ]; then
|
|
54
|
+
echo "โ Tests failed!"
|
|
55
|
+
exit $TEST_EXIT_CODE
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
# Find coverage file
|
|
59
|
+
COVERAGE_FILE=$(find "$COVERAGE_DIR" -name "*.cobertura.xml" | head -n 1)
|
|
60
|
+
if [ -z "$COVERAGE_FILE" ]; then
|
|
61
|
+
echo "โ No coverage file found!"
|
|
62
|
+
exit 1
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
echo "๐ Coverage file: $COVERAGE_FILE"
|
|
66
|
+
|
|
67
|
+
# Parse coverage percentage using grep and sed
|
|
68
|
+
COVERAGE_LINE_RATE=$(grep -o 'line-rate="[0-9.]*"' "$COVERAGE_FILE" | head -n 1 | sed 's/line-rate="//;s/"//')
|
|
69
|
+
COVERAGE_PERCENT=$(echo "$COVERAGE_LINE_RATE * 100" | bc -l | xargs printf "%.2f")
|
|
70
|
+
|
|
71
|
+
# Parse branch coverage
|
|
72
|
+
BRANCH_LINE_RATE=$(grep -o 'branch-rate="[0-9.]*"' "$COVERAGE_FILE" | head -n 1 | sed 's/branch-rate="//;s/"//')
|
|
73
|
+
BRANCH_PERCENT=$(echo "$BRANCH_LINE_RATE * 100" | bc -l | xargs printf "%.2f")
|
|
74
|
+
|
|
75
|
+
# Color codes
|
|
76
|
+
GREEN='\033[0;32m'
|
|
77
|
+
RED='\033[0;31m'
|
|
78
|
+
BLUE='\033[0;34m'
|
|
79
|
+
YELLOW='\033[1;33m'
|
|
80
|
+
CYAN='\033[0;36m'
|
|
81
|
+
WHITE='\033[1;37m'
|
|
82
|
+
NC='\033[0m' # No Color
|
|
83
|
+
|
|
84
|
+
# Determine colors based on threshold
|
|
85
|
+
LINE_COLOR=$GREEN
|
|
86
|
+
if (( $(echo "$COVERAGE_PERCENT < $THRESHOLD" | bc -l) )); then
|
|
87
|
+
LINE_COLOR=$RED
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
BRANCH_COLOR=$GREEN
|
|
91
|
+
if (( $(echo "$BRANCH_PERCENT < $THRESHOLD" | bc -l) )); then
|
|
92
|
+
BRANCH_COLOR=$RED
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
echo -e "๐ Line Coverage: ${LINE_COLOR}${COVERAGE_PERCENT}%${NC}"
|
|
96
|
+
echo -e "๐ฟ Branch Coverage: ${BRANCH_COLOR}${BRANCH_PERCENT}%${NC}"
|
|
97
|
+
|
|
98
|
+
# Generate HTML report if requested
|
|
99
|
+
if [ "$HTML_REPORT" = true ]; then
|
|
100
|
+
echo -e "${BLUE}๐ Generating HTML coverage report...${NC}"
|
|
101
|
+
|
|
102
|
+
# Check if reportgenerator is installed
|
|
103
|
+
if ! command -v reportgenerator &> /dev/null; then
|
|
104
|
+
echo -e "${YELLOW}โฌ๏ธ Installing ReportGenerator...${NC}"
|
|
105
|
+
dotnet tool install -g dotnet-reportgenerator-globaltool
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
HTML_REPORT_PATH="$COVERAGE_DIR/html"
|
|
109
|
+
reportgenerator "-reports:$COVERAGE_FILE" "-targetdir:$HTML_REPORT_PATH" "-reporttypes:Html"
|
|
110
|
+
|
|
111
|
+
echo -e "${GREEN}๐ HTML report generated: $HTML_REPORT_PATH/index.html${NC}"
|
|
112
|
+
|
|
113
|
+
if [ "$OPEN_REPORT" = true ]; then
|
|
114
|
+
if command -v xdg-open &> /dev/null; then
|
|
115
|
+
xdg-open "$HTML_REPORT_PATH/index.html"
|
|
116
|
+
elif command -v open &> /dev/null; then
|
|
117
|
+
open "$HTML_REPORT_PATH/index.html"
|
|
118
|
+
else
|
|
119
|
+
echo "Cannot auto-open browser. Please open: $HTML_REPORT_PATH/index.html"
|
|
120
|
+
fi
|
|
121
|
+
echo -e "${GREEN}๐ Opened coverage report in browser${NC}"
|
|
122
|
+
fi
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
# Coverage summary
|
|
126
|
+
echo ""
|
|
127
|
+
echo -e "${CYAN}๐ Coverage Summary:${NC}"
|
|
128
|
+
echo -e " Line Coverage: ${WHITE}${COVERAGE_PERCENT}%${NC} (Threshold: ${THRESHOLD}%)"
|
|
129
|
+
echo -e " Branch Coverage: ${WHITE}${BRANCH_PERCENT}%${NC}"
|
|
130
|
+
|
|
131
|
+
# Determine status
|
|
132
|
+
if (( $(echo "$COVERAGE_PERCENT >= $THRESHOLD" | bc -l) )); then
|
|
133
|
+
echo -e " Status: ${GREEN}โ
PASSED${NC}"
|
|
134
|
+
STATUS_CODE=0
|
|
135
|
+
else
|
|
136
|
+
echo -e " Status: ${RED}โ FAILED${NC}"
|
|
137
|
+
STATUS_CODE=1
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
# Fail if coverage is below threshold and FAIL_ON_LOW_COVERAGE is set
|
|
141
|
+
if [ "$FAIL_ON_LOW_COVERAGE" = true ] && [ $STATUS_CODE -eq 1 ]; then
|
|
142
|
+
echo ""
|
|
143
|
+
echo -e "${RED}โ Coverage ${COVERAGE_PERCENT}% is below the required threshold of ${THRESHOLD}%${NC}"
|
|
144
|
+
exit 1
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
echo ""
|
|
148
|
+
echo -e "${GREEN}โ
Coverage analysis completed successfully!${NC}"
|
|
149
|
+
exit 0
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
+
<PropertyGroup>
|
|
3
|
+
<TargetFramework>net9.0</TargetFramework>
|
|
4
|
+
<Nullable>enable</Nullable>
|
|
5
|
+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
6
|
+
</PropertyGroup>
|
|
7
|
+
<ItemGroup>
|
|
8
|
+
<ProjectReference Include="../src/{{project_name | pascal}}.csproj"/>
|
|
9
|
+
</ItemGroup>
|
|
10
|
+
<ItemGroup>
|
|
11
|
+
<PackageReference Include="NUnit" Version="{{ NUNIT_VERSION }}" />
|
|
12
|
+
<PackageReference Include="NUnit3TestAdapter" Version="{{ NUNIT_ADAPTER_VERSION }}" />
|
|
13
|
+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="{{ MSTEST_SDK_VERSION }}" />
|
|
14
|
+
<PackageReference Include="coverlet.collector" Version="{{ COVERLET_VERSION }}">
|
|
15
|
+
<PrivateAssets>all</PrivateAssets>
|
|
16
|
+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
17
|
+
</PackageReference>
|
|
18
|
+
</ItemGroup>
|
|
19
|
+
</Project>
|