diff --git a/.github/workflows/build-test-coverage-dotnet.yml b/.github/workflows/build-test-coverage-dotnet.yml new file mode 100644 index 00000000..bfc52a36 --- /dev/null +++ b/.github/workflows/build-test-coverage-dotnet.yml @@ -0,0 +1,73 @@ +name: Build Test Coverage + +on: + push: + branches: + - develop + - gh-actions-coverage + + pull_request: + branches: [ develop ] + + workflow_dispatch: + +jobs: + build-and-test-dotnet: + name: Build Test Coverage + runs-on: ubuntu-latest + + steps: + - name: Fetch Sources + uses: actions/checkout@v3 + + - name: Setup .NET 6.0 SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Restore Nuget Packages + run: dotnet restore + + - name: Build .NET Project + run: | + dotnet build --no-restore /p:ContinuousIntegrationBuild=true --configuration Release + + - name: Install and Run Azurite + run: | + npm install -g azurite + mkdir azurite + azurite --silent --location azurite --debug azurite\debug.log & + + - name: Run SQLServer docker container + run: | + docker run -e 'SA_PASSWORD=x2yiJt!Fs' -e ACCEPT_EULA=y --name mango-mssql-db --hostname mango-mssql-db -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest + + - name: Wait for container + run: pwsh ./scripts/wait_database.ps1 + + - name: Run Integration Tests + run: | + dotnet test MangoAPI.IntegrationTests/MangoAPI.IntegrationTests.csproj --configuration Release --no-build + env: + CollectCoverage: true + CoverletOutputFormat: lcov + ThresholdStat: total + ThresholdType: Line + CoverletOutput: TestResults/ + # dotnet test MangoAPI.IntegrationTests/MangoAPI.IntegrationTests.csproj -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=lcov + + - name: Publish coverage report to Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: 'MangoAPI.IntegrationTests/TestResults/coverage.info' + + - name: Publish .NET Project + run: | + dotnet publish "MangoAPI.Presentation/MangoAPI.Presentation.csproj" --configuration "Release" --output "publish" + + - name: Drop Artifact + uses: actions/upload-artifact@v3 + with: + name: 'drop' + path: 'publish' diff --git a/MangoAPI.DiffieHellmanConsole/MangoAPI.DiffieHellmanConsole.csproj b/MangoAPI.DiffieHellmanConsole/MangoAPI.DiffieHellmanConsole.csproj index 02e8f5bc..81db15d3 100644 --- a/MangoAPI.DiffieHellmanConsole/MangoAPI.DiffieHellmanConsole.csproj +++ b/MangoAPI.DiffieHellmanConsole/MangoAPI.DiffieHellmanConsole.csproj @@ -8,6 +8,11 @@ ..\stylecop.ruleset + + + + + ./bin/MangoAPI.DiffieHellmanConsole.xml diff --git a/MangoAPI.DiffieHellmanLibrary/MangoAPI.DiffieHellmanLibrary.csproj b/MangoAPI.DiffieHellmanLibrary/MangoAPI.DiffieHellmanLibrary.csproj index 9aa012b2..4f18e203 100644 --- a/MangoAPI.DiffieHellmanLibrary/MangoAPI.DiffieHellmanLibrary.csproj +++ b/MangoAPI.DiffieHellmanLibrary/MangoAPI.DiffieHellmanLibrary.csproj @@ -7,6 +7,11 @@ ..\stylecop.ruleset + + + + + ./bin/MangoAPI.DiffieHellmanLibrary.xml @@ -16,13 +21,13 @@ - - + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/MangoAPI.Infrastructure/MangoAPI.Infrastructure.csproj b/MangoAPI.Infrastructure/MangoAPI.Infrastructure.csproj index 34b227ac..addd69fc 100644 --- a/MangoAPI.Infrastructure/MangoAPI.Infrastructure.csproj +++ b/MangoAPI.Infrastructure/MangoAPI.Infrastructure.csproj @@ -8,24 +8,29 @@ true + - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - + + diff --git a/MangoAPI.IntegrationTests/MangoAPI.IntegrationTests.csproj b/MangoAPI.IntegrationTests/MangoAPI.IntegrationTests.csproj index d02062c5..46711877 100644 --- a/MangoAPI.IntegrationTests/MangoAPI.IntegrationTests.csproj +++ b/MangoAPI.IntegrationTests/MangoAPI.IntegrationTests.csproj @@ -18,7 +18,7 @@ - + @@ -30,15 +30,15 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -46,7 +46,7 @@ - + diff --git a/MangoAPI.Presentation/MangoAPI.Presentation.csproj b/MangoAPI.Presentation/MangoAPI.Presentation.csproj index a5464d7d..a114a617 100644 --- a/MangoAPI.Presentation/MangoAPI.Presentation.csproj +++ b/MangoAPI.Presentation/MangoAPI.Presentation.csproj @@ -8,6 +8,11 @@ ..\stylecop.ruleset + + + + + ./bin/MangoAPI.Presentation.xml @@ -17,13 +22,13 @@ - + - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/MangoAPI.sln b/MangoAPI.sln index 37fd12f9..da0a2167 100644 --- a/MangoAPI.sln +++ b/MangoAPI.sln @@ -99,6 +99,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ ProjectSection(SolutionItems) = preProject .github\workflows\run-cng-dh-handshake.yml = .github\workflows\run-cng-dh-handshake.yml .github\workflows\run-openssl-dh-handshake.yml = .github\workflows\run-openssl-dh-handshake.yml + .github\workflows\build-test-coverage-dotnet.yml = .github\workflows\build-test-coverage-dotnet.yml EndProjectSection EndProject Global diff --git a/README.md b/README.md index 0ef83a01..fe8bf32b 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,9 @@ Obligatory required software: - **NodeJS:** `16.13.1` - **NPM:** `8.1.2` - **Code Editor or IDE:** Visual studio, Visual studio code, Rider -- **For Visual studio code:** [ESlint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) plugins (also included in the workspace recommendations) +- **For Visual studio code:** [ESlint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) plugins (also included in + the workspace recommendations) ### Run in debug mode @@ -166,6 +168,7 @@ Version control to be organized as follows: - Trello: https://trello.com/b/Z7IlfrRb/mango-messenger-trello - Database diagram: https://dbdiagram.io/d/60d66a13dd6a597148203e6b +- How to exclude project from coverage: https://codyanhorn.tech/blog/excluding-your-net-test-project-from-code-coverage ## Logo Attribution