diff --git a/.github/workflows/codecoverage.yml b/.github/workflows/codecoverage.yml index 96ba097..7d02dae 100644 --- a/.github/workflows/codecoverage.yml +++ b/.github/workflows/codecoverage.yml @@ -16,36 +16,40 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v6 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x - 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 + run: dotnet build EstateReportingAPI.sln --configuration Release --no-restore - 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" + dotnet run --project "EstateReportingAPI.Tests\EstateReportingAPI.Tests.csproj" --configuration Release --no-build -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml --results-directory "./coverage/unit" - 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 + dotnet run --project "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" --configuration Release --no-build -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml --results-directory "./coverage/integration" - - name: Merge LCOV reports - run: | - mkdir -p coverage - lcov-result-merger "*.info" > lcov.info + - name: Merge Coverage Reports + uses: danielpalme/ReportGenerator-GitHub-Action@v5 + with: + reports: ./coverage/**/*.cobertura.xml + targetdir: ./coverage-report + reporttypes: Cobertura - name: Upload merged coverage to Codacy uses: codacy/codacy-coverage-reporter-action@v1 with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: ./lcov.info + coverage-reports: ./coverage-report/Cobertura.xml diff --git a/.github/workflows/nightlybuild.yml b/.github/workflows/nightlybuild.yml index a113ca0..2196acf 100644 --- a/.github/workflows/nightlybuild.yml +++ b/.github/workflows/nightlybuild.yml @@ -19,7 +19,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v6 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x - name: Set Up Variables run: echo "action_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV @@ -28,19 +33,19 @@ jobs: run: dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} - name: Build Code - run: dotnet build EstateReportingAPI.sln --configuration Release + run: dotnet build EstateReportingAPI.sln --configuration Release --no-restore - 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" + dotnet run --project "EstateReportingAPI.Tests\EstateReportingAPI.Tests.csproj" --configuration Release --no-build -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml --results-directory "./coverage/unit" - 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" + dotnet run --project "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" --configuration Release --no-build -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml --results-directory "./coverage/integration" - uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index b534753..6916776 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -14,22 +14,27 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 - + - uses: actions/checkout@v6 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + - 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 + run: dotnet build EstateReportingAPI.sln --configuration Release --no-restore - name: Run Unit Tests run: | echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}" - dotnet test "EstateReportingAPI.Tests\EstateReportingAPI.Tests.csproj" + dotnet run --project "EstateReportingAPI.Tests\EstateReportingAPI.Tests.csproj" --configuration Release --no-build - name: Run Integration Tests run: | - dotnet test "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" + dotnet run --project "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" --configuration Release --no-build - uses: actions/upload-artifact@v4 with: diff --git a/Directory.Packages.props b/Directory.Packages.props index 4941d07..0b136cb 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,53 +3,53 @@ true - - - - - - - + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - + + + - - + + - - + + - - - - - - - + + + + + + + - + - - + + - \ No newline at end of file + diff --git a/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj b/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj index c351496..ab0fcf5 100644 --- a/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj +++ b/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj @@ -2,6 +2,8 @@ net10.0 + Exe + true Full false @@ -17,9 +19,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + all - runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj b/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj index 82e66d9..aec0648 100644 --- a/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj +++ b/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj @@ -2,6 +2,8 @@ net10.0 + Exe + true Full false @@ -26,11 +28,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/EstateReportingAPI/Dockerfile b/EstateReportingAPI/Dockerfile index 4e6970e..1a35fb3 100644 --- a/EstateReportingAPI/Dockerfile +++ b/EstateReportingAPI/Dockerfile @@ -3,7 +3,7 @@ WORKDIR /app FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build WORKDIR /src -COPY ["EstateReportingAPI/NuGet.Config", "."] +COPY ["NuGet.Config", "."] COPY ["EstateReportingAPI/EstateReportingAPI.csproj", "EstateReportingAPI/"] COPY ["Directory.Packages.props", "."] COPY . . diff --git a/EstateReportingAPI/NuGet.Config b/NuGet.Config similarity index 100% rename from EstateReportingAPI/NuGet.Config rename to NuGet.Config