Skip to content

Commit

Permalink
Merge pull request #578 from thompson-tomo/chore/#573_AddAdditionalTFM
Browse files Browse the repository at this point in the history
  • Loading branch information
oformaniuk authored Apr 2, 2024
2 parents bed0c0e + 3961cf7 commit 837fc18
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 144 deletions.
35 changes: 18 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,13 @@ 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
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 +51,13 @@ 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
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 +95,18 @@ 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
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 +137,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
42 changes: 23 additions & 19 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ 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
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 +33,34 @@ 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
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
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 +106,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: |
2.1.x
3.1.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 +136,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
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: |
2.1.x
3.1.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;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

0 comments on commit 837fc18

Please sign in to comment.