Skip to content

Add Tests

Add Tests #11

Workflow file for this run

name: Run Tests
permissions:
contents: read
on:
- push
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run_tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Checkout
uses: actions/checkout@v3
- name: Prepare .NET tools
run: |
cd BinaryMatrixPlayer/BinaryMatrixEngine.Tests
dotnet tool restore
- name: Run Tests with Coverage
id: run_tests
continue-on-error: true
run: |
cd BinaryMatrixPlayer/BinaryMatrixEngine.Tests
dotnet dotCover cover-dotnet --Output=$HOME/coverage.report -- test
- name: Produce Coverage Report
run: |
cd BinaryMatrixPlayer/BinaryMatrixEngine.Tests
dotnet dotCover report --Source=$HOME/coverage.report --Output=$HOME/coverage.json --ReportType=JSON
- name: Upload Coverage Results
uses: actions/upload-artifact@v4
with:
name: Coverage
- name: Produce Job Summary
run: |
printf "${{ steps.run_tests.outcome == 'success' && 'Test run success!' || 'Test run **FAILED**!' }}\n**Engine Coverage**: %s%%\n**Test Code Utilization**: %s%%" \
"$(jq '.Children[] | select(.Kind == "Assembly" and .Name == "BinaryMatrixEngine") | .CoveragePercent' "$HOME/coverage.json")" \
"$(jq '.Children[] | select(.Kind == "Assembly" and .Name == "BinaryMatrixEngine.Tests") | .CoveragePercent' "$HOME/coverage.json")" \
> $GITHUB_STEP_SUMMARY