save #47
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: .NET | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| pull-requests: write | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore src/ | |
| - name: Build | |
| run: dotnet build src/ --configuration Release --no-restore | |
| - name: Unit Tests | |
| run: dotnet test src/Watcher.Runner.Tests.Unit --configuration Release --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=coverage.opencover.xml /p:CoverletOutputDirectory=$(pwd)/coverage /p:ExcludeByAttribute=CompilerGeneratedAttribute | |
| - name: Show coverage file (debug) | |
| if: always() | |
| run: | | |
| echo "Coverage dir listing:" || true | |
| ls -la coverage || true | |
| echo "First 120 lines of coverage file:" || true | |
| sed -n '1,120p' coverage/coverage.opencover.xml || true | |
| - name: Upload coverage artifact (debug) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage/coverage.opencover.xml | |
| - name: Upload coverage to Codecov | |
| if: always() | |
| uses: codecov/codecov-action@v5 | |
| env: | |
| CODECOV_DEBUG: "1" | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/coverage.opencover.xml | |
| flags: unit | |
| fail_ci_if_error: false | |
| - name: Upload test results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: src/Watcher.Runner.Tests.Unit/bin/Release/net9.0/ |