From 3da1a38e0642a5297c1dbb2c2fcf4c81947d0115 Mon Sep 17 00:00:00 2001 From: Alexandru Macocian Date: Wed, 2 Jun 2021 14:28:46 +0200 Subject: [PATCH 1/7] Introduce CI & CD pipelines --- .github/workflows/cd.yaml | 55 +++++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yaml | 48 ++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 .github/workflows/cd.yaml create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml new file mode 100644 index 0000000..03a065a --- /dev/null +++ b/.github/workflows/cd.yaml @@ -0,0 +1,55 @@ +name: MTSC CD Pipeline + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + + build: + environment: Default + strategy: + matrix: + targetplatform: [x64] + + runs-on: windows-latest + + env: + Configuration: Release + Solution_Path: MTSC.sln + Test_Project_Path: MTSC.UnitTests\MTSC.UnitTests.csproj + Source_Project_Path: MTSC\MTSC.csproj + Actions_Allow_Unsecure_Commands: true + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.202' + + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.1 + + - name: Restore project + run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration /p:RuntimeIdentifier=$env:RuntimeIdentifier + env: + RuntimeIdentifier: win-${{ matrix.targetplatform }} + + - name: Build Slim project + run: dotnet build MTSC -c $env:Configuration + + - name: Push nuget package + uses: brandedoutcast/publish-nuget@v2.5.5 + with: + PROJECT_FILE_PATH: MTSC\MTSC.csproj + NUGET_KEY: ${{secrets.NUGET_API_KEY}} + \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..d32c607 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,48 @@ +name: MTSC CI Pipeline + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + + build: + + strategy: + matrix: + targetplatform: [x64] + + runs-on: windows-latest + + env: + Solution_Path: MTSC.sln + Test_Project_Path: MTSC.UnitTests\MTSC.UnitTests.csproj + Source_Project_Path: MTSC\MTSC.csproj + Actions_Allow_Unsecure_Commands: true + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.202' + + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.1 + + - name: Execute Unit Tests + run: dotnet test $env:Test_Project_Path + + - name: Restore Project + run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration /p:RuntimeIdentifier=$env:RuntimeIdentifier + env: + Configuration: Debug + RuntimeIdentifier: win-${{ matrix.targetplatform }} \ No newline at end of file From d44deb31243b621bd8dc80120ff339863a2ea961 Mon Sep 17 00:00:00 2001 From: Alexandru Macocian Date: Wed, 2 Jun 2021 14:33:04 +0200 Subject: [PATCH 2/7] Change UTs target framework to .net5.0 --- MTSC.UnitTests/MTSC.UnitTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MTSC.UnitTests/MTSC.UnitTests.csproj b/MTSC.UnitTests/MTSC.UnitTests.csproj index 0feeb42..396de1a 100644 --- a/MTSC.UnitTests/MTSC.UnitTests.csproj +++ b/MTSC.UnitTests/MTSC.UnitTests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.0 + net5.0 false From 2ca324be105c1cdaa93792d48faf610e42bfa78a Mon Sep 17 00:00:00 2001 From: Alexandru Macocian Date: Wed, 2 Jun 2021 14:34:14 +0200 Subject: [PATCH 3/7] Fix name --- .github/workflows/cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 03a065a..778cf57 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -44,7 +44,7 @@ jobs: env: RuntimeIdentifier: win-${{ matrix.targetplatform }} - - name: Build Slim project + - name: Build MTSC project run: dotnet build MTSC -c $env:Configuration - name: Push nuget package From bb9ea4773f30c206b9be87323805cae31af0881e Mon Sep 17 00:00:00 2001 From: Alexandru Macocian Date: Wed, 2 Jun 2021 14:58:40 +0200 Subject: [PATCH 4/7] Enable verbosity in unit tests --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d32c607..4ab86ea 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,7 +39,7 @@ jobs: uses: microsoft/setup-msbuild@v1.0.1 - name: Execute Unit Tests - run: dotnet test $env:Test_Project_Path + run: dotnet test $env:Test_Project_Path -v n - name: Restore Project run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration /p:RuntimeIdentifier=$env:RuntimeIdentifier From dfe85bca09d48bdd5af50e92fc2ec596310a6bb5 Mon Sep 17 00:00:00 2001 From: Alexandru Macocian Date: Wed, 2 Jun 2021 15:17:53 +0200 Subject: [PATCH 5/7] Disable problematic tests --- .github/workflows/ci.yaml | 2 +- MTSC.UnitTests/E2ETests.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4ab86ea..0dfd4b2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,7 +39,7 @@ jobs: uses: microsoft/setup-msbuild@v1.0.1 - name: Execute Unit Tests - run: dotnet test $env:Test_Project_Path -v n + run: dotnet test $env:Test_Project_Path -v n --filter "TestCategory!=LocalTest" - name: Restore Project run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration /p:RuntimeIdentifier=$env:RuntimeIdentifier diff --git a/MTSC.UnitTests/E2ETests.cs b/MTSC.UnitTests/E2ETests.cs index 51edd77..c0dc3f3 100644 --- a/MTSC.UnitTests/E2ETests.cs +++ b/MTSC.UnitTests/E2ETests.cs @@ -124,6 +124,7 @@ namespace MTSC.UnitTests } [TestMethod] + [TestCategory("LocalTest")] public void SendFragmentedHttpMessage() { Client.Client client = new Client.Client(); @@ -164,6 +165,7 @@ namespace MTSC.UnitTests } [TestMethod] + [TestCategory("LocalTest")] public void SendFragmentedHttpMessageShouldExpire() { Client.Client client = new Client.Client(); @@ -201,6 +203,7 @@ namespace MTSC.UnitTests } [TestMethod] + [TestCategory("LocalTest")] public void SendFragmentedHttpMessageExceedingSizeShouldExpire() { Client.Client client = new Client.Client(); From 848a56859fc255652456ff81162f3d65e49289e9 Mon Sep 17 00:00:00 2001 From: Alexandru Macocian Date: Wed, 2 Jun 2021 15:28:07 +0200 Subject: [PATCH 6/7] Disable all related server tests for CI --- .github/workflows/ci.yaml | 2 +- MTSC.UnitTests/E2ETests.cs | 4 +--- MTSC.UnitTests/ServerTests.cs | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0dfd4b2..5c6b2ac 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,7 +39,7 @@ jobs: uses: microsoft/setup-msbuild@v1.0.1 - name: Execute Unit Tests - run: dotnet test $env:Test_Project_Path -v n --filter "TestCategory!=LocalTest" + run: dotnet test $env:Test_Project_Path -v n --filter "TestCategory!=ServerTests" - name: Restore Project run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration /p:RuntimeIdentifier=$env:RuntimeIdentifier diff --git a/MTSC.UnitTests/E2ETests.cs b/MTSC.UnitTests/E2ETests.cs index c0dc3f3..af7fb73 100644 --- a/MTSC.UnitTests/E2ETests.cs +++ b/MTSC.UnitTests/E2ETests.cs @@ -26,6 +26,7 @@ using System.Web; namespace MTSC.UnitTests { [TestClass] + [TestCategory("ServerTests")] public class E2ETests { private volatile byte[] receivedMessage = null; @@ -124,7 +125,6 @@ namespace MTSC.UnitTests } [TestMethod] - [TestCategory("LocalTest")] public void SendFragmentedHttpMessage() { Client.Client client = new Client.Client(); @@ -165,7 +165,6 @@ namespace MTSC.UnitTests } [TestMethod] - [TestCategory("LocalTest")] public void SendFragmentedHttpMessageShouldExpire() { Client.Client client = new Client.Client(); @@ -203,7 +202,6 @@ namespace MTSC.UnitTests } [TestMethod] - [TestCategory("LocalTest")] public void SendFragmentedHttpMessageExceedingSizeShouldExpire() { Client.Client client = new Client.Client(); diff --git a/MTSC.UnitTests/ServerTests.cs b/MTSC.UnitTests/ServerTests.cs index 696b90b..02d0125 100644 --- a/MTSC.UnitTests/ServerTests.cs +++ b/MTSC.UnitTests/ServerTests.cs @@ -5,6 +5,7 @@ using System.Threading; namespace MTSC.UnitTests { [TestClass] + [TestCategory("ServerTests")] public class ServerTests { [TestMethod] From 1a70065d495038c244015acd15cd7a01b3c7e4fc Mon Sep 17 00:00:00 2001 From: Alexandru Macocian Date: Wed, 2 Jun 2021 15:33:48 +0200 Subject: [PATCH 7/7] Disable CD pipeline for PRs --- .github/workflows/cd.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 778cf57..111e8d7 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -4,9 +4,6 @@ on: push: branches: - master - pull_request: - branches: - - master jobs: