From 6c7c68cc53b17e25136edb4717ce3694aa9a055b Mon Sep 17 00:00:00 2001 From: Nick Ficano Date: Sun, 24 May 2026 21:21:31 -0400 Subject: [PATCH] ci: collect + upload coverage to Codecov Enable `--collect:"XPlat Code Coverage"` on the unit test run (coverlet.collector is already a dev dependency in both test projects) and upload the produced Cobertura XML(s) to Codecov non-blockingly. Requires CODECOV_TOKEN to be set as a repo secret. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/test.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f11c3ad..62cdc28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -75,16 +75,29 @@ jobs: - name: Build run: dotnet build ARCP.slnx --configuration Release --no-restore - - name: Test (unit) + - name: Test (unit, with coverage) run: > dotnet test tests/Arcp.UnitTests/Arcp.UnitTests.fsproj --configuration Release --no-build --verbosity normal + --collect:"XPlat Code Coverage" --logger "trx;LogFileName=unit-tests.trx" --logger "console;verbosity=normal" --results-directory ${{ github.workspace }}/TestResults + # coverlet.collector writes one coverage.cobertura.xml per test + # project under TestResults//. Non-blocking so a Codecov + # outage cannot break CI. + - name: Upload coverage to Codecov + # codecov/codecov-action v6.0.1 + uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 + with: + fail_ci_if_error: false + flags: unittests + directory: ${{ github.workspace }}/TestResults + token: ${{ secrets.CODECOV_TOKEN }} + - name: Upload test results if: failure() uses: actions/upload-artifact@v7