diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..53a0487 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,48 @@ +name: Build and Test + +on: + pull_request: + + push: + branches: [ main ] + +jobs: + build-test: + + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: GITHUB CONTEXT + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + + - name: Commit Lint + uses: wagoid/commitlint-github-action@master + with: + failOnWarnings: true + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + + - name: Build Framework + run: | + dotnet build LoadShedding.sln -c Release + + - name: UnitTests + run: | + dotnet test LoadShedding.sln --filter Category=Unit -c Release --logger "console;verbosity=detailed" + + - name: IntegrationTests + run: | + dotnet test LoadShedding.sln --filter Category=Integration -c Release --logger "console;verbosity=detailed" + + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 105a762..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build - -on: - pull_request: - - push: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: GITHUB CONTEXT - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - - name: Commit Lint - uses: wagoid/commitlint-github-action@master - with: - failOnWarnings: true - - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '2.0.x' - - - name: Build Framework - run: dotnet build LoadShedding.sln -c Release - - - name: AspNetCore UnitTests - run: | - dotnet test tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Farfetch.LoadShedding.AspNetCore.Tests.csproj -c Release --logger "console;verbosity=detailed" - - - name: LoadShedding UnitTests - run: | - dotnet test tests/unit-tests/Farfetch.LoadShedding.Tests/Farfetch.LoadShedding.Tests.csproj -c Release --logger "console;verbosity=detailed" - - - name: IntegrationTests - run: | - dotnet test tests/integration-tests/Farfetch.LoadShedding.IntegrationTests/Farfetch.LoadShedding.IntegrationTests.csproj -c Release --logger "console;verbosity=detailed" diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index a0aae71..b602557 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -41,7 +41,7 @@ jobs: uses: github/issue-metrics@v2 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SEARCH_QUERY: 'repo:farfetch/kafkaflow created:${{ env.last_month }} -reason:"not planned"' + SEARCH_QUERY: 'repo:farfetch/loadshedding created:${{ env.last_month }} -reason:"not planned"' - name: Upload for opened items uses: actions/upload-artifact@v3 @@ -54,7 +54,7 @@ jobs: uses: github/issue-metrics@v2 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SEARCH_QUERY: 'repo:farfetch/kafkaflow closed:${{ env.last_month }} -reason:"not planned"' + SEARCH_QUERY: 'repo:farfetch/loadshedding closed:${{ env.last_month }} -reason:"not planned"' - name: Upload for closed items uses: actions/upload-artifact@v3 @@ -67,7 +67,7 @@ jobs: uses: github/issue-metrics@v2 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SEARCH_QUERY: 'repo:farfetch/kafkaflow type:discussions created:${{ env.last_month }} -reason:"not planned"' + SEARCH_QUERY: 'repo:farfetch/loadshedding type:discussions created:${{ env.last_month }} -reason:"not planned"' - name: Upload for opened discussions uses: actions/upload-artifact@v3 @@ -80,10 +80,10 @@ jobs: uses: github/issue-metrics@v2 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SEARCH_QUERY: 'repo:farfetch/kafkaflow type:discussions closed:${{ env.last_month }} -reason:"not planned"' + SEARCH_QUERY: 'repo:farfetch/loadshedding type:discussions closed:${{ env.last_month }} -reason:"not planned"' - name: Upload for closed discussions uses: actions/upload-artifact@v3 with: name: discussions-closed - path: ./issue_metrics.md \ No newline at end of file + path: ./issue_metrics.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1c81559..2d4e141 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: '2.0.x' + dotnet-version: '8.0.x' - name: Pack run: dotnet pack ./LoadShedding.sln -c Release /p:Version=${{ github.event.release.tag_name }} -o ./drop @@ -23,4 +23,4 @@ jobs: run: dotnet nuget push ./drop/**/*.nupkg -k ${{ secrets.NUGET_PUBLISH_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate - name: Print Version - run: echo ${{ github.event.release.tag_name }} \ No newline at end of file + run: echo ${{ github.event.release.tag_name }} diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..b95a26d --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,33 @@ + + + 10.0 + true + true + snupkg + true + Farfetch + Farfetch + LoadShedding + https://github.com/Farfetch/loadshedding + https://github.com/Farfetch/loadshedding + git + https://github.com/Farfetch/loadshedding/blob/master/LICENSE + MIT + https://raw.githubusercontent.com/Farfetch/.github/master/images/fuse-logo-128.png + loadshedding + $([MSBuild]::GetPathOfFileAbove('StyleCopAnalyzersDefault.ruleset')) + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/src/StyleCopAnalyzersDefault.ruleset b/StyleCopAnalyzersDefault.ruleset similarity index 100% rename from src/StyleCopAnalyzersDefault.ruleset rename to StyleCopAnalyzersDefault.ruleset diff --git a/src/Farfetch.LoadShedding/Farfetch.LoadShedding.csproj b/src/Farfetch.LoadShedding/Farfetch.LoadShedding.csproj index 101cb50..1958404 100644 --- a/src/Farfetch.LoadShedding/Farfetch.LoadShedding.csproj +++ b/src/Farfetch.LoadShedding/Farfetch.LoadShedding.csproj @@ -2,6 +2,8 @@ netstandard2.0 + LoadShedding + LoadShedding main package diff --git a/src/stylecop.json b/stylecop.json similarity index 100% rename from src/stylecop.json rename to stylecop.json diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props new file mode 100644 index 0000000..1b0c8ed --- /dev/null +++ b/tests/Directory.Build.props @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/benchmark/Farfetch.LoadShedding.BenchmarkTests/Farfetch.LoadShedding.BenchmarkTests.csproj b/tests/benchmark/Farfetch.LoadShedding.BenchmarkTests/Farfetch.LoadShedding.BenchmarkTests.csproj index ba5004c..5e83edb 100644 --- a/tests/benchmark/Farfetch.LoadShedding.BenchmarkTests/Farfetch.LoadShedding.BenchmarkTests.csproj +++ b/tests/benchmark/Farfetch.LoadShedding.BenchmarkTests/Farfetch.LoadShedding.BenchmarkTests.csproj @@ -17,4 +17,8 @@ + + + + diff --git a/tests/integration-tests/Farfetch.LoadShedding.IntegrationTests/Tests/Limiters/AdaptativeConcurrencyLimiterTests.cs b/tests/integration-tests/Farfetch.LoadShedding.IntegrationTests/Tests/Limiters/AdaptativeConcurrencyLimiterTests.cs index 5774987..c992702 100644 --- a/tests/integration-tests/Farfetch.LoadShedding.IntegrationTests/Tests/Limiters/AdaptativeConcurrencyLimiterTests.cs +++ b/tests/integration-tests/Farfetch.LoadShedding.IntegrationTests/Tests/Limiters/AdaptativeConcurrencyLimiterTests.cs @@ -1,4 +1,4 @@ -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Net; using Farfetch.LoadShedding.AspNetCore.Options; using Farfetch.LoadShedding.Configurations; diff --git a/tests/integration-tests/Traits.cs b/tests/integration-tests/Traits.cs new file mode 100644 index 0000000..3c86a2d --- /dev/null +++ b/tests/integration-tests/Traits.cs @@ -0,0 +1,3 @@ +using Xunit; + +[assembly: AssemblyTrait("Category", "Integration")] \ No newline at end of file diff --git a/tests/performance-tests/Farfetch.LoadShedding.PerformanceTests/Farfetch.LoadShedding.PerformanceTests.csproj b/tests/performance-tests/Farfetch.LoadShedding.PerformanceTests/Farfetch.LoadShedding.PerformanceTests.csproj index 6fb0410..ca254b5 100644 --- a/tests/performance-tests/Farfetch.LoadShedding.PerformanceTests/Farfetch.LoadShedding.PerformanceTests.csproj +++ b/tests/performance-tests/Farfetch.LoadShedding.PerformanceTests/Farfetch.LoadShedding.PerformanceTests.csproj @@ -17,4 +17,8 @@ + + + + diff --git a/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Configurators/LoadSheddingConfiguratorTests.cs b/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Configurators/LoadSheddingConfiguratorTests.cs index dd257e2..b9152b0 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Configurators/LoadSheddingConfiguratorTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Configurators/LoadSheddingConfiguratorTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.AspNetCore.Configurators; +using Farfetch.LoadShedding.AspNetCore.Configurators; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Xunit; diff --git a/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Middlewares/AdaptativeConcurrencyLimiterMiddlewareTests.cs b/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Middlewares/AdaptativeConcurrencyLimiterMiddlewareTests.cs index bdca545..0be40ea 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Middlewares/AdaptativeConcurrencyLimiterMiddlewareTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Middlewares/AdaptativeConcurrencyLimiterMiddlewareTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.AspNetCore.Middlewares; +using Farfetch.LoadShedding.AspNetCore.Middlewares; using Farfetch.LoadShedding.AspNetCore.Options; using Farfetch.LoadShedding.Exceptions; using Farfetch.LoadShedding.Limiters; diff --git a/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/DefaultPriorityResolverTests.cs b/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/DefaultPriorityResolverTests.cs index 8e8bd12..8a41faa 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/DefaultPriorityResolverTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/DefaultPriorityResolverTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.AspNetCore.Resolvers; +using Farfetch.LoadShedding.AspNetCore.Resolvers; using Farfetch.LoadShedding.Tasks; using Microsoft.AspNetCore.Http; using Moq; diff --git a/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/EndpointPriorityResolverTests.cs b/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/EndpointPriorityResolverTests.cs index d5860c1..2835c27 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/EndpointPriorityResolverTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/EndpointPriorityResolverTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.AspNetCore.Attributes; +using Farfetch.LoadShedding.AspNetCore.Attributes; using Farfetch.LoadShedding.AspNetCore.Resolvers; using Farfetch.LoadShedding.Tasks; using Microsoft.AspNetCore.Http; diff --git a/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/HttpHeaderPriorityResolverTests.cs b/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/HttpHeaderPriorityResolverTests.cs index 836efe2..f418c9c 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/HttpHeaderPriorityResolverTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.AspNetCore.Tests/Resolvers/HttpHeaderPriorityResolverTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.AspNetCore.Resolvers; +using Farfetch.LoadShedding.AspNetCore.Resolvers; using Farfetch.LoadShedding.Tasks; using Microsoft.AspNetCore.Http; using Moq; diff --git a/tests/unit-tests/Farfetch.LoadShedding.Tests/Builders/AdaptativeLimiterBuilderTests.cs b/tests/unit-tests/Farfetch.LoadShedding.Tests/Builders/AdaptativeLimiterBuilderTests.cs index cc47244..db17c11 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.Tests/Builders/AdaptativeLimiterBuilderTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.Tests/Builders/AdaptativeLimiterBuilderTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.Builders; +using Farfetch.LoadShedding.Builders; using Xunit; namespace Farfetch.LoadShedding.Tests.Builders diff --git a/tests/unit-tests/Farfetch.LoadShedding.Tests/Calculators/GradientLimitCalculatorTests.cs b/tests/unit-tests/Farfetch.LoadShedding.Tests/Calculators/GradientLimitCalculatorTests.cs index fdb3fa7..480c3a4 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.Tests/Calculators/GradientLimitCalculatorTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.Tests/Calculators/GradientLimitCalculatorTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.Calculators; +using Farfetch.LoadShedding.Calculators; using Farfetch.LoadShedding.Configurations; using Moq; using Xunit; diff --git a/tests/unit-tests/Farfetch.LoadShedding.Tests/Calculators/SquareRootQueueCalculatorTests.cs b/tests/unit-tests/Farfetch.LoadShedding.Tests/Calculators/SquareRootQueueCalculatorTests.cs index eed6220..a94e9f2 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.Tests/Calculators/SquareRootQueueCalculatorTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.Tests/Calculators/SquareRootQueueCalculatorTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.Calculators; +using Farfetch.LoadShedding.Calculators; using Farfetch.LoadShedding.Configurations; using Moq; using Xunit; diff --git a/tests/unit-tests/Farfetch.LoadShedding.Tests/Configurations/ConcurrencyContextTests.cs b/tests/unit-tests/Farfetch.LoadShedding.Tests/Configurations/ConcurrencyContextTests.cs index 6475e48..02733e9 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.Tests/Configurations/ConcurrencyContextTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.Tests/Configurations/ConcurrencyContextTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.Configurations; +using Farfetch.LoadShedding.Configurations; using Farfetch.LoadShedding.Events; using Farfetch.LoadShedding.Measures; using Farfetch.LoadShedding.Tasks; diff --git a/tests/unit-tests/Farfetch.LoadShedding.Tests/Configurations/ConcurrencyOptionsTests.cs b/tests/unit-tests/Farfetch.LoadShedding.Tests/Configurations/ConcurrencyOptionsTests.cs index cc9c1f0..ef5e983 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.Tests/Configurations/ConcurrencyOptionsTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.Tests/Configurations/ConcurrencyOptionsTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.Configurations; +using Farfetch.LoadShedding.Configurations; using Farfetch.LoadShedding.Exceptions; using Xunit; diff --git a/tests/unit-tests/Farfetch.LoadShedding.Tests/Limiters/AdaptativeConcurrencyLimiterTests.cs b/tests/unit-tests/Farfetch.LoadShedding.Tests/Limiters/AdaptativeConcurrencyLimiterTests.cs index cf7fc45..c700c1a 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.Tests/Limiters/AdaptativeConcurrencyLimiterTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.Tests/Limiters/AdaptativeConcurrencyLimiterTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.Calculators; +using Farfetch.LoadShedding.Calculators; using Farfetch.LoadShedding.Configurations; using Farfetch.LoadShedding.Limiters; using Farfetch.LoadShedding.Events; diff --git a/tests/unit-tests/Farfetch.LoadShedding.Tests/Measures/RTTMeasuresTests.cs b/tests/unit-tests/Farfetch.LoadShedding.Tests/Measures/RTTMeasuresTests.cs index 8d7b726..87a0f82 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.Tests/Measures/RTTMeasuresTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.Tests/Measures/RTTMeasuresTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.Measures; +using Farfetch.LoadShedding.Measures; using Xunit; namespace Farfetch.LoadShedding.Tests.Measures diff --git a/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskItemTests.cs b/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskItemTests.cs index e5856fb..ed50022 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskItemTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskItemTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.Tasks; +using Farfetch.LoadShedding.Tasks; using Xunit; namespace Farfetch.LoadShedding.Tests.Tasks diff --git a/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskManagerTests.cs b/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskManagerTests.cs index 9d347b6..890f01b 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskManagerTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskManagerTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.Events; +using Farfetch.LoadShedding.Events; using Farfetch.LoadShedding.Events.Args; using Farfetch.LoadShedding.Exceptions; using Farfetch.LoadShedding.Tasks; diff --git a/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskQueueTests.cs b/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskQueueTests.cs index f4a5400..fc9d919 100644 --- a/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskQueueTests.cs +++ b/tests/unit-tests/Farfetch.LoadShedding.Tests/Tasks/TaskQueueTests.cs @@ -1,4 +1,4 @@ -using Farfetch.LoadShedding.Tasks; +using Farfetch.LoadShedding.Tasks; using Xunit; namespace Farfetch.LoadShedding.Tests.Tasks diff --git a/tests/unit-tests/Traits.cs b/tests/unit-tests/Traits.cs new file mode 100644 index 0000000..4e645a3 --- /dev/null +++ b/tests/unit-tests/Traits.cs @@ -0,0 +1,3 @@ +using Xunit; + +[assembly: AssemblyTrait("Category", "Unit")] \ No newline at end of file