From 99885519b768397faa37f0001230b65a7e1ee39c Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Sat, 8 Jun 2024 03:09:10 +0200 Subject: [PATCH 1/8] Added first test execution at the end of build process --- .github/workflows/build.yaml | 77 ++++++++++++++++++++++++++++++++++-- test/Common/ProgramConfig.cs | 6 +++ 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e2631be..cf324b6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -65,13 +65,82 @@ jobs: fetch-depth: '1' submodules: 'true' - - name: Precompile tests - run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" test\KEFCore.Test.sln - - name: Recompile to create nuget packages run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" src\net\KEFCore.sln - uses: actions/upload-artifact@v4 with: name: KEFCore - path: .\bin\*nupkg \ No newline at end of file + path: .\bin\*nupkg + + - name: Compile tests + run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" test\KEFCore.Test.sln + + - name: Save KEFCore bin in cache + uses: actions/cache/save@v4 + with: + enableCrossOsArchive: true + path: ./bin/ + key: KEFCore_bin_${{ github.sha }} + + execute_tests: + needs: build_windows + services: + kafka: + # Private registry image + image: ghcr.io/masesgroup/knettest:master # to be changed with official version when willbe available + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + ports: + - 9092:9092 + env: + KNET_RUNNING_MODE: standalone + JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} + + strategy: + fail-fast: false + matrix: + os: [ 'ubuntu-latest' ] #, 'windows-latest' ] + framework: [ 'net462', 'net6.0', 'net8.0' ] + jdk_vendor: [ 'temurin', 'zulu', 'microsoft', 'corretto', 'oracle'] + jdk_version: [ '11', '17', '21' ] # only LTS versions + exclude: + - os: ubuntu-latest + framework: net462 + - jdk_vendor: oracle + jdk_version: 11 + + runs-on: ${{ matrix.os }} + steps: + - name: Restore KEFCore bin from cache + uses: actions/cache/restore@v4 + with: + fail-on-cache-miss: true + enableCrossOsArchive: true + path: ./bin/ + key: KEFCore_bin_${{ github.sha }} + + - name: Set up JDK distribution + uses: actions/setup-java@v4 + with: # running setup-java again overwrites the settings.xml + distribution: ${{ matrix.jdk_vendor }} + java-version: ${{ matrix.jdk_version }} + + - name: Executing KEFCore.Benchmark.Test on Ubuntu with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} + if: matrix.os == 'ubuntu-latest' + run: dotnet ./bin/${{ matrix.framework }}/KEFCore.Benchmark.Test.dll Benchmark.KNetStreams.json localhost:9092 + env: + JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} + + - name: Executing KEFCore.Benchmark.Test on Windows with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} + if: ${{ matrix.os == 'windows-latest' && matrix.framework != 'net462' }} + run: dotnet .\bin\${{ matrix.framework }}\KEFCore.Benchmark.Test.dll Benchmark.KNetStreams.json localhost:9092 + env: + JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} + + - name: Executing KEFCore.Benchmark.Test on Windows with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} + if: ${{ matrix.os == 'windows-latest' && matrix.framework == 'net462' }} + run: .\bin\${{ matrix.framework }}\KEFCore.Benchmark.Test.exe Benchmark.KNetStreams.json localhost:9092 + env: + JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} \ No newline at end of file diff --git a/test/Common/ProgramConfig.cs b/test/Common/ProgramConfig.cs index 8901e0c..06ced76 100644 --- a/test/Common/ProgramConfig.cs +++ b/test/Common/ProgramConfig.cs @@ -109,6 +109,12 @@ public static void LoadConfig(string[] args) Config = JsonSerializer.Deserialize(File.ReadAllText(args[0])); } else Config = new(); + + if (args.Length > 1) + { + Config.BootstrapServers = args[1]; + } + ReportString(JsonSerializer.Serialize(Config, new JsonSerializerOptions() { WriteIndented = true })); if (!KafkaDbContext.EnableKEFCoreTracing) KafkaDbContext.EnableKEFCoreTracing = Config.EnableKEFCoreTracing; From 61d66ae6fa4f99eeb9f4da35294af59ea9d17b8a Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Sat, 8 Jun 2024 03:15:04 +0200 Subject: [PATCH 2/8] Position fix --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cf324b6..8196663 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -129,18 +129,18 @@ jobs: - name: Executing KEFCore.Benchmark.Test on Ubuntu with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} if: matrix.os == 'ubuntu-latest' - run: dotnet ./bin/${{ matrix.framework }}/KEFCore.Benchmark.Test.dll Benchmark.KNetStreams.json localhost:9092 + run: dotnet ./bin/${{ matrix.framework }}/KEFCore.Benchmark.Test.dll ./bin/${{ matrix.framework }}/Benchmark.KNetStreams.json localhost:9092 env: JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} - name: Executing KEFCore.Benchmark.Test on Windows with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} if: ${{ matrix.os == 'windows-latest' && matrix.framework != 'net462' }} - run: dotnet .\bin\${{ matrix.framework }}\KEFCore.Benchmark.Test.dll Benchmark.KNetStreams.json localhost:9092 + run: dotnet .\bin\${{ matrix.framework }}\KEFCore.Benchmark.Test.dll .\bin\${{ matrix.framework }}\Benchmark.KNetStreams.json localhost:9092 env: JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} - name: Executing KEFCore.Benchmark.Test on Windows with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} if: ${{ matrix.os == 'windows-latest' && matrix.framework == 'net462' }} - run: .\bin\${{ matrix.framework }}\KEFCore.Benchmark.Test.exe Benchmark.KNetStreams.json localhost:9092 + run: .\bin\${{ matrix.framework }}\KEFCore.Benchmark.Test.exe .\bin\${{ matrix.framework }}\Benchmark.KNetStreams.json localhost:9092 env: JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} \ No newline at end of file From 464678b9b2c1d0eae21bdf00a9aa6dc2eb41636e Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Sat, 8 Jun 2024 03:20:48 +0200 Subject: [PATCH 3/8] name fix --- .github/workflows/build.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8196663..ed6921a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -127,20 +127,20 @@ jobs: distribution: ${{ matrix.jdk_vendor }} java-version: ${{ matrix.jdk_version }} - - name: Executing KEFCore.Benchmark.Test on Ubuntu with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} + - name: Executing MASES.EntityFrameworkCore.KNet.Test.Benchmark on Ubuntu with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} if: matrix.os == 'ubuntu-latest' - run: dotnet ./bin/${{ matrix.framework }}/KEFCore.Benchmark.Test.dll ./bin/${{ matrix.framework }}/Benchmark.KNetStreams.json localhost:9092 + run: dotnet ./bin/${{ matrix.framework }}/MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ./bin/${{ matrix.framework }}/Benchmark.KNetStreams.json localhost:9092 env: JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} - - name: Executing KEFCore.Benchmark.Test on Windows with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} + - name: Executing MASES.EntityFrameworkCore.KNet.Test.Benchmark on Windows with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} if: ${{ matrix.os == 'windows-latest' && matrix.framework != 'net462' }} - run: dotnet .\bin\${{ matrix.framework }}\KEFCore.Benchmark.Test.dll .\bin\${{ matrix.framework }}\Benchmark.KNetStreams.json localhost:9092 + run: dotnet .\bin\${{ matrix.framework }}\MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll .\bin\${{ matrix.framework }}\Benchmark.KNetStreams.json localhost:9092 env: JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} - - name: Executing KEFCore.Benchmark.Test on Windows with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} + - name: Executing MASES.EntityFrameworkCore.KNet.Test.Benchmark on Windows with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} if: ${{ matrix.os == 'windows-latest' && matrix.framework == 'net462' }} - run: .\bin\${{ matrix.framework }}\KEFCore.Benchmark.Test.exe .\bin\${{ matrix.framework }}\Benchmark.KNetStreams.json localhost:9092 + run: .\bin\${{ matrix.framework }}\MASES.EntityFrameworkCore.KNet.Test.Benchmark.exe .\bin\${{ matrix.framework }}\Benchmark.KNetStreams.json localhost:9092 env: JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} \ No newline at end of file From fe214124384424c5dbf43f16e551f338dd71eb19 Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Sat, 8 Jun 2024 03:33:14 +0200 Subject: [PATCH 4/8] Fix --- test/KEFCore.Benchmark.Test/Program.cs | 48 ++++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/test/KEFCore.Benchmark.Test/Program.cs b/test/KEFCore.Benchmark.Test/Program.cs index 9d9e6e0..0b5ba4d 100644 --- a/test/KEFCore.Benchmark.Test/Program.cs +++ b/test/KEFCore.Benchmark.Test/Program.cs @@ -191,34 +191,38 @@ join pg in context.Posts on op.BlogId equals pg.BlogId } finally { - testWatcher.Stop(); - globalWatcher.Stop(); - context?.Dispose(); - ProgramConfig.ReportString(string.Empty); - ProgramConfig.ReportString($"Full test completed in {globalWatcher.Elapsed}, only tests completed in {testWatcher.Elapsed}"); - - TimeSpan[] max = new TimeSpan[maxTests]; - for (int i = 0; i < max.Length; i++) { max[i] = TimeSpan.Zero; } - TimeSpan[] min = new TimeSpan[maxTests]; - for (int i = 0; i < min.Length; i++) { min[i] = TimeSpan.MaxValue; } - TimeSpan[] total = new TimeSpan[maxTests]; - for (int i = 0; i < total.Length; i++) { total[i] = TimeSpan.Zero; } - for (int i = 0; i < ProgramConfig.Config.NumberOfExecutions; i++) + try { - var item = _tests[i].QueryTimes; + testWatcher.Stop(); + globalWatcher.Stop(); + context?.Dispose(); + ProgramConfig.ReportString(string.Empty); + ProgramConfig.ReportString($"Full test completed in {globalWatcher.Elapsed}, only tests completed in {testWatcher.Elapsed}"); + + TimeSpan[] max = new TimeSpan[maxTests]; + for (int i = 0; i < max.Length; i++) { max[i] = TimeSpan.Zero; } + TimeSpan[] min = new TimeSpan[maxTests]; + for (int i = 0; i < min.Length; i++) { min[i] = TimeSpan.MaxValue; } + TimeSpan[] total = new TimeSpan[maxTests]; + for (int i = 0; i < total.Length; i++) { total[i] = TimeSpan.Zero; } + for (int i = 0; i < ProgramConfig.Config.NumberOfExecutions; i++) + { + var item = _tests[i].QueryTimes; + + for (int testId = 0; testId < maxTests; testId++) + { + max[testId] = item[testId] > max[testId] ? item[testId] : max[testId]; + min[testId] = item[testId] < min[testId] ? item[testId] : min[testId]; + total[testId] += item[testId]; + } + } for (int testId = 0; testId < maxTests; testId++) { - max[testId] = item[testId] > max[testId] ? item[testId] : max[testId]; - min[testId] = item[testId] < min[testId] ? item[testId] : min[testId]; - total[testId] += item[testId]; + ProgramConfig.ReportString($"Test {testId} -> Max {max[testId]} Min {min[testId]} Mean {total[testId] / ProgramConfig.Config.NumberOfExecutions}"); } } - - for (int testId = 0; testId < maxTests; testId++) - { - ProgramConfig.ReportString($"Test {testId} -> Max {max[testId]} Min {min[testId]} Mean {total[testId] / ProgramConfig.Config.NumberOfExecutions}"); - } + catch { ProgramConfig.ReportString($"Failed to report test execution"); } } } } From 0c5af547a08a3aac6335ff99a552fa6c23a1a1d0 Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Mon, 24 Jun 2024 04:08:46 +0200 Subject: [PATCH 5/8] Added tests on MacOS --- .github/workflows/build.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ed6921a..99904e2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -101,13 +101,21 @@ jobs: strategy: fail-fast: false matrix: - os: [ 'ubuntu-latest' ] #, 'windows-latest' ] + os: [ 'ubuntu-latest', 'macos-latest', 'macos-13' ] #, 'windows-latest' ] framework: [ 'net462', 'net6.0', 'net8.0' ] jdk_vendor: [ 'temurin', 'zulu', 'microsoft', 'corretto', 'oracle'] jdk_version: [ '11', '17', '21' ] # only LTS versions exclude: - os: ubuntu-latest framework: net462 + - os: macos-latest + framework: net462 + - os: macos-latest + framework: net6.0 + - os: macos-13 + framework: net462 + - os: macos-13 + framework: net6.0 - jdk_vendor: oracle jdk_version: 11 From 688a8ca31e2178fc65c7d1f9178773fbc282e605 Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Mon, 24 Jun 2024 04:14:48 +0200 Subject: [PATCH 6/8] fix mode name --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 99904e2..41ba2ca 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -95,7 +95,7 @@ jobs: ports: - 9092:9092 env: - KNET_RUNNING_MODE: standalone + KNET_RUNNING_MODE: server JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} strategy: From 57ae260d4578b0f15f3776132cd174bfbb7c1c3a Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Mon, 24 Jun 2024 04:27:21 +0200 Subject: [PATCH 7/8] Fix --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 41ba2ca..90851ce 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -88,7 +88,7 @@ jobs: services: kafka: # Private registry image - image: ghcr.io/masesgroup/knettest:master # to be changed with official version when willbe available + image: ghcr.io/masesgroup/knet:master # to be changed with official version when willbe available credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} @@ -136,7 +136,7 @@ jobs: java-version: ${{ matrix.jdk_version }} - name: Executing MASES.EntityFrameworkCore.KNet.Test.Benchmark on Ubuntu with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }} - if: matrix.os == 'ubuntu-latest' + if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' || matrix.os == 'macos-13' }} run: dotnet ./bin/${{ matrix.framework }}/MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ./bin/${{ matrix.framework }}/Benchmark.KNetStreams.json localhost:9092 env: JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }} From 4280087ce28ba89651f813c86cf63a2e871fc005 Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Mon, 24 Jun 2024 15:35:16 +0200 Subject: [PATCH 8/8] Commented MacOS due to services not available --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 90851ce..b24147d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -101,7 +101,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ 'ubuntu-latest', 'macos-latest', 'macos-13' ] #, 'windows-latest' ] + os: [ 'ubuntu-latest' ] #, 'macos-latest', 'macos-13' , 'windows-latest' ] framework: [ 'net462', 'net6.0', 'net8.0' ] jdk_vendor: [ 'temurin', 'zulu', 'microsoft', 'corretto', 'oracle'] jdk_version: [ '11', '17', '21' ] # only LTS versions