Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: build Debug and skip .NET Core #91

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 27 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
name: Key-n-Stroke Continuous Integration

# Trigger on every master branch push and pull request
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: [ push ]

jobs:

Expand All @@ -23,11 +19,13 @@ jobs:

env:
Solution_Path: KeyNStroke.sln
#Test_Project_Path: KeyNStroke.Tests\KeyNStroke.Tests.csproj
Test_Project_Path: KeyNStrokeTests\KeyNStrokeTests.csproj
Test_Output_Directory: KeyNStrokeTests\bin
App_Project_Path: KeyNStroke\KeyNStroke.csproj
App_Output_Directory: KeyNStroke\bin
App_Assembly: Key-n-Stroke.exe
Actions_Allow_Unsecure_Commands: true # Allows AddPAth and SetEnv commands
Configuration: Debug

steps:
- name: Checkout
Expand All @@ -41,42 +39,41 @@ jobs:
with:
setAllVars: true

# Install the .NET Core workload
- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'

# Add MsBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.1

#- name: Execute Unit Tests
# run: dotnet test $env:Test_Project_Path
# Use cached packages if available
- name: Try to restore packages from cache first
uses: actions/cache@v2
env:
cache-name: app-packages
with:
path: packages/
key: ${{ env.cache-name }}-${{ env.Configuration }}-${{ env.NBGV_CloudBuildNumber }}
restore-keys: |
${{ env.cache-name }}-${{ env.Configuration }}-${{ env.NBGV_Version }}
${{ env.cache-name }}-${{ env.Configuration }}-${{ env.NBGV_SimpleVersion }}

# Restore the application
- name: Restore the application to populate the obj and packages folder
- name: Restore the application to populate the obj and packages folder
run: msbuild $env:Solution_Path /t:Restore /p:RestorePackagesConfig=true /p:Configuration=$env:Configuration
env:
Configuration: Release


# Actual build
- name: Build the application
- name: Build the solution
run: msbuild $env:Solution_Path /t:Rebuild /p:Configuration=$env:Configuration /p:Platform="Any CPU"

# Run built tests
- name: Execute Unit Tests
uses: microsoft/vstest-action@v1.0.0
with:
testAssembly: KeyNStrokeTests.dll
searchFolder: ${{ env.Test_Output_Directory }}\${{ env.Configuration }}\

env:
Configuration: Release


# Signing
# https://github.com/dlemstra/code-sign-action
# https://github.com/GabrielAcostaEngler/signtool-code-sign
# https://archi-lab.net/code-signing-assemblies-with-github-actions/

# Add artefacts to
- name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: KeyNStroke-${{env.NBGV_SemVer2}}
path: ${{ env.App_Output_Directory }}\Release\

path: ${{ env.App_Output_Directory }}\${{ env.Configuration }}\
6 changes: 6 additions & 0 deletions KeyNStroke.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyNStroke", "KeyNStroke\KeyNStroke.csproj", "{BA117557-FEBC-45C5-8895-4017D05C3DCD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyNStrokeTests", "KeyNStrokeTests\KeyNStrokeTests.csproj", "{3B189090-03C5-41B4-B975-028E31A119EE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{BA117557-FEBC-45C5-8895-4017D05C3DCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA117557-FEBC-45C5-8895-4017D05C3DCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA117557-FEBC-45C5-8895-4017D05C3DCD}.Release|Any CPU.Build.0 = Release|Any CPU
{3B189090-03C5-41B4-B975-028E31A119EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B189090-03C5-41B4-B975-028E31A119EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B189090-03C5-41B4-B975-028E31A119EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B189090-03C5-41B4-B975-028E31A119EE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
32 changes: 32 additions & 0 deletions KeyNStrokeTests/ImageResourcesTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using KeyNStroke;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace KeyNStroke.Tests
{
[TestClass()]
public class ImageResourcesTests
{
[TestMethod()]
public void ApplyScalingFactorTest()
{
KeyNStroke.SettingsStore mySettings = new KeyNStroke.SettingsStore();

mySettings.WindowLocationDefault = new Point(
System.Windows.SystemParameters.PrimaryScreenWidth - mySettings.WindowSizeDefault.Width - 20,
System.Windows.SystemParameters.PrimaryScreenHeight - mySettings.WindowSizeDefault.Height - 40);

//mySettings.ResetAll(); // test defaults
mySettings.LoadAll();

ImageResources.Init(mySettings.ButtonIndicatorCustomIconsFolder);
ImageResources.ApplyScalingFactor(1.0);
ImageResources.ApplyScalingFactor(1.4f);
}
}
}
98 changes: 98 additions & 0 deletions KeyNStrokeTests/KeyNStrokeTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3B189090-03C5-41B4-B975-028E31A119EE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>KeyNStrokeTests</RootNamespace>
<AssemblyName>KeyNStrokeTests</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="WindowsBase" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise />
</Choose>
<ItemGroup>
<Compile Include="ImageResourcesTests.cs" />
<Compile Include="KeystrokeParserTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter">
<Version>2.1.1</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>2.1.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\KeyNStroke\KeyNStroke.csproj">
<Project>{BA117557-FEBC-45C5-8895-4017D05C3DCD}</Project>
<Name>KeyNStroke</Name>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
23 changes: 23 additions & 0 deletions KeyNStrokeTests/KeystrokeParserTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using KeyNStroke;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KeyNStroke.Tests
{
[TestClass()]
public class KeystrokeParserTests
{
[TestMethod()]
public void KeystrokeParserTest()
{
var myKeyboardHook = new KeyboardHook();
var myKeystrokeConverter = new KeystrokeParser(myKeyboardHook);
Assert.IsNotNull(myKeystrokeConverter);

}
}
}
36 changes: 36 additions & 0 deletions KeyNStrokeTests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("KeyNStrokeTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KeyNStrokeTests")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3b189090-03c5-41b4-b975-028e31a119ee")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]