Add docblocks #492
This file contains 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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET | |
on: | |
push: | |
paths-ignore: [ "StepLang.Wiki/**" ] | |
branches: [ "main" ] | |
pull_request: | |
paths-ignore: [ "StepLang.Wiki/**" ] | |
branches: [ "main" ] | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
version: [6.x, 7.x, 8.x] | |
runs-on: ${{ matrix.os }} | |
name: Build & Test on .NET ${{ matrix.version }} (${{ matrix.os }}) | |
outputs: | |
badge: ${{ steps.coverage.outputs.badge }} | |
line_rate: ${{ steps.coverage.outputs.line_rate }} | |
branch_rate: ${{ steps.coverage.outputs.branch_rate }} | |
complexity: ${{ steps.coverage.outputs.complexity }} | |
health: ${{ steps.coverage.outputs.health }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.version }} | |
- name: Cache NuGet packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Test | |
run: dotnet test --configuration Release --no-build | |
test: | |
runs-on: ubuntu-latest | |
name: Test on .NET 7.x (ubuntu-latest) | |
outputs: | |
badge: ${{ steps.coverage.outputs.badge }} | |
line_rate: ${{ steps.coverage.outputs.line_rate }} | |
branch_rate: ${{ steps.coverage.outputs.branch_rate }} | |
complexity: ${{ steps.coverage.outputs.complexity }} | |
health: ${{ steps.coverage.outputs.health }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.x | |
- name: Cache NuGet packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Test | |
run: dotnet test --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage | |
- name: Provide Code Coverage Summary | |
id: coverage | |
uses: ricardoboss/CodeCoverageSummary@dev | |
if: matrix.os == 'ubuntu-latest' && matrix.version == '7.x' | |
with: | |
filename: coverage/**/coverage.cobertura.xml | |
output: github | |
fail_below_min: true | |
thresholds: '0 85' | |
badge: true | |
report: | |
name: Report | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check Style | |
id: style | |
run: dotnet tool update dotnet-format -g && dotnet format --verify-no-changes | |
- name: Check Docblock Coverage | |
id: docblocks | |
if: always() | |
run: dotnet tool update cranky -g && cranky --project ./StepLang/StepLang.csproj --github --set-exit-code --percentages 0,50 | |
- name: Add PR comment | |
if: github.event_name == 'pull_request' | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
comment_tag: report | |
message: | | |
## Report | |
![Code Coverage](${{ needs.build.outputs.badge }}) | |
Static Analysis: | |
- Code Style: `${{ steps.style.outcome }}` | |
- Docblocks: `${{ steps.docblocks.outputs.documented }} / ${{ steps.docblocks.outputs.total }}` (`${{ steps.docblocks.outputs.percent }}%`) |