@@ -60,15 +60,12 @@ jobs:
6060 run : dotnet test AiDotNet.sln -c Release --no-build --collect:"XPlat Code Coverage" --results-directory ./TestResults
6161
6262 - name : Upload coverage to Codecov
63- run : |
64- if [ -n "${CODECOV_TOKEN}" ]; then
65- echo "Uploading coverage to Codecov..."
66- npx codecov -t "${CODECOV_TOKEN}" -d "./TestResults" || echo "Codecov upload failed"
67- else
68- echo "CODECOV_TOKEN not set; skipping Codecov upload."
69- fi
70- env :
71- CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
63+ uses : codecov/codecov-action@v4
64+ with :
65+ token : ${{ secrets.CODECOV_TOKEN }}
66+ files : ./TestResults/**/coverage.cobertura.xml
67+ flags : unittests
68+ fail_ci_if_error : true
7269
7370 - name : Publish core library (sanity)
7471 run : |
@@ -111,16 +108,13 @@ jobs:
111108 run : |
112109 dotnet test AiDotNet.sln --configuration Release --collect:"XPlat Code Coverage" --results-directory ./TestResults
113110
114- - name : Upload coverage to Codecov (only if token set)
115- run : |
116- if [ -n "${CODECOV_TOKEN}" ]; then
117- echo "Uploading coverage to Codecov..."
118- npx codecov -t "${CODECOV_TOKEN}" -f "./TestResults/**/coverage.cobertura.xml" -F unittests || echo "Codecov upload failed"
119- else
120- echo "CODECOV_TOKEN not set; skipping Codecov upload."
121- fi
122- env :
123- CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
111+ - name : Upload coverage to Codecov (unit tests)
112+ uses : codecov/codecov-action@v4
113+ with :
114+ token : ${{ secrets.CODECOV_TOKEN }}
115+ files : ./TestResults/**/coverage.cobertura.xml
116+ flags : unittests
117+ fail_ci_if_error : false
124118
125119 integration-test :
126120 name : Integration Tests
0 commit comments