Skip to content

Commit

Permalink
Merge pull request #7 from kysect/feat/code-cover
Browse files Browse the repository at this point in the history
Enable code cover analyze
  • Loading branch information
FrediKats committed Feb 19, 2024
2 parents 2a8c965 + 3183d90 commit fa1ed2f
Show file tree
Hide file tree
Showing 26 changed files with 102 additions and 112 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and test

on:
push:
branches: [ "master" ]
pull_request:
branches: [ '*' ]


env:
working-directory: Sources
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
dotnet-version: 8.0.x

jobs:
build:
runs-on: ubuntu-latest

steps:
- run: git config --global core.autocrlf input
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.dotnet-version }}

- name: Restore dependencies
run: dotnet restore
working-directory: ${{ env.working-directory }}

- name: Build
run: dotnet build -c Release --no-restore --verbosity normal
working-directory: ${{ env.working-directory }}

- name: Test
run: dotnet test -c Release --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
working-directory: ${{ env.working-directory }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# - name: Run mutation tests
# run: |
# dotnet tool restore
# dotnet stryker --reporter dashboard
# working-directory: ${{ env.working-directory }}
# env:
# STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
39 changes: 0 additions & 39 deletions .github/workflows/build-test.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ${{ env.working-directory }}

steps:
- run: git config --global core.autocrlf input
- uses: actions/checkout@v3

- name: Setup .NET
Expand All @@ -27,15 +24,24 @@ jobs:

- name: Restore dependencies
run: dotnet restore
working-directory: ${{ env.working-directory }}

- name: Build
run: dotnet build -c Release /p:ContinuousIntegrationBuild=true --no-restore --verbosity normal
working-directory: ${{ env.working-directory }}

- name: Test
run: dotnet test -c Release --no-build --verbosity normal
working-directory: ${{ env.working-directory }}

- name: Pack
run: dotnet pack --no-build
working-directory: ${{ env.working-directory }}

- name: Publish to Nuget
run: dotnet nuget push ${{ env.release-directory }}/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
working-directory: ${{ env.working-directory }}

- name: Publish to Nuget symbols
run: dotnet nuget push ${{ env.release-directory }}/*.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
run: dotnet nuget push ${{ env.release-directory }}/*.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
working-directory: ${{ env.working-directory }}
28 changes: 16 additions & 12 deletions Sources/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<Project>
<ItemGroup>
<PackageReference Include="Kysect.Editorconfig" />
</ItemGroup>
<PropertyGroup>
<UseArtifactsOutput>true</UseArtifactsOutput>
<Authors>Kysect</Authors>
<Company>Kysect</Company>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<DebugType>portable</DebugType>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Kysect.Editorconfig" />
</ItemGroup>
<PropertyGroup>
<UseArtifactsOutput>true</UseArtifactsOutput>
<Authors>Kysect</Authors>
<Company>Kysect</Company>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<DebugType>portable</DebugType>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Copyright>Copyright (c) Kysect 2024</Copyright>
<RepositoryType>git</RepositoryType>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
12 changes: 8 additions & 4 deletions Sources/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Kysect.CommonLib" Version="0.1.14" />
<PackageVersion Include="Kysect.CommonLib.DependencyInjection" Version="0.1.14" />
<PackageVersion Include="Kysect.Editorconfig" Version="1.1.6" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.0" />
<PackageVersion Include="Kysect.CommonLib" Version="0.1.18" />
<PackageVersion Include="Kysect.CommonLib.DependencyInjection" Version="0.1.18" />
<PackageVersion Include="Kysect.Editorconfig" Version="1.1.8" />
<PackageVersion Include="Spectre.Console" Version="0.48.0" />
<PackageVersion Include="Lunet.Extensions.Logging.SpectreConsole" Version="1.1.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="NUnit" Version="4.0.1" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="NUnit.Analyzers" Version="3.10.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.analyzers" Version="1.11.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" />
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions Sources/Kysect.TerminalUserInterface.Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Global using directives

global using Xunit;
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,19 @@

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>$(NoWarn);CS1591;CA1707</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn>$(NoWarn);CS1591;CA1707</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="NUnit.Analyzers" >
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" >
<PackageReference Include="xunit" />
<PackageReference Include="xunit.analyzers" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
using FluentAssertions;
using Kysect.TerminalUserInterface.Navigation;
using Kysect.TerminalUserInterface.Tests.Mocks;
using NUnit.Framework;

namespace Kysect.TerminalUserInterface.Tests;

public class TuiMenuNavigationBuilderTests
{
private TuiMenuNavigationBuilder _builder;
private readonly TuiMenuNavigationBuilder _builder;

[SetUp]
public void Setup()
public TuiMenuNavigationBuilderTests()
{
_builder = new TuiMenuNavigationBuilder(new TestTuiMenuProvider());

}

[Test]
[Fact]
public void Build_WithMenuAndSubMenu_ReturnMenuWithCorrectElements()
{
TuiMenuNavigationItem menu = _builder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.Generic;

namespace Kysect.TerminalUserInterface.Controls.Grids;
namespace Kysect.TerminalUserInterface.Controls.Grids;

public interface IObjectGridViewDecomposer<T>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using Kysect.TerminalUserInterface.Tools;
using Spectre.Console;
using Spectre.Console.Rendering;
using System.Collections.Generic;
using System.Linq;

namespace Kysect.TerminalUserInterface.Controls.Grids;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Kysect.CommonLib.Reflection.TypeCache;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace Kysect.TerminalUserInterface.Controls.Grids;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Kysect.CommonLib.Reflection.TypeCache;
using Kysect.TerminalUserInterface.Tools;
using Spectre.Console;
using System.Collections.Generic;
using System.Reflection;

namespace Kysect.TerminalUserInterface.Controls.Selection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Spectre.Console;
using System;
using System.Collections.Generic;

namespace Kysect.TerminalUserInterface.Controls.Selection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.IO;
using System.Linq;

namespace Kysect.TerminalUserInterface.Controls.Selection;
namespace Kysect.TerminalUserInterface.Controls.Selection;

public static class SelectFileFromDirectoryControl
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Kysect.CommonLib.BaseTypes.Extensions;
using Spectre.Console;
using System;

namespace Kysect.TerminalUserInterface.Controls.Selection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Kysect.TerminalUserInterface.Menu;
using Microsoft.Extensions.DependencyInjection;
using System;

namespace Kysect.TerminalUserInterface.DependencyInjection;

Expand Down
1 change: 0 additions & 1 deletion Sources/Kysect.TerminalUserInterface/Menu/ITuiMenu.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Kysect.TerminalUserInterface.Commands;
using System.Collections.Generic;

namespace Kysect.TerminalUserInterface.Menu;

Expand Down
2 changes: 0 additions & 2 deletions Sources/Kysect.TerminalUserInterface/Menu/TuiMainMenu.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Kysect.TerminalUserInterface.Commands;
using System;
using System.Collections.Generic;

namespace Kysect.TerminalUserInterface.Menu;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Kysect.CommonLib.BaseTypes.Extensions;
using Kysect.TerminalUserInterface.Menu;
using System;
using System.Collections.Generic;

namespace Kysect.TerminalUserInterface.Navigation;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Kysect.TerminalUserInterface.Menu;
using System.Collections.Generic;

namespace Kysect.TerminalUserInterface.Navigation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
using Kysect.TerminalUserInterface.Navigation.Commands;
using Microsoft.Extensions.Logging;
using Spectre.Console;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Kysect.TerminalUserInterface.Navigation;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Kysect.CommonLib.BaseTypes.Extensions;
using Spectre.Console;
using Spectre.Console.Rendering;
using System;

namespace Kysect.TerminalUserInterface.ProgressTracking;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using Kysect.CommonLib.ProgressTracking;
using Spectre.Console;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Kysect.TerminalUserInterface.ProgressTracking;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Kysect.CommonLib.ProgressTracking;
using System;
using System.Collections.Generic;

namespace Kysect.TerminalUserInterface.ProgressTracking;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Text;
using System.Text;

namespace Kysect.TerminalUserInterface.Tools;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace Kysect.TerminalUserInterface.Tools;
namespace Kysect.TerminalUserInterface.Tools;

public class TerminalInterfaceFrameworkException : Exception
{
Expand Down

0 comments on commit fa1ed2f

Please sign in to comment.