Skip to content

Обновить CHANGELOG с изменениями палитры цветов #112

Обновить CHANGELOG с изменениями палитры цветов

Обновить CHANGELOG с изменениями палитры цветов #112

Workflow file for this run

name: Build & Test
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
permissions:
contents: read
concurrency:
group: build-test-${{ github.ref }}
cancel-in-progress: true
jobs:
build-test:
name: Build and test
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Restore locked dependencies
run: dotnet restore .\AiteBar.sln --locked-mode
- name: Build Release
run: dotnet build .\AiteBar.sln -c Release --no-restore
- name: Run tests
run: dotnet test .\AiteBar.Tests\AiteBar.Tests.csproj -c Release --no-build
- name: Collect coverage
run: >
dotnet test .\AiteBar.Tests\AiteBar.Tests.csproj
-c Release
--no-build
--collect:"XPlat Code Coverage"
--results-directory .\artifacts\coverage
- name: Publish coverage summary
shell: pwsh
run: |
$coverageFile = Get-ChildItem .\artifacts\coverage -Recurse -Filter coverage.cobertura.xml | Select-Object -First 1
if (-not $coverageFile) {
throw "coverage.cobertura.xml was not produced."
}
[xml]$coverage = Get-Content $coverageFile.FullName
$lineRate = [double]::Parse($coverage.coverage.'line-rate', [Globalization.CultureInfo]::InvariantCulture)
$branchRate = [double]::Parse($coverage.coverage.'branch-rate', [Globalization.CultureInfo]::InvariantCulture)
$linePercent = [Math]::Round($lineRate * 100, 2)
$branchPercent = [Math]::Round($branchRate * 100, 2)
$threshold = 19.0
@(
"## Coverage",
"",
"| Metric | Value |",
"| --- | ---: |",
"| Line coverage | $linePercent% |",
"| Branch coverage | $branchPercent% |",
"| Lines covered | $($coverage.coverage.'lines-covered') / $($coverage.coverage.'lines-valid') |",
"",
"Minimum line coverage threshold: $threshold%"
) | Add-Content $env:GITHUB_STEP_SUMMARY
if ($linePercent -lt $threshold) {
throw "Line coverage $linePercent% is below the $threshold% threshold."
}
- name: Upload coverage artifact
uses: actions/upload-artifact@v7
if: always()
with:
name: coverage
path: artifacts/coverage
if-no-files-found: warn
retention-days: 14