Updated file path for test results publishing. #3
This file contains hidden or 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: Build and test API on push or PR | |
| #asdf | |
| #controls when the workflow is triggered. Works on push or pull request to main branch | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| # specify the permissions for the workflow | |
| permissions: | |
| contents: read #needed to read the repository content | |
| checks: write #needed to post check run results | |
| pull-requests: write #needed to post PR comments for test results | |
| # workflow is made of one or more jobs that can be run sequentially or in parallel | |
| jobs: | |
| run-tests: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: "8.x" | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Run tests | |
| run: | | |
| mkdir -p test-results | |
| dotnet test --logger "trx;LogFileName=test-results.trx" --results-directory test-results | |
| continue-on-error: true | |
| - name: Debug - List test results directory | |
| run: | | |
| echo "Contents of test-results directory:" | |
| ls -la test-results/ || echo "test-results directory not found" | |
| echo "Looking for .trx files:" | |
| find . -name "*.trx" -type f || echo "No .trx files found" | |
| echo "Current working directory:" | |
| pwd | |
| echo "All files in current directory:" | |
| ls -la | |
| - name: Publish Test Results | |
| uses: dorny/test-reporter@v1 | |
| if: always() | |
| with: | |
| name: .NET Tests | |
| path: test-results/*.trx | |
| reporter: dotnet-trx |