From 7df3ccec5484e097d1af60f5e42e7d6318cb2c65 Mon Sep 17 00:00:00 2001 From: dev-javid <94961512+dev-javid@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:41:55 +0530 Subject: [PATCH 01/18] Create test-suite.yml --- .github/workflows/dotnet.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..b097c75 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,18 @@ +name: Test Suite + +on: + push: + branches: [ "*" ] + pull_request: + branches: [ "main" ] + +jobs: + tests: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Docker Compose Up + run: docker compose -f docker-compose.tests.yml up -d --build From c6438ac9ad2c5c849c0d77a23ed8ec34df8a0271 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 10:51:12 +0530 Subject: [PATCH 02/18] Added verbose docker logs --- .github/workflows/dotnet.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b097c75..02cd38c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -2,17 +2,16 @@ name: Test Suite on: push: - branches: [ "*" ] + branches: ["*"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: tests: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Docker Compose Up - run: docker compose -f docker-compose.tests.yml up -d --build + - name: Docker Compose Up + run: docker compose --verbose -f docker-compose.tests.yml up -d --build From b116d8d4be982370a9b16ca41118f88a0970c40c Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 10:55:22 +0530 Subject: [PATCH 03/18] Failing test check --- .github/workflows/dotnet.yml | 2 +- .../Tests.Architecture/Database/DomainProjectReferenceTests.cs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 02cd38c..3e7b9b9 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -14,4 +14,4 @@ jobs: - uses: actions/checkout@v4 - name: Docker Compose Up - run: docker compose --verbose -f docker-compose.tests.yml up -d --build + run: docker compose --verbose -f docker-compose.tests.yml up -d --build diff --git a/tests/Tests.Architecture/Database/DomainProjectReferenceTests.cs b/tests/Tests.Architecture/Database/DomainProjectReferenceTests.cs index 6103493..36325c1 100644 --- a/tests/Tests.Architecture/Database/DomainProjectReferenceTests.cs +++ b/tests/Tests.Architecture/Database/DomainProjectReferenceTests.cs @@ -16,7 +16,6 @@ public void Domain_Should_Not_Have_Dependency_On_Other_Projects() ProjectNames.Application, ProjectNames.Infrastructure, ProjectNames.Domain, - ProjectNames.Domain, }; // Act @@ -27,7 +26,7 @@ public void Domain_Should_Not_Have_Dependency_On_Other_Projects() .GetResult(); // Assert - result.IsSuccessful.Should().BeTrue(); + result.IsSuccessful.Should().BeFalse(); } } } From 7fa6a37a91d7c2d0149442ce969e84509cd93161 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 11:01:50 +0530 Subject: [PATCH 04/18] Update dotnet.yml --- .github/workflows/dotnet.yml | 45 +++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 3e7b9b9..d354ab2 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,17 +1,46 @@ -name: Test Suite +name: .NET on: push: - branches: ["*"] + branches: [ "*" ] pull_request: - branches: ["main"] + branches: [ "main" ] jobs: - tests: + build: + runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + services: + postgres: + image: postgres:latest + env: + POSTGRES_USER: myuser + POSTGRES_PASSWORD: mypassword + POSTGRES_DB: mydatabase + ports: + - 5432:5432 + options: >- + --health-cmd="pg_isready -U myuser" + --health-interval=10s + --health-timeout=5s + --health-retries=5 - - name: Docker Compose Up - run: docker compose --verbose -f docker-compose.tests.yml up -d --build + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + env: + ConnectionStrings__Default: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" + ConnectionStrings__Jobs: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" + Serilog__WriteTo__0__Args__connectionString: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" + Serilog__WriteTo__0__Name: "PostgreSQL" + Serilog__WriteTo__0__Args__tableName: "log_table" + run: dotnet test --no-build --verbosity detailed From ea315d2c9b4486c22afe01c075d928f39168539b Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 11:06:01 +0530 Subject: [PATCH 05/18] Setup Node.js for SPA --- .github/workflows/dotnet.yml | 43 +++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d354ab2..e4edecd 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -2,13 +2,12 @@ name: .NET on: push: - branches: [ "*" ] + branches: ["*"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: build: - runs-on: ubuntu-latest services: @@ -27,20 +26,24 @@ jobs: --health-retries=5 steps: - - uses: actions/checkout@v4 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build - run: dotnet build --no-restore - - name: Test - env: - ConnectionStrings__Default: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" - ConnectionStrings__Jobs: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" - Serilog__WriteTo__0__Args__connectionString: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" - Serilog__WriteTo__0__Name: "PostgreSQL" - Serilog__WriteTo__0__Args__tableName: "log_table" - run: dotnet test --no-build --verbosity detailed + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + env: + ConnectionStrings__Default: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" + ConnectionStrings__Jobs: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" + Serilog__WriteTo__0__Args__connectionString: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" + Serilog__WriteTo__0__Name: "PostgreSQL" + Serilog__WriteTo__0__Args__tableName: "log_table" + run: dotnet test --no-build --verbosity detailed From d04840ee07e4e45ff7e742ac04696618cbfcbe86 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 11:24:05 +0530 Subject: [PATCH 06/18] Update react.client.esproj --- src/presentation.client/react.client.esproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/presentation.client/react.client.esproj b/src/presentation.client/react.client.esproj index b0a4ed1..0b98ba0 100644 --- a/src/presentation.client/react.client.esproj +++ b/src/presentation.client/react.client.esproj @@ -8,4 +8,7 @@ $(MSBuildProjectDirectory)\dist + + net8.0 + \ No newline at end of file From ba9220ec591ff265ddcf6bd0c44e44cc90ac0cc8 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 11:41:06 +0530 Subject: [PATCH 07/18] Install .NET workloads --- .github/workflows/dotnet.yml | 11 +++++++++++ src/presentation.client/react.client.esproj | 3 --- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e4edecd..14d9216 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -27,18 +27,28 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x + - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: "20" + + - name: Install .NET workloads + run: | + dotnet workload install spa-templates + dotnet workload restore + - name: Restore dependencies run: dotnet restore + - name: Build run: dotnet build --no-restore + - name: Test env: ConnectionStrings__Default: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" @@ -46,4 +56,5 @@ jobs: Serilog__WriteTo__0__Args__connectionString: "Host=localhost;Port=5432;Username=myuser;Password=mypassword;Database=mydatabase;" Serilog__WriteTo__0__Name: "PostgreSQL" Serilog__WriteTo__0__Args__tableName: "log_table" + run: dotnet test --no-build --verbosity detailed diff --git a/src/presentation.client/react.client.esproj b/src/presentation.client/react.client.esproj index 0b98ba0..b0a4ed1 100644 --- a/src/presentation.client/react.client.esproj +++ b/src/presentation.client/react.client.esproj @@ -8,7 +8,4 @@ $(MSBuildProjectDirectory)\dist - - net8.0 - \ No newline at end of file From 8c9e6b478fada3709c66dcca8de6b840b76bd845 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 11:43:59 +0530 Subject: [PATCH 08/18] Update dotnet.yml --- .github/workflows/dotnet.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 14d9216..05fe843 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -38,13 +38,8 @@ jobs: with: node-version: "20" - - name: Install .NET workloads - run: | - dotnet workload install spa-templates - dotnet workload restore - - name: Restore dependencies - run: dotnet restore + run: dotnet restore --ignore-failed-sources - name: Build run: dotnet build --no-restore From 09175f14c54babc574027ba6d0ce650c7b2f00b6 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 11:55:06 +0530 Subject: [PATCH 09/18] ReactProjectExclude --- .github/workflows/dotnet.yml | 2 +- src/Presentation.Server/Presentation.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 05fe843..c48735b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -39,7 +39,7 @@ jobs: node-version: "20" - name: Restore dependencies - run: dotnet restore --ignore-failed-sources + run: dotnet restore BitHrms.sln /p:ReactProjectExclude=true - name: Build run: dotnet build --no-restore diff --git a/src/Presentation.Server/Presentation.csproj b/src/Presentation.Server/Presentation.csproj index 3afc1ae..35734ee 100644 --- a/src/Presentation.Server/Presentation.csproj +++ b/src/Presentation.Server/Presentation.csproj @@ -30,7 +30,7 @@ - + false From 55a5af339bb86a25caa3d8c2eb91d082679b5e08 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 11:59:48 +0530 Subject: [PATCH 10/18] Update dotnet.yml --- .github/workflows/dotnet.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c48735b..3ea5ee0 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -38,11 +38,8 @@ jobs: with: node-version: "20" - - name: Restore dependencies - run: dotnet restore BitHrms.sln /p:ReactProjectExclude=true - - name: Build - run: dotnet build --no-restore + run: dotnet build /p:ReactProjectExclude=true - name: Test env: From 98d3327e52a9115d033fd6d18d5312edbfd34c92 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 13:13:38 +0530 Subject: [PATCH 11/18] Update Presentation.csproj --- src/Presentation.Server/Presentation.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Presentation.Server/Presentation.csproj b/src/Presentation.Server/Presentation.csproj index 35734ee..3afc1ae 100644 --- a/src/Presentation.Server/Presentation.csproj +++ b/src/Presentation.Server/Presentation.csproj @@ -30,7 +30,7 @@ - + false From 0f838369742117eae2fbfddff12e33e88e2caf2f Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 13:18:35 +0530 Subject: [PATCH 12/18] Update dotnet.yml --- .github/workflows/dotnet.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 3ea5ee0..c4a7ef0 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -33,13 +33,17 @@ jobs: with: dotnet-version: 8.0.x - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" + - name: Remove front end reference + run: | + cd src\Presentation.Server + dotnet remove reference ..\presentation.client\react.client.esproj + cd ../.. + + - name: Restore dependencies + run: dotnet restore - name: Build - run: dotnet build /p:ReactProjectExclude=true + run: dotnet build --no-restore - name: Test env: From f7e633c3257b04ced327581a79ed9e8da05c1eb2 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 13:19:45 +0530 Subject: [PATCH 13/18] Update dotnet.yml --- .github/workflows/dotnet.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c4a7ef0..4dacee9 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -35,8 +35,8 @@ jobs: - name: Remove front end reference run: | - cd src\Presentation.Server - dotnet remove reference ..\presentation.client\react.client.esproj + cd src/Presentation.Server + dotnet remove reference ../presentation.client/react.client.esproj cd ../.. - name: Restore dependencies From f3e027725b5402209d163de8435419c6f1faff81 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 13:21:33 +0530 Subject: [PATCH 14/18] Update dotnet.yml --- .github/workflows/dotnet.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 4dacee9..d4090a9 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -37,7 +37,6 @@ jobs: run: | cd src/Presentation.Server dotnet remove reference ../presentation.client/react.client.esproj - cd ../.. - name: Restore dependencies run: dotnet restore From 94178dc478de9dd2ff2e32333f3c5c74787df01c Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 13:26:03 +0530 Subject: [PATCH 15/18] Remove front end project reference --- .github/workflows/dotnet.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d4090a9..87fadaa 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -33,10 +33,12 @@ jobs: with: dotnet-version: 8.0.x - - name: Remove front end reference + - name: Remove front end project reference run: | cd src/Presentation.Server dotnet remove reference ../presentation.client/react.client.esproj + cd ../.. + dotnet sln remove src/presentation.client/react.client.esproj - name: Restore dependencies run: dotnet restore From 99e495ed2f9dfca0a0956abf8418c86faa72d8b3 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 13:32:12 +0530 Subject: [PATCH 16/18] Update dotnet.yml --- .github/workflows/dotnet.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 87fadaa..d3ea0b1 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -26,7 +26,10 @@ jobs: --health-retries=5 steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # This ensures a full clone of the repository - name: Setup .NET uses: actions/setup-dotnet@v4 From 78f172eb3a065918309524d729e3aab61b63ae3c Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 13:36:24 +0530 Subject: [PATCH 17/18] Update DomainProjectReferenceTests.cs --- tests/Tests.Architecture/Domain/DomainProjectReferenceTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Tests.Architecture/Domain/DomainProjectReferenceTests.cs b/tests/Tests.Architecture/Domain/DomainProjectReferenceTests.cs index 8d7dfcd..26a52fc 100644 --- a/tests/Tests.Architecture/Domain/DomainProjectReferenceTests.cs +++ b/tests/Tests.Architecture/Domain/DomainProjectReferenceTests.cs @@ -26,7 +26,7 @@ public void Domain_Should_Not_Have_Dependency_On_Other_Projects() .GetResult(); // Assert - result.IsSuccessful.Should().BeTrue(); + result.IsSuccessful.Should().BeFalse(); } } } From 6f46e8068fc02d41a01964573804ce7755ab9f12 Mon Sep 17 00:00:00 2001 From: dev-javid Date: Thu, 19 Sep 2024 13:59:57 +0530 Subject: [PATCH 18/18] Test fixes --- .../Database/DomainProjectReferenceTests.cs | 4 ++-- .../Tests.Architecture/Domain/DomainProjectReferenceTests.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Tests.Architecture/Database/DomainProjectReferenceTests.cs b/tests/Tests.Architecture/Database/DomainProjectReferenceTests.cs index 36325c1..b128b06 100644 --- a/tests/Tests.Architecture/Database/DomainProjectReferenceTests.cs +++ b/tests/Tests.Architecture/Database/DomainProjectReferenceTests.cs @@ -6,7 +6,7 @@ namespace Tests.Architecture.Database public class DomainProjectReferenceTests { [Fact] - public void Domain_Should_Not_Have_Dependency_On_Other_Projects() + public void Database_Should_Not_Have_Dependency_On_Other_Projects() { // Arrange var assembly = Assembly.Load(ProjectNames.Domain); @@ -26,7 +26,7 @@ public void Domain_Should_Not_Have_Dependency_On_Other_Projects() .GetResult(); // Assert - result.IsSuccessful.Should().BeFalse(); + result.IsSuccessful.Should().BeTrue(); } } } diff --git a/tests/Tests.Architecture/Domain/DomainProjectReferenceTests.cs b/tests/Tests.Architecture/Domain/DomainProjectReferenceTests.cs index 26a52fc..8d7dfcd 100644 --- a/tests/Tests.Architecture/Domain/DomainProjectReferenceTests.cs +++ b/tests/Tests.Architecture/Domain/DomainProjectReferenceTests.cs @@ -26,7 +26,7 @@ public void Domain_Should_Not_Have_Dependency_On_Other_Projects() .GetResult(); // Assert - result.IsSuccessful.Should().BeFalse(); + result.IsSuccessful.Should().BeTrue(); } } }