Skip to content

Commit

Permalink
housekeeping: Move Splat to GitHub actions
Browse files Browse the repository at this point in the history
Fix a number of warnings
  • Loading branch information
glennawatson committed Oct 13, 2020
1 parent a2cadff commit 13775c5
Show file tree
Hide file tree
Showing 57 changed files with 400 additions and 181 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Build

on:
push:
branches: [ main ]
pull_request:
types: [opened, synchronize, reopened, closed]
branches: [ main ]

env:
configuration: Release
productNamespacePrefix: "Splat"

jobs:
build:
runs-on: windows-latest
outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: NBGV
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1

- name: Build
run: msbuild /t:restore,build,pack /maxcpucount /p:NoPackageAnalysis=true /verbosity:minimal /p:Configuration=${{ env.configuration }}
working-directory: src

- name: Install Report Generator
run: dotnet tool install --global dotnet-reportgenerator-globaltool

- name: Run Unit Tests
run: dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput="../../artifacts/coverage/coverage.xml" /p:Include="[${{ env.productNamespacePrefix}}*]*" /p:Exclude="[${{ env.productNamespacePrefix}}*Tests.*]*"
working-directory: src

- name: Generate Coverage Report
run: reportgenerator -reports:"coverage.*.xml" -targetdir:report-output
working-directory: artifacts/coverage

- name: Upload Code Coverage
run: |
npm install -g codecov
codecov
working-directory: artifacts/coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Create NuGet Artifacts
uses: actions/upload-artifact@master
with:
name: nuget
path: '**/*.nupkg'

release:
runs-on: ubuntu-latest
needs: build
if: contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Download NuGet Packages
uses: actions/download-artifact@v2
with:
name: nuget

- name: Save SignClient Configuration
run: 'echo "$SIGN_CLIENT_CONFIG" > SignPackages.json'
shell: bash
env:
SIGN_CLIENT_CONFIG: ${{secrets.SIGN_CLIENT_CONFIG}}

- name: Sign NuGet Packages
uses: glennawatson/signclient@v1
with:
input-files: '**/*.nupkg'
sign-client-secret: ${{ secrets.SIGN_CLIENT_SECRET }}
sign-client-user: ${{ secrets.SIGN_CLIENT_USER_ID }}
project-name: reactiveui
description: reactiveui
config-file: SignPackages.json

- name: Changelog
uses: glennawatson/ChangeLog@v1
id: changelog

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.build.outputs.nbgv }}
release_name: ${{ needs.build.outputs.nbgv }}
body: |
${{ steps.changelog.outputs.commitLog }}
- name: NuGet Push
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
SOURCE_URL: https://api.nuget.org/v3/index.json
run: |
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg
9 changes: 7 additions & 2 deletions src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,21 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Xunit.StaFact" Version="1.0.37" />
<PackageReference Include="Shouldly" Version="4.0.0-beta0002" />
<PackageReference Include="Shouldly" Version="4.0.0-beta0003" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="4.4.1" />
<PackageReference Include="PublicApiGenerator" Version="10.2.0" />
<PackageReference Include="DiffEngine" Version="6.1.1" />
</ItemGroup>

<ItemGroup Condition="$(IsTestProject) and !$(TargetFramework.StartsWith('netstandard'))">
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
</ItemGroup>

<ItemGroup Condition="$(IsTestProject) and !$(TargetFramework.StartsWith('MonoAndroid')) and !$(TargetFramework.StartsWith('uap')) ">
<PackageReference Include="coverlet.msbuild" Version="2.9.0" />
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' != 'true'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
Expand All @@ -66,7 +71,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.164" PrivateAssets="all" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.205" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0" PrivateAssets="all" />
</ItemGroup>
Expand Down
5 changes: 0 additions & 5 deletions src/Splat.Android.Tests/Assets/xunit.runner.json

This file was deleted.

5 changes: 0 additions & 5 deletions src/Splat.Android.Tests/Properties/AndroidManifest.xml

This file was deleted.

41 changes: 0 additions & 41 deletions src/Splat.Android.Tests/Properties/AssemblyInfo.cs

This file was deleted.

Binary file removed src/Splat.Android.Tests/Resources/drawable/Icon.png
Binary file not shown.
13 changes: 0 additions & 13 deletions src/Splat.Android.Tests/Resources/layout/Main.axml

This file was deleted.

6 changes: 2 additions & 4 deletions src/Splat.AppCenter/AppCenterViewTracking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ public void OnViewNavigation(string name)
Microsoft.AppCenter.Analytics.Analytics.TrackEvent("PageView", properties);
}

