Skip to content

Use C# 12 language features and fix some analyzer msgs #44

Use C# 12 language features and fix some analyzer msgs

Use C# 12 language features and fix some analyzer msgs #44

Workflow file for this run

name: Build
on:
push:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.15
with:
versionSpec: "5.8.0"
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.15
with:
useConfigFile: true
configFilePath: "GitVersion.yml"
# Cache packages for faster subsequent runs
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore
working-directory: ./src
run: dotnet restore ./CenterEdge.Async.sln
- name: Build
working-directory: ./src
run: dotnet build --no-restore -c Release /p:Version=${{ steps.gitversion.outputs.semVer }} ./CenterEdge.Async.sln
- name: Test
working-directory: ./src
run: dotnet test --no-build -c Release -f net8.0 -l 'trx;LogFileName=results.trx' ./CenterEdge.Async.sln
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Unit Tests
path: src/**/results.trx
reporter: dotnet-trx
- name: Pack
working-directory: ./src
run: dotnet pack --no-build -c Release /p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersionV2 }} ./CenterEdge.Async.sln
- name: Push
working-directory: ./src
# Publish CI packages from PRs and tagged releases
if: ${{ startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/pull/') }}
run: |
dotnet nuget add source --name github https://nuget.pkg.github.com/CenterEdge/index.json &&
dotnet nuget push **/*.${{ steps.gitversion.outputs.nuGetVersionV2 }}.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s github
- name: Push to NuGet.org
working-directory: ./src
# Publish tagged releases to NuGet.org
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: dotnet nuget push **/*.${{ steps.gitversion.outputs.nuGetVersionV2 }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s nuget.org