Skip to content

Commit

Permalink
fix: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
lpcouto committed Jan 31, 2024
1 parent c2faf41 commit cfdd7b3
Show file tree
Hide file tree
Showing 29 changed files with 128 additions and 72 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -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"
49 changes: 0 additions & 49 deletions .github/workflows/build.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
path: ./issue_metrics.md
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
run: echo ${{ github.event.release.tag_name }}
33 changes: 33 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project>
<PropertyGroup>
<LangVersion>10.0</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<Authors>Farfetch</Authors>
<Company>Farfetch</Company>
<Product>LoadShedding</Product>
<PackageProjectUrl>https://github.com/Farfetch/loadshedding</PackageProjectUrl>
<RepositoryUrl>https://github.com/Farfetch/loadshedding</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<license>https://github.com/Farfetch/loadshedding/blob/master/LICENSE</license>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIconUrl>https://raw.githubusercontent.com/Farfetch/.github/master/images/fuse-logo-128.png</PackageIconUrl>
<PackageTags>loadshedding</PackageTags>
<CodeAnalysisRuleSet>$([MSBuild]::GetPathOfFileAbove('StyleCopAnalyzersDefault.ruleset'))</CodeAnalysisRuleSet>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="$([MSBuild]::GetPathOfFileAbove('stylecop.json'))" Link="stylecop.json" />
</ItemGroup>

</Project>
File renamed without changes.
2 changes: 2 additions & 0 deletions src/Farfetch.LoadShedding/Farfetch.LoadShedding.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>LoadShedding</PackageId>
<Description>LoadShedding main package</Description>
</PropertyGroup>

<ItemGroup>
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions tests/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../src'))" />

<ItemGroup>
<Compile Include="$(MSBuildProjectDirectory)/../Traits.cs" Link="Properties/Traits.cs"/>
<AdditionalFiles Include="..\..\..\stylecop.json" Link="stylecop.json" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
<ProjectReference Include="..\..\..\src\Farfetch.LoadShedding\Farfetch.LoadShedding.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Remove="$(MSBuildProjectDirectory)/../Traits.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Concurrent;
using System.Collections.Concurrent;
using System.Net;
using Farfetch.LoadShedding.AspNetCore.Options;
using Farfetch.LoadShedding.Configurations;
Expand Down
3 changes: 3 additions & 0 deletions tests/integration-tests/Traits.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using Xunit;

[assembly: AssemblyTrait("Category", "Integration")]
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
</None>
</ItemGroup>

<ItemGroup>
<Compile Remove="$(MSBuildProjectDirectory)/../Traits.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.AspNetCore.Configurators;
using Farfetch.LoadShedding.AspNetCore.Configurators;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.AspNetCore.Resolvers;
using Farfetch.LoadShedding.AspNetCore.Resolvers;
using Farfetch.LoadShedding.Tasks;
using Microsoft.AspNetCore.Http;
using Moq;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.AspNetCore.Resolvers;
using Farfetch.LoadShedding.AspNetCore.Resolvers;
using Farfetch.LoadShedding.Tasks;
using Microsoft.AspNetCore.Http;
using Moq;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.Builders;
using Farfetch.LoadShedding.Builders;
using Xunit;

namespace Farfetch.LoadShedding.Tests.Builders
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.Calculators;
using Farfetch.LoadShedding.Calculators;
using Farfetch.LoadShedding.Configurations;
using Moq;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.Calculators;
using Farfetch.LoadShedding.Calculators;
using Farfetch.LoadShedding.Configurations;
using Moq;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.Configurations;
using Farfetch.LoadShedding.Configurations;
using Farfetch.LoadShedding.Events;
using Farfetch.LoadShedding.Measures;
using Farfetch.LoadShedding.Tasks;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.Configurations;
using Farfetch.LoadShedding.Configurations;
using Farfetch.LoadShedding.Exceptions;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.Calculators;
using Farfetch.LoadShedding.Calculators;
using Farfetch.LoadShedding.Configurations;
using Farfetch.LoadShedding.Limiters;
using Farfetch.LoadShedding.Events;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.Measures;
using Farfetch.LoadShedding.Measures;
using Xunit;

namespace Farfetch.LoadShedding.Tests.Measures
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.Tasks;
using Farfetch.LoadShedding.Tasks;
using Xunit;

namespace Farfetch.LoadShedding.Tests.Tasks
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Farfetch.LoadShedding.Tasks;
using Farfetch.LoadShedding.Tasks;
using Xunit;

namespace Farfetch.LoadShedding.Tests.Tasks
Expand Down
3 changes: 3 additions & 0 deletions tests/unit-tests/Traits.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using Xunit;

[assembly: AssemblyTrait("Category", "Unit")]

0 comments on commit cfdd7b3

Please sign in to comment.