Skip to content

ci: fix coverlet execution #5

ci: fix coverlet execution

ci: fix coverlet execution #5

Workflow file for this run

name: unit tests
on: [push]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "SOLUTION_FILE=./Server/ReasnAPI/ReasnAPI.sln" >> $GITHUB_ENV
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install coverlet
run: dotnet tool install -g coverlet.console
- name: Install dependencies
run: dotnet restore ${{ env.SOLUTION_FILE }}
- name: Build solution
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore
- name: Test with dotnet
run: |
echo "RESULTS_FILENAME=results-$(date +'%Y-%m-%d_%H_%M_%S')" >> $GITHUB_ENV
dotnet test ${{ env.SOLUTION_FILE }} --logger "trx;logfilename=${{ env.RESULTS_FILENAME }}.trx" --logger "html;logfilename=${{ env.RESULTS_FILENAME }}.html" --no-build --results-directory "TestResults-${{ github.sha }}"
- name: Run coverlet
run: |
echo TEST_ASSEMBLY=$(find ./Server/ReasnAPI/ReasnAPI.Tests -name "ReasnAPI.Tests.dll") >> $GITHUB_ENV
coverlet ${{ env.TEST_ASSEMBLY }} --target "dotnet" --targetargs "test --no-build"
- name: Upload dotnet test results
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: dotnet-results-${{ github.sha }}
path: TestResults-${{ github.sha }}
retention-days: 14