mini optimize #181
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-Debug | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| pull_request: | |
| branches: | |
| - "main" | |
| jobs: | |
| build-dotnet: | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - uses: Cysharp/Actions/.github/actions/checkout@main | |
| - uses: Cysharp/Actions/.github/actions/setup-dotnet@main | |
| - run: dotnet build -c Release | |
| - run: dotnet test -c Release --no-build | |
| check-codecov-token: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run_codecoverage: ${{ steps.check-token.outputs.token_exists }} | |
| steps: | |
| - id: check-token | |
| shell: pwsh | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| run: | | |
| if(![string]::IsNullOrEmpty($env:CODECOV_TOKEN)) | |
| { | |
| echo "token_exists=true" >> $env:GITHUB_OUTPUT | |
| } | |
| else | |
| { | |
| echo "token_exists=false" >> $env:GITHUB_OUTPUT | |
| } | |
| code-coverage: | |
| if: ${{ needs.check-codecov-token.outputs.run_codecoverage == 'true' }} # secrets can't referenced in `if` so it needs separate job. | |
| needs: check-codecov-token | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: Cysharp/Actions/.github/actions/checkout@main | |
| - uses: Cysharp/Actions/.github/actions/setup-dotnet@main | |
| - run: dotnet build -c Release | |
| - name: Enable diagnostics (It's disabled by `Cysharp/Actions/.github/actions/setup-dotnet`) | |
| run: echo "COMPlus_EnableDiagnostics=1" >> $GITHUB_ENV | |
| - name: Install `dotnet-coverage` tool | |
| run: dotnet tool install -g dotnet-coverage | |
| - name: Collect code coverage | |
| shell: pwsh | |
| working-directory: tests | |
| run: | | |
| $PSNativeCommandUseErrorActionPreference = $true | |
| $sessionId = 'ZLinq' | |
| dotnet coverage collect --session-id $sessionId --nologo --settings codecoverage.runsettings --server-mode --background | |
| try | |
| { | |
| dotnet coverage connect $sessionId --nologo "dotnet test ../ -c Release --framework net9.0 --no-build" | |
| # TODO: Add System.Linq.Tests coverage collection. | |
| } | |
| finally | |
| { | |
| dotnet coverage shutdown $sessionId --nologo --timeout 60000 | |
| } | |
| # Upload coverage data to CodeCov | |
| - uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0 | |
| with: | |
| fail_ci_if_error: false | |
| files: tests/TestResults/coverage.cobertura.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} |