ci: simplify unit tests workflow #59
Workflow file for this run
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: unit tests | |
on: [push] | |
env: | |
DOTNET_MINIMUM_TEST_COVERAGE: 0 | |
jobs: | |
dotnet-tests: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./Server/ReasnAPI | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 | |
- name: Build solution | |
run: dotnet build --no-restore | |
- name: Test with dotnet | |
run: > | |
dotnet test | |
--no-build | |
--verbosity normal | |
--logger "trx;logfilename=commit-${{ github.sha }}.trx" | |
--results-directory "TestResults-${{ github.sha }}" | |
- name: Run coverlet | |
run: > | |
coverlet . | |
--target "dotnet" | |
--targetargs "test --no-build" | |
--threshold ${{ env.DOTNET_MINIMUM_TEST_COVERAGE }} | |
- name: Upload dotnet test results | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() }} | |
with: | |
name: dotnet-results-commit-${{ github.sha }} | |
path: TestResults-commit-${{ github.sha }} | |
retention-days: 14 | |