Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ci best practise #50

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,46 @@ jobs:
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: 'Install .NET SDK'
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: ./global.json

- name: Versioning
- name: Restore dependencies
run: dotnet restore

- name: Setup Git Versioning
uses: dotnet/nbgv@master
id: nbgv

- name: Version Info
- name: Show Version Info
run: |
echo 'SemVer2: ${{ steps.nbgv.outputs.SemVer2 }}'

- name: Build with dotnet
run: dotnet build
--configuration ${{ env.BuildConfig }}
--no-restore --configuration ${{ env.BuildConfig }}
/p:Version=${{ steps.nbgv.outputs.AssemblyVersion }}

- name: Test with dotnet
run: dotnet test
--no-build --configuration ${{ env.BuildConfig }}
--logger "trx;LogFileName=test-results.trx" --results-directory ./artifacts/testResults
continue-on-error: true

- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: DotNET Tests
path: "./artifacts/testResults/test-results.trx"
reporter: dotnet-trx
fail-on-error: true

- name: Pack NuGet
run: dotnet pack
Expand Down