Update GH Actions #12
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
name: Build and Test | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # avoid shallow clone so nbgv can do its work. | |
# Use GitVersion | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '6.x' | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- name: Restore Dependencies | |
run: dotnet restore src/Ktos.AspNetCore.Authentication.ApiKeyHeader.csproj | |
- name: Build | |
run: dotnet build src/Ktos.AspNetCore.Authentication.ApiKeyHeader.csproj --configuration Release --no-restore /p:InformationalVersion=${{ steps.gitversion.outputs.fullSemVer }} /p:Version=${{ steps.gitversion.outputs.semVer }} | |
- name: Test | |
run: dotnet test test/Ktos.AspNetCore.Authentication.ApiKeyHeader.Tests.csproj --configuration Release --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage | |
- name: Code Coverage Report | |
uses: irongut/[email protected] | |
with: | |
filename: coverage/**/coverage.cobertura.xml | |
badge: true | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: false | |
indicators: true | |
output: both | |
thresholds: '60 80' | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
recreate: true | |
path: code-coverage-results.md |