Files
actions/csharp-build/action.yml
2025-02-10 14:47:57 +02:00

49 lines
1.3 KiB
YAML

---
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
name: C# Build
description: 'Builds and tests C# projects.'
author: 'Ismo Vuorinen'
branding:
icon: 'code'
color: 'blue'
inputs:
dotnet-version:
description: 'Version of .NET SDK to use.'
required: false
runs:
using: composite
steps:
- name: Detect .NET SDK Version
uses: ivuorinen/actions/dotnet-version-detect@main
with:
default-version: '7.0'
- name: Setup .NET SDK
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4
with:
dotnet-version: '${{ steps.detect-dotnet-version.outputs.dotnet-version }}'
- name: Restore Dependencies
shell: bash
run: dotnet restore
- name: Build Solution
shell: bash
run: dotnet build --configuration Release --no-restore
- name: Run Tests
shell: bash
run: |
dotnet test --configuration Release --no-build --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test-results.trx"
- name: Upload Test Results
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: test-results
path: |
**/*.trx
**/TestResults/**/coverage.cobertura.xml