diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 2e71314..e8fdd6f 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,4 +1,4 @@ - + name: Pull Request on: @@ -8,35 +8,88 @@ on: jobs: - test: + test-linux: + + runs-on: ubuntu-latest + + env: + Solution_Name: GofPatterns.sln + Test_Project_Path: GofPatternsTests\GofPatternsTests.csproj + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x - strategy: - matrix: - configuration: [Debug] - os: [windows-latest, ubuntu-latest] + - name: Restore dependencies + run: dotnet restore - runs-on: ${{ matrix.os }} + - name: Build + run: dotnet build --configuration Debug --no-restore + + - name: Test + run: dotnet test --configuration Debug --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage + + - name: Code Coverage Result MD + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: coverage/**/coverage.cobertura.xml + badge: true + fail_below_min: true + format: markdown + hide_branch_rate: false + hide_complexity: true + indicators: true + output: both + thresholds: '80 90' + + - name: Code Coverage Result MD + uses: marocchino/sticky-pull-request-comment@v2 + with: + recreate: true + path: code-coverage-results.md + + - name: Write to Job Summary + run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY + + test-windows: + + runs-on: windows-latest env: Solution_Name: GofPatterns.sln Test_Project_Path: GofPatternsTests\GofPatternsTests.csproj steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.2 - - name: Install .NET Core - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore - - name: Restore dependencies - run: dotnet restore + - name: Build + run: dotnet build - - name: Build - run: dotnet build + - name: Test + run: dotnet test - - name: Test - run: dotnet test \ No newline at end of file + - name: Restore the application + run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration + env: + Configuration: Debug diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ec54c9..8d41d55 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,6 @@ on: branches: - 'main' - jobs: release: @@ -18,27 +17,49 @@ jobs: Test_Project_Path: GofPatternsTests\GofPatternsTests.csproj steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install .NET Core - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build -c Release --no-restore - - - name: Test - run: dotnet test -c Release --no-restore --no-build --verbosity normal --filter "Category!=LongRunning" - - - name: Pack - run: dotnet pack GofPatterns/GofPatterns.csproj -c Release --no-restore --no-build --include-symbols -p:SymbolPackageFormat=snupkg -o . + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build -c Release --no-restore + + - name: Test + run: dotnet test -c Release --no-restore --no-build --verbosity normal --filter "Category!=LongRunning" --collect:"XPlat Code Coverage" --results-directory ./coverage + + - name: Code Coverage Report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: coverage/**/coverage.cobertura.xml + badge: true + fail_below_min: true + format: markdown + hide_branch_rate: false + hide_complexity: true + indicators: true + output: both + thresholds: '80 90' + + - name: Code Coverage Result MD + uses: marocchino/sticky-pull-request-comment@v2 + with: + recreate: true + path: code-coverage-results.md + + - name: Write to Job Summary + run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY + + - name: Pack + run: dotnet pack GofPatterns/GofPatterns.csproj -c Release --no-restore --no-build --include-symbols -p:SymbolPackageFormat=snupkg -o . - # Push to NuGet - - name: Deploy - run: dotnet nuget push *.nupkg --skip-duplicate -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} \ No newline at end of file + # Push to NuGet + - name: Deploy + run: dotnet nuget push *.nupkg --skip-duplicate -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d74ea19..f1384b8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,7 @@ on: push: branches: - '**' - - '!master' + - '!main' - '!dev' jobs: @@ -19,21 +19,43 @@ jobs: Test_Project_Path: GofPatternsTests\GofPatternsTests.csproj steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install .NET Core - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build - - - name: Test - run: dotnet test \ No newline at end of file + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Debug --no-restore + + - name: Test + run: dotnet test --configuration Debug --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage + + - name: Code Coverage Result MD + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: coverage/**/coverage.cobertura.xml + badge: true + fail_below_min: true + format: markdown + hide_branch_rate: false + hide_complexity: true + indicators: true + output: both + thresholds: '80 90' + + - name: Code Coverage Result MD + uses: marocchino/sticky-pull-request-comment@v2 + with: + recreate: true + path: code-coverage-results.md + + - name: Write to Job Summary + run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/README.md b/README.md index 07b7d75..5335c3b 100644 --- a/README.md +++ b/README.md @@ -53,4 +53,14 @@ just click on the link of the design pattern to go to the respective page of the - [Factory](README/Creational/Factory.md) - [Abstract Factory](README/Creational/AbstractFactory.md) -- [Builder](README/Creational/Builder.md) \ No newline at end of file +- [Builder](README/Creational/Builder.md) + + +## Code coverage + +- The code coverage is exceptional for the library, and the examples provided for each pattern +- The library is tested for all the patterns, and the examples are also tested for the patterns they are demonstrating. + +### Result + +To view the coverage result please see the Actions tab of the repository. \ No newline at end of file