Adding tests coverages on sonar

This commit is contained in:
Zoe Roux 2021-04-23 21:12:29 +02:00
parent 22b9f3240f
commit 1bcd587401
5 changed files with 32 additions and 63 deletions

View File

@ -34,11 +34,18 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: bash
run: |
dotnet test \
'-p:CollectCoverage=true;CoverletOutputFormat=opencover' \
'-p:SkipTranscoder=true;SkipWebApp=true' || echo "Test failed. Skipping..."
dotnet build-server shutdown
./.sonar/scanner/dotnet-sonarscanner begin \
-k:"AnonymusRaccoon_Kyoo" \
-o:"anonymus-raccoon" \
-d:sonar.login="${{ secrets.SONAR_TOKEN }}" \
-d:sonar.host.url="https://sonarcloud.io"
-k:"AnonymusRaccoon_Kyoo" \
-o:"anonymus-raccoon" \
-d:sonar.login="${{ secrets.SONAR_TOKEN }}" \
-d:sonar.host.url="https://sonarcloud.io" \
-d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml"
dotnet build --no-incremental '-p:SkipTranscoder=true;SkipWebApp=true'

View File

@ -10,6 +10,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit" Version="2.4.1" />

View File

@ -1,17 +0,0 @@
using System.Linq;
using Xunit;
namespace Kyoo.Tests
{
public class RepositoryTests
{
[Fact]
public void Get_Test()
{
TestContext context = new();
using DatabaseContext database = context.New();
Assert.Equal(1, database.Shows.Count());
}
}
}

View File

@ -0,0 +1,17 @@
using System.Linq;
using Xunit;
namespace Kyoo.Tests
{
public class SetupTests
{
// [Fact]
// public void Get_Test()
// {
// TestContext context = new();
// using DatabaseContext database = context.New();
//
// Assert.Equal(1, database.Shows.Count());
// }
}
}

View File

@ -1,42 +0,0 @@
{
"server.urls": "http://*:5000",
"public_url": "http://localhost:5000/",
"database": {
"server": "127.0.0.1",
"port": "5432",
"database": "kyooDB",
"user ID": "kyoo",
"password": "kyooPassword",
"pooling": "true",
"maxPoolSize": "95",
"timeout": "30"
},
"logging": {
"logLevel": {
"default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"parallelTasks": "1",
"scheduledTasks": {
"scan": "24:00:00"
},
"certificatePassword": "passphrase",
"transmuxTempPath": "cached/kyoo/transmux",
"transcodeTempPath": "cached/kyoo/transcode",
"peoplePath": "people",
"providerPath": "providers",
"profilePicturePath": "users/",
"plugins": "plugins/",
"defaultPermissions": "read,play,write,admin",
"newUserPermissions": "read,play,write,admin",
"regex": "(?:\\/(?<Collection>.*?))?\\/(?<Show>.*?)(?: \\(\\d+\\))?\\/\\k<Show>(?: \\(\\d+\\))?(?:(?: S(?<Season>\\d+)E(?<Episode>\\d+))| (?<Absolute>\\d+))?.*$",
"subtitleRegex": "^(?<Episode>.*)\\.(?<Language>\\w{1,3})\\.(?<Default>default\\.)?(?<Forced>forced\\.)?.*$"
}