Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #53 from nils-org/release/2.0.0
Browse files Browse the repository at this point in the history
Release/2.0.0
  • Loading branch information
nils-a authored Jun 22, 2021
2 parents 9852adf + eab6843 commit b3c1214
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 101 deletions.
8 changes: 0 additions & 8 deletions .github/dependabot.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>nils-org/renovate-config"
],
"packageRules": [
{
"matchPackageNames": ["Topshelf"],
"matchUpdateTypes": ["minor", "patch"],
"enabled": false
}
]
}
26 changes: 14 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ ubuntu-18.04, windows-2019, macos-10.15 ]

steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
ref: ${{ github.event.ref }}
- name: Checkout the repository
uses: actions/checkout@v2

- name: Fetch all tags and branches
run: git fetch --prune --unshallow

- name: Cache Tools
uses: actions/cache@v2
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }}

- name: Build project
uses: cake-build/cake-action@v1
with:
Expand All @@ -33,18 +36,17 @@ jobs:
verbosity: Diagnostic
cake-version: 0.38.5
cake-bootstrap: true
# currently, Cake.Recipe does not upload artifacts when run on gh-actions
- name: Upload Issues

- name: Upload Issues-Report
uses: actions/upload-artifact@v2
with:
if-no-files-found: warn
name: ${{ matrix.os }} Issues
path: |
BuildArtifacts/report.html
BuildArtifacts/**/coverlet/*.xml
name: ${{ matrix.os }} issues
path: BuildArtifacts/report.html

- name: Upload Packages
uses: actions/upload-artifact@v2
if: matrix.os == 'windows-latest'
if: runner.os == 'Windows'
with:
if-no-files-found: warn
name: package
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-18.04

strategy:
fail-fast: false
Expand Down Expand Up @@ -59,6 +59,7 @@ jobs:
uses: cake-build/cake-action@v1
with:
script-path: recipe.cake
target: DotNetCore-Build
verbosity: Diagnostic
cake-version: 0.38.5
cake-bootstrap: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publishDocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: checkout
uses: actions/[email protected].3 #https://github.com/actions/checkout
uses: actions/[email protected].4
with:
fetch-depth: 0 # GitVersion is somewhat irritated when fetch-depth is "1"....
ref: ${{ github.event.ref }}
Expand Down
61 changes: 41 additions & 20 deletions .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,64 @@ name: "SonarCloud"

on:
push:
branches: [develop]
branches: [develop, main]
pull_request:
branches: [develop]
branches: [develop, main]
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

- name: Cache Tools
- name: Cache Cake-Tools
uses: actions/cache@v2
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }}

- name: Build project
uses: cake-build/cake-action@v1
- name: Cache SonarCloud packages
uses: actions/cache@v2
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v2
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Get Java 11
uses: actions/setup-java@v2
with:
script-path: recipe.cake
verbosity: Diagnostic
cake-version: 0.38.5
cake-bootstrap: true
java-version: "11"
java-package: jre

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT: "nils-org_Topshelf.LightCore"
SONAR_ORG: "nils-org"
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"${{ env.SONAR_PROJECT }}" /o:"${{ env.SONAR_ORG }}" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
.\build.ps1
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ dist/
tools/
/tools/
/BuildArtifacts/
.history/
*.user
2 changes: 1 addition & 1 deletion recipe.cake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#load nuget:?package=Cake.Recipe&version=2.0.1
#load nuget:?package=Cake.Recipe&version=2.2.1

Environment.SetVariableNames();

Expand Down
12 changes: 0 additions & 12 deletions sonar-project.properties

This file was deleted.

66 changes: 37 additions & 29 deletions src/Topshelf.LightCore.Tests/Topshelf.LightCore.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<AssemblyTitle>Topshelf.LightCore.Tests</AssemblyTitle>
<Product>Topshelf.LightCore.Tests</Product>
<Copyright>Copyright © Nils Andresen 2019-2020</Copyright>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<ItemGroup>
<Reference Include="System.Configuration.Install" />
<Reference Include="System.ServiceProcess" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="LightCore" Version="1.5.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Topshelf" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Topshelf.LightCore\Topshelf.LightCore.csproj" />
</ItemGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<AssemblyTitle>Topshelf.LightCore.Tests</AssemblyTitle>
<Product>Topshelf.LightCore.Tests</Product>
<Copyright>Copyright © Nils Andresen 2019-2020</Copyright>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<ItemGroup>
<Reference Include="System.Configuration.Install" />
<Reference Include="System.ServiceProcess" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="LightCore" Version="1.5.1" />
<PackageReference Include="Shouldly" Version="4.0.3" />
<PackageReference Include="Topshelf" Version="4.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="16.10.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Topshelf.LightCore\Topshelf.LightCore.csproj" />
</ItemGroup>
</Project>
27 changes: 14 additions & 13 deletions src/Topshelf.LightCore.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using FluentAssertions;
using LightCore;
using LightCore;
using System;
using NUnit.Framework;

using Shouldly;

using Xunit;

namespace Topshelf.LightCore.Tests
{
[TestFixture]
public class UnitTest1
{
[TestCase]
[Fact]
public void TestMethod1()
{
// Arrange
Expand All @@ -20,7 +21,7 @@ public void TestMethod1()
builder.Register(x =>
{
diWasCalled = true;
return new FakeSevice(
return new FakeService(
() => startCalled = true,
() => stopCalled = true);
});
Expand All @@ -30,7 +31,7 @@ public void TestMethod1()
{
x.ApplyCommandLine(string.Empty); // fake "normal" start
x.UseLightCore(container);
x.Service<FakeSevice>(s =>
x.Service<FakeService>(s =>
{
s.ConstructUsingLightCore();
s.WhenStarted(tc => tc.Start());
Expand All @@ -47,19 +48,19 @@ public void TestMethod1()
var actual = host.Run();

// assert
actual.Should().Be(TopshelfExitCode.Ok);
diWasCalled.Should().BeTrue();
startCalled.Should().BeTrue();
stopCalled.Should().BeTrue();
actual.ShouldBe(TopshelfExitCode.Ok);
diWasCalled.ShouldBeTrue();
startCalled.ShouldBeTrue();
stopCalled.ShouldBeTrue();
}
}

internal class FakeSevice
internal class FakeService
{
private readonly Action start;
private readonly Action stop;

internal FakeSevice(Action start, Action stop)
internal FakeService(Action start, Action stop)
{
this.start = start;
this.stop = stop;
Expand Down
8 changes: 4 additions & 4 deletions src/Topshelf.LightCore/Topshelf.LightCore.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<TargetFramework>net461</TargetFramework>
<PackageId>Topshelf.LightCore</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -16,7 +16,7 @@
<FullYear Condition="'$(StartYear)'!='$(EndYear)'">$(StartYear)-$(EndYear)</FullYear>
<Version>1.0.0.0</Version>
<Authors>Nils Andresen</Authors>
<Description>A simple LightCore bindings for Topshelf</Description>
<Description>A simple LightCore binding for Topshelf</Description>
<Copyright>Copyright © $(FullYear) — Nils Andresen</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/nils-org/Topshelf.LightCore</RepositoryUrl>
Expand All @@ -34,8 +34,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="LightCore" Version="1.5.1" />
<PackageReference Include="Topshelf" Version="4.2.1" />
<PackageReference Include="LightCore" Version="1.5.1" PrivateAssets="all" />
<PackageReference Include="Topshelf" Version="4.0.0" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit b3c1214

Please sign in to comment.