From 7fea2a4c04264864e8671c0ac074d3a40ebcbaef Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 27 Feb 2026 13:17:00 +0000 Subject: [PATCH 1/2] Remove LCOV merger and Codacy coverage upload steps Removed LCOV merger installation and coverage upload steps. --- .github/workflows/nightlybuild.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/nightlybuild.yml b/.github/workflows/nightlybuild.yml index 558a691..f83ab3f 100644 --- a/.github/workflows/nightlybuild.yml +++ b/.github/workflows/nightlybuild.yml @@ -37,20 +37,6 @@ jobs: run: | dotnet test "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov2.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov" - - name: Install LCOV merger - run: npm install -g lcov-result-merger - - - name: Merge LCOV reports - run: | - mkdir -p coverage - lcov-result-merger "*.info" > lcov.info - - - name: Upload merged coverage to Codacy - uses: codacy/codacy-coverage-reporter-action@v1 - with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: ./lcov.info - - uses: actions/upload-artifact@v4 if: ${{ failure() }} with: From b684705f5f0d1d229a86f478a7000947502997e6 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 27 Feb 2026 13:18:25 +0000 Subject: [PATCH 2/2] Add GitHub Actions workflow for code coverage --- .github/workflows/codecoverage.yml | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/codecoverage.yml diff --git a/.github/workflows/codecoverage.yml b/.github/workflows/codecoverage.yml new file mode 100644 index 0000000..96ba097 --- /dev/null +++ b/.github/workflows/codecoverage.yml @@ -0,0 +1,51 @@ +name: Code Coverage + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - main + workflow_dispatch: + +jobs: + codecoverage: + name: "Code Coverage" + env: + ASPNETCORE_ENVIRONMENT: "Production" + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2.3.4 + + - name: Restore Nuget Packages + run: dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} + + - name: Build Code + run: dotnet build EstateReportingAPI.sln --configuration Release + + - name: Run Unit Tests + run: | + echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}" + dotnet test "EstateReportingAPI.Tests\EstateReportingAPI.Tests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov1.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov" + + - name: Build Docker Image + run: docker build . --file EstateReportingAPI/Dockerfile --tag estatereportingapi:latest + + - name: Run Integration Tests + run: | + dotnet test "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov2.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov" + + - name: Install LCOV merger + run: npm install -g lcov-result-merger + + - name: Merge LCOV reports + run: | + mkdir -p coverage + lcov-result-merger "*.info" > lcov.info + + - name: Upload merged coverage to Codacy + uses: codacy/codacy-coverage-reporter-action@v1 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: ./lcov.info