mirror of
https://github.com/ivuorinen/actions.git
synced 2026-01-26 11:34:00 +00:00
feat: add GitHub Actions workflows for code quality and automation (#2)
This commit is contained in:
29
csharp-build/README.md
Normal file
29
csharp-build/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# ivuorinen/actions/csharp-build
|
||||
|
||||
## C# Build
|
||||
|
||||
### Description
|
||||
|
||||
Builds and tests C# projects.
|
||||
|
||||
### Inputs
|
||||
|
||||
| name | description | required | default |
|
||||
| ---------------- | ---------------------------------- | -------- | ------- |
|
||||
| `dotnet-version` | <p>Version of .NET SDK to use.</p> | `false` | `""` |
|
||||
|
||||
### Runs
|
||||
|
||||
This action is a `composite` action.
|
||||
|
||||
### Usage
|
||||
|
||||
```yaml
|
||||
- uses: ivuorinen/actions/csharp-build@main
|
||||
with:
|
||||
dotnet-version:
|
||||
# Version of .NET SDK to use.
|
||||
#
|
||||
# Required: false
|
||||
# Default: ""
|
||||
```
|
||||
48
csharp-build/action.yml
Normal file
48
csharp-build/action.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
# 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@v3
|
||||
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@v3
|
||||
with:
|
||||
name: test-results
|
||||
path: |
|
||||
**/*.trx
|
||||
**/TestResults/**/coverage.cobertura.xml
|
||||
Reference in New Issue
Block a user