private IDictionary<string, string> GetProperties(string name)
private static IDictionary<string, string> GetProperties(string name)
{
var properties = new Dictionary<string, string>
return new Dictionary<string, string>
{
{ "Name", name },
};

return properties;
}
}
}
2 changes: 2 additions & 0 deletions src/Splat.Autofac.Tests/DependencyResolverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ public override void UnregisterAllByContract_UnregisterCurrent_Doesnt_Throw_When
[Fact]
public override void HasRegistration()
{
#pragma warning disable CS0618 // Type or member is obsolete
var type = typeof(string);
const string contractOne = "ContractOne";
const string contractTwo = "ContractTwo";
Expand All @@ -227,6 +228,7 @@ public override void HasRegistration()
Assert.True(resolver.HasRegistration(type));
Assert.True(resolver.HasRegistration(type, contractOne));
Assert.True(resolver.HasRegistration(type, contractTwo));
#pragma warning restore CS0618 // Type or member is obsolete
}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ private static bool HasCorrectStreamEnd(Stream sourceStream)
&& sourceStream.ReadByte() == 0xD9;
}

private static Dictionary<string, int> GetDrawableList()
{
return GetDrawableList(Locator.Current.GetService<ILogManager>().GetLogger(typeof(PlatformBitmapLoader)));
}

private void AttemptStreamByteCorrection(Stream sourceStream)
{
if (!sourceStream.CanWrite)
Expand All @@ -232,10 +237,5 @@ private void AttemptStreamByteCorrection(Stream sourceStream)
sourceStream.Write(new byte[] { 0xFF, 0xD9 });
}
}

private Dictionary<string, int> GetDrawableList()
{
return GetDrawableList(Locator.Current.GetService<ILogManager>().GetLogger(typeof(PlatformBitmapLoader)));
}
}
}
2 changes: 1 addition & 1 deletion src/Splat.DryIoc/Splat.DryIoc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DryIoc.Dll" Version="4.4.1" />
<PackageReference Include="DryIoc.Dll" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/Splat.Exceptionless/ExceptionlessSplatLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public ExceptionlessSplatLogger(
Type sourceType,
ExceptionlessClient exceptionlessClient)
{
if (sourceType is null)
{
throw new ArgumentNullException(nameof(sourceType));
}

_sourceType = sourceType.FullName;
_exceptionlessClient = exceptionlessClient ?? throw new ArgumentNullException(nameof(exceptionlessClient));
_exceptionlessClient.Configuration.Changed += OnInnerLoggerReconfigured;
Expand Down Expand Up @@ -80,6 +85,11 @@ public void Write(Exception exception, string message, LogLevel logLevel)
/// <inheritdoc />
public void Write(string message, Type type, LogLevel logLevel)
{
if (type is null)
{
throw new ArgumentNullException(nameof(type));
}

if ((int)logLevel < (int)Level)
{
return;
Expand All @@ -91,6 +101,11 @@ public void Write(string message, Type type, LogLevel logLevel)
/// <inheritdoc />
public void Write(Exception exception, string message, Type type, LogLevel logLevel)
{
if (type is null)
{
throw new ArgumentNullException(nameof(type));
}

if ((int)logLevel < (int)Level)
{
return;
Expand Down
4 changes: 2 additions & 2 deletions src/Splat.Exceptionless/Splat.Exceptionless.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<PackageId>Splat.Exceptionless</PackageId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Exceptionless" Version="4.4.1" />
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
<PackageReference Include="Exceptionless" Version="4.5.0" />
<PackageReference Include="System.Collections.Immutable" Version="1.7.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ private class ContractDictionary
{
private readonly ConcurrentDictionary<string, IList<Func<object>>> _dictionary = new ConcurrentDictionary<string, IList<Func<object>>>();

public bool IsEmpty => _dictionary.Count == 0;
public bool IsEmpty => _dictionary.IsEmpty;

public bool TryRemoveContract(string contract) =>
_dictionary.TryRemove(contract, out var _);
Expand Down
3 changes: 2 additions & 1 deletion src/Splat.Ninject/NinjectDependencyResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Ninject;
using Ninject.Planning.Bindings;
Expand Down Expand Up @@ -41,7 +42,6 @@ public virtual IEnumerable<object> GetServices(Type serviceType, string contract
serviceType = typeof(NullServiceType);
}

IEnumerable<object> services;
if (isNull)
{
return _kernel.GetAll(
Expand Down Expand Up @@ -168,6 +168,7 @@ private static bool IsCorrectMetadata(global::Ninject.Planning.Bindings.IBinding
|| (metadata?.Name != null && metadata.Name.Equals(contract, StringComparison.OrdinalIgnoreCase));
}

[SuppressMessage("Design", "CA1812: Uninitialized class.", Justification = "Used in reflection.")]
private class NullServiceType
{
public NullServiceType(Func<object> factory)
Expand Down
Loading

0 comments on commit 13775c5

Please sign in to comment.