-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
757 changed files
with
47,038 additions
and
1,032 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"husky": { | ||
"version": "0.7.1", | ||
"commands": [ | ||
"husky" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,14 +16,49 @@ jobs: | |
name: Run Pull Request Checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Test | ||
uses: actions/setup-dotnet@v3 | ||
- uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: | | ||
8.0 | ||
- run: dotnet test | ||
8.0 | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
with: | ||
mongodb-version: '7.0' | ||
mongodb-replica-set: test-rs | ||
mongodb-port: 29017 | ||
- name: Test | ||
run: dotnet test --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --collect:"XPlat Code Coverage" --results-directory ./coverage | ||
|
||
|
||
- name: install dotnet coverage | ||
run: dotnet tool install --global dotnet-coverage | ||
|
||
- name: merge coverage reports | ||
run: dotnet-coverage merge *.cobertura.xml --recursive --output merged.cobertura.xml --output-format cobertura | ||
|
||
|
||
- name: Code Coverage Report | ||
uses: irongut/[email protected] | ||
with: | ||
filename: merged.cobertura.xml | ||
badge: true | ||
fail_below_min: false | ||
format: markdown | ||
hide_branch_rate: false | ||
hide_complexity: true | ||
indicators: true | ||
output: both | ||
thresholds: '60 80' | ||
|
||
- name: Add Coverage PR Comment | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
if: github.event_name == 'pull_request' | ||
with: | ||
recreate: true | ||
path: code-coverage-results.md | ||
|
||
## SonarCloud | ||
## Uncomment to unable SonarCloud scan | ||
## Requires project to be set up in SonarCloud | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ permissions: | |
env: | ||
AWS_REGION: eu-west-2 | ||
AWS_ACCOUNT_ID: "094954420758" | ||
HUSKY: 0 | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
## husky task runner examples ------------------- | ||
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky' | ||
|
||
## run all tasks | ||
#husky run | ||
|
||
### run all tasks with group: 'group-name' | ||
#husky run --group group-name | ||
|
||
## run task with name: 'task-name' | ||
#husky run --name task-name | ||
|
||
## pass hook arguments to task | ||
#husky run --args "$1" "$2" | ||
|
||
## or put your custom commands ------------------- | ||
#echo 'Husky.Net is awesome!' | ||
|
||
echo 'Welcome to pre-commit git hook with Husky.Net' | ||
|
||
echo 'Clean Projects' | ||
dotnet clean | ||
|
||
echo 'Build Projects' | ||
dotnet build | ||
|
||
echo 'Test Projects' | ||
dotnet test --filter Category!=Integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"$schema": "https://alirezanet.github.io/Husky.Net/schema.json", | ||
"tasks": [ | ||
{ | ||
"name": "welcome-message-example", | ||
"command": "bash", | ||
"args": [ "-c", "echo Husky.Net is awesome!" ], | ||
"windows": { | ||
"command": "cmd", | ||
"args": ["/c", "echo Husky.Net is awesome!" ] | ||
} | ||
}, | ||
{ | ||
"name": "dotnet-format", | ||
"group": "pre-commit", | ||
"command": "dotnet", | ||
"args": ["dotnet-format", "--include", "${staged}"], | ||
"include": ["**/*.cs", "**/*.vb"] | ||
}, | ||
{ | ||
"name": "warning-check", | ||
"command": "dotnet", | ||
"group": "pre-push", | ||
"args": ["build", "/warnaserror"], | ||
"include": ["**/*.cs", "**/*.vb"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Xunit; | ||
|
||
namespace Btms.Analytics.Tests; | ||
|
||
[CollectionDefinition("Aggregation Test collection")] | ||
public class AggregationTestCollection : ICollectionFixture<AggregationTestFixture> | ||
{ | ||
// This class has no code, and is never created. Its purpose is simply | ||
// to be the place to apply [CollectionDefinition] and all the | ||
// ICollectionFixture<> interfaces. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using Btms.Analytics.Tests.Helpers; | ||
using Btms.Analytics; | ||
using Btms.Backend.Data; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using TestDataGenerator.Scenarios; | ||
|
||
namespace Btms.Analytics.Tests; | ||
|
||
#pragma warning disable S3881 | ||
public class AggregationTestFixture : IDisposable | ||
#pragma warning restore S3881 | ||
{ | ||
public IHost App; | ||
public IImportNotificationsAggregationService ImportNotificationsAggregationService; | ||
public IMovementsAggregationService MovementsAggregationService; | ||
|
||
public IMongoDbContext MongoDbContext; | ||
public AggregationTestFixture() | ||
{ | ||
var builder = TestContextHelper.CreateBuilder<AggregationTestFixture>(); | ||
|
||
App = builder.Build(); | ||
var rootScope = App.Services.CreateScope(); | ||
|
||
MongoDbContext = rootScope.ServiceProvider.GetRequiredService<IMongoDbContext>(); | ||
ImportNotificationsAggregationService = rootScope.ServiceProvider.GetRequiredService<IImportNotificationsAggregationService>(); | ||
MovementsAggregationService = rootScope.ServiceProvider.GetRequiredService<IMovementsAggregationService>(); | ||
|
||
MongoDbContext.ResetCollections().GetAwaiter().GetResult(); | ||
|
||
// Ensure we have some data scenarios around 24/48 hour tests | ||
App.PushToConsumers(App.CreateScenarioConfig<ChedASimpleMatchScenarioGenerator>(10, 3, arrivalDateRange: 0)) | ||
.GetAwaiter().GetResult(); | ||
|
||
App.PushToConsumers(App.CreateScenarioConfig<ChedPSimpleMatchScenarioGenerator>(10, 3, arrivalDateRange: 2)) | ||
.GetAwaiter().GetResult(); | ||
|
||
App.PushToConsumers(App.CreateScenarioConfig<CRNoMatchScenarioGenerator>(10, 3, arrivalDateRange: 0)) | ||
.GetAwaiter().GetResult(); | ||
|
||
// Create some more variable data over the rest of time | ||
App.PushToConsumers(App.CreateScenarioConfig<ChedASimpleMatchScenarioGenerator>(10, 7, arrivalDateRange: 10)) | ||
.GetAwaiter().GetResult(); | ||
|
||
App.PushToConsumers(App.CreateScenarioConfig<ChedANoMatchScenarioGenerator>(5, 3, arrivalDateRange: 10)) | ||
.GetAwaiter().GetResult(); | ||
|
||
App.PushToConsumers(App.CreateScenarioConfig<ChedPSimpleMatchScenarioGenerator>(1, 3, arrivalDateRange: 10)) | ||
.GetAwaiter().GetResult(); | ||
|
||
App.PushToConsumers(App.CreateScenarioConfig<CRNoMatchScenarioGenerator>(1, 3, arrivalDateRange: 10)) | ||
.GetAwaiter().GetResult(); | ||
|
||
} | ||
|
||
public void Dispose() | ||
{ | ||
// ... clean up test data from the database ... | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="EphemeralMongo7" Version="1.1.3" /> | ||
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="FluentAssertions" Version="6.12.1" /> | ||
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.4.0" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.8" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" /> | ||
<PackageReference Include="SlimMessageBus" Version="2.0.4" /> | ||
<PackageReference Include="xunit" Version="2.9.2" /> | ||
<PackageReference Include="NSubstitute" Version="5.1.0" /> | ||
<PackageReference Include="xunit.extensibility.core" Version="2.9.2" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Btms.Analytics\Btms.Analytics.csproj" /> | ||
<ProjectReference Include="..\Btms.Consumers\Btms.Consumers.csproj" /> | ||
<ProjectReference Include="..\TestDataGenerator\TestDataGenerator.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.