Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4

Expand All @@ -23,10 +24,34 @@ jobs:
run: dotnet restore EasySourceGenerators.sln

- name: Test
run: dotnet test EasySourceGenerators.sln --no-restore --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
run: dotnet test EasySourceGenerators.sln --no-restore --verbosity normal --collect:"XPlat Code Coverage" --logger "trx;LogFilePrefix=test-results" --results-directory ./coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
directory: ./coverage
use_oidc: true
fail_ci_if_error: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

- name: Convert TRX to JUnit XML
if: ${{ !cancelled() }}
run: |
if dotnet tool list --global | grep -q '^trx2junit '; then
dotnet tool update --global trx2junit --version 2.1.0
else
dotnet tool install --global trx2junit --version 2.1.0
fi
TRX_FILES="$(find ./coverage -type f -name '*.trx')"
if [ -n "$TRX_FILES" ]; then
trx2junit $TRX_FILES
else
echo "No TRX files found in ./coverage."
fi

- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/*.xml
Comment on lines +54 to +56

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step relies on secrets.CODECOV_TOKEN, but on pull_request workflows secrets are not provided to runs from forked repositories. If a fork PR triggers this workflow, the token will be empty and the action may fail. Consider guarding the step with a token-present condition (or switching to an auth method that works for fork PRs).

Copilot uses AI. Check for mistakes.
disable_search: true
Comment on lines +51 to +57

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codecov/test-results-action is always executed, even when the previous step finds no TRX files (and therefore produces no JUnit XML). This can cause the workflow to fail or produce noisy Codecov errors like “No JUnit XML reports found”. Consider conditionally running this step only when converted JUnit files exist (e.g., have the conversion step set an output flag when it finds TRX/JUnit files and use that in the if: expression).

Copilot uses AI. Check for mistakes.
Loading