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

Update of TFM & dependency optimisation #578

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
38 changes: 21 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches: [ master ]

jobs:
build:
name: Build
Expand All @@ -30,14 +30,14 @@ jobs:
os: [ macos-latest, ubuntu-latest, windows-2019 ]
steps:
- uses: actions/checkout@master
- name: Setup dotnet 2.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.x
- name: Setup dotnet 3.1
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
- name: Clean package cache as a temporary workaround for https://github.com/actions/setup-dotnet/issues/155
working-directory: ./source
run: dotnet clean -c Release && dotnet nuget locals all --clear
Expand All @@ -52,14 +52,14 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup dotnet 2.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.x
- name: Setup dotnet 3.1
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
- uses: actions/setup-java@v4
with:
java-version: '21' # The JDK version to make available on the path.
Expand Down Expand Up @@ -97,15 +97,19 @@ jobs:
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Handlebars-Net_Handlebars.Net" /o:"handlebars-net" /d:sonar.login="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/*.opencover.xml" /d:sonar.cs.vstest.reportsPaths="**/*.trx" /d:sonar.coverage.exclusions="**/*.md;source/Handlebars.Benchmark/**/*.*" /d:sonar.cpd.exclusions="source/Handlebars/Iterators/**/*.*"
dotnet build source/Handlebars.sln -c Release
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ env.SONAR_TOKEN }}"

benchmark:
name: Run Benchmark.Net
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
- name: Clean package cache as a temporary workaround for https://github.com/actions/setup-dotnet/issues/155
working-directory: ./source
run: dotnet clean -c Release && dotnet nuget locals all --clear
Expand Down Expand Up @@ -136,8 +140,8 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: Benchmark
path: source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results/
path: source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results/

update_release_draft:
name: Release Drafter
runs-on: ubuntu-latest
Expand Down
46 changes: 27 additions & 19 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@ on:

jobs:
build:
name: Build
name: Build
runs-on: windows-2019
steps:
- uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
- name: Clean package cache as a temporary workaround for https://github.com/actions/setup-dotnet/issues/155
working-directory: ./source
run: dotnet clean -c Release && dotnet nuget locals all --clear
- name: Build
working-directory: ./source
run: dotnet build -c Release

test:
name: Tests on ${{ matrix.os }}
needs: [ build ]
Expand All @@ -30,36 +34,36 @@ jobs:
os: [ macos-latest, ubuntu-latest, windows-2019 ]
steps:
- uses: actions/checkout@master
- name: Setup dotnet 2.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.x
- name: Setup dotnet 3.1
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
- name: Clean package cache as a temporary workaround for https://github.com/actions/setup-dotnet/issues/155
working-directory: ./source
run: dotnet clean -c Release && dotnet nuget locals all --clear
- name: Test
working-directory: ./source
run: dotnet test --logger:trx --logger:GitHubActions

sonar-pr:
name: SonarCloud
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup dotnet 2.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.x
- name: Setup dotnet 3.1
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
- uses: actions/setup-java@v4
with:
java-version: '21' # The JDK version to make available on the path.
Expand Down Expand Up @@ -105,7 +109,11 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
- name: Clean package cache as a temporary workaround for https://github.com/actions/setup-dotnet/issues/155
working-directory: ./source
run: dotnet clean -c Release && dotnet nuget locals all --clear
Expand All @@ -132,7 +140,7 @@ jobs:
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: '@zjklee'

- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x

- name: Clean package cache as a temporary workaround for https://github.com/actions/setup-dotnet/issues/155
working-directory: ./source
Expand Down
16 changes: 8 additions & 8 deletions source/Handlebars.Test/DynamicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class EnvGenerator : IEnumerable<object[]>

IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}

[Fact]
public void DynamicObjectBasicTest()
{
Expand All @@ -36,7 +36,7 @@ public void DynamicObjectBasicTest()

Assert.Equal("Foo: 1\nBar: hello world", output);
}

[Fact]
public void DynamicObjectBasicIterationTest()
{
Expand Down Expand Up @@ -106,7 +106,7 @@ public void JsonTestArrays(IHandlebars handlebars){

Assert.Equal("Key1Val1Key2Val2", output);
}

[Theory]
[ClassData(typeof(EnvGenerator))]
public void JsonTestArrayCount(IHandlebars handlebars)
Expand All @@ -121,7 +121,7 @@ public void JsonTestArrayCount(IHandlebars handlebars)

Assert.Equal("2", output);
}

[Theory]
[ClassData(typeof(EnvGenerator))]
public void JsonTestObjects(IHandlebars handlebars){
Expand Down Expand Up @@ -150,7 +150,7 @@ public void JObjectTest(IHandlebars handlebars) {

Assert.Equal("", output);
}

[Theory]
[ClassData(typeof(EnvGenerator))]
public void WithParentIndexJsonNet(IHandlebars handlebars)
Expand All @@ -174,7 +174,7 @@ public void WithParentIndexJsonNet(IHandlebars handlebars)
{{/each}}
{{/each}}
{{/each}}";

var template = handlebars.Compile( source );
var data = new
{
Expand Down Expand Up @@ -281,13 +281,13 @@ public void WithParentIndexJsonNet(IHandlebars handlebars)
index=[1:1:1]
first=[False:False:False]
last=[True:True:True]";

Func<string, string> makeFlat = text => text.Replace( " ", "" ).Replace( "\n", "" ).Replace( "\r", "" );

Assert.Equal( makeFlat( expected ), makeFlat( result ) );
}

#if !netstandard
#if NET452 || NET46 || NET461 || NET472

[Fact]
public void SystemJsonTestArrays()
Expand Down
38 changes: 7 additions & 31 deletions source/Handlebars.Test/Handlebars.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,41 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net5;net6</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT'">$(TargetFrameworks);net452;net46;net461;net472</TargetFrameworks>
<ProjectGuid>6BA232A6-8C4D-4C7D-BD75-1844FE9774AF</ProjectGuid>
<RootNamespace>HandlebarsDotNet.Test</RootNamespace>
<IsPackable>false</IsPackable>
<SignAssembly>false</SignAssembly>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<PropertyGroup>
<NoWarn>0618;1701</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net472'">
<DefineConstants>$(DefineConstants);netFramework</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net461'">
<DefineConstants>$(DefineConstants);netFramework</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net46'">
<DefineConstants>$(DefineConstants);netFramework</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net452'">
<DefineConstants>$(DefineConstants);netFramework</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp2.1'">
<DefineConstants>$(DefineConstants);netcoreapp;netstandard</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
<DefineConstants>$(DefineConstants);netcoreapp;netstandard</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Handlebars\Handlebars.csproj" />
</ItemGroup>
Expand All @@ -52,26 +28,26 @@
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
</ItemGroup>


<ItemGroup Condition="'$(TargetFramework)'=='net46' or '$(TargetFramework)'=='net461' or '$(TargetFramework)'=='net472' or '$(TargetFramework)'=='net452'">
<PackageReference Include="CsQuery" Version="1.3.4" />
<PackageReference Include="Microsoft.AspNet.WebPages" Version="3.2.3" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
</ItemGroup>


<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1' or '$(TargetFramework)'=='netcoreapp2.1'">

<ItemGroup Condition="'$(TargetFramework)'!='net46' and '$(TargetFramework)'!='net461' and '$(TargetFramework)'!='net472' and '$(TargetFramework)'!='net452'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
<PackageReference Include="CsQuery.NetStandard" Version="1.3.6.1" />
</ItemGroup>

<ItemGroup>
<Content Include="ViewEngine\**\*.hbs" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
Expand Down
Loading
Loading