Skip to content
Merged
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
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI

on:
push:
branches: [ master ]

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.102
- name: Build Main
working-directory: ./source
run: dotnet build Handlebars.sln -c Release

test:
name: Test
runs-on: windows-latest
needs: [build]
steps:
- uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.102
- name: Test
working-directory: ./source
run: dotnet test ./Handlebars.Test/Handlebars.Test.csproj -f netcoreapp3.1 --logger:trx

sonar-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.102
- name: Sonarscanner for dotnet
uses: Secbyte/dotnet-sonarscanner@v2.2
with:
buildCommand: dotnet build source/Handlebars.Code.sln -f netstandard2.0
testCommand: dotnet test source/Handlebars.Test/Handlebars.Test.csproj -f netcoreapp3.1 --logger:trx
projectKey: zjklee_handlebars.csharp
projectName: handlebars.csharp
sonarOrganisation: zjklee
beginArguments: >
/d:sonar.verbose="true"
/d:sonar.cs.opencover.reportsPaths='"*.opencover.xml"'
/d:sonar.coverage.exclusions='"**/*.cs","**/*.md"'

env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


publish:
needs: [build,test,sonar-ci]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100
- name: Fetch
run: git fetch --depth 500
- name: Determine version
run: echo "::set-env name=VERSION::$(git describe --tags --abbrev=0)"
- name: publish
working-directory: ./source
run: dotnet pack Handlebars.Code.sln -c Release /p:version=${{ env.VERSION }}.${{ github.run_number }}-beta && dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
54 changes: 54 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Pull Request

on:
pull_request:
branches: [ master ]

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.102
- name: Build
working-directory: ./source
run: dotnet build Handlebars.Code.sln -c Release

test:
runs-on: windows-latest
needs: [build]
steps:
- uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.102
- name: Test
working-directory: ./source
run: dotnet test ./Handlebars.Test/Handlebars.Test.csproj -f netcoreapp3.1 --logger:trx

sonar-pr:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Sonarscanner for dotnet
uses: Secbyte/dotnet-sonarscanner@v2.2
with:
buildCommand: dotnet build source/Handlebars.Code.sln -f netstandard2.0
testCommand: dotnet test source/Handlebars.Test/Handlebars.Test.csproj -f netcoreapp3.1 --logger:trx
projectKey: zjklee_handlebars.csharp
projectName: handlebars.csharp
sonarOrganisation: zjklee
beginArguments: >
/d:sonar.verbose="true"
/d:sonar.coverage.exclusions='"**/*.cs","**/*.md"'
/d:sonar.pullrequest.key=${{ github.event.number }}
/d:sonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
/d:sonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release

on:
release:
types: [published]

jobs:
publish:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100

- name: publish
working-directory: ./source
run: dotnet pack Handlebars.Code.sln -c Release /p:version=${{ github.event.release.tag_name }} && dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json
66 changes: 66 additions & 0 deletions source/Handlebars.Code.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.3
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Handlebars", "Handlebars\Handlebars.csproj", "{A09CFF95-B671-48FE-96A8-D3CBDC110B75}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E9AC0BCD-C060-4634-BBBB-636167C809B4}"
ProjectSection(SolutionItems) = preProject
..\README.md = ..\README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A09CFF95-B671-48FE-96A8-D3CBDC110B75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A09CFF95-B671-48FE-96A8-D3CBDC110B75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A09CFF95-B671-48FE-96A8-D3CBDC110B75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A09CFF95-B671-48FE-96A8-D3CBDC110B75}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.TextStylePolicy = $1
$1.inheritsSet = VisualStudio
$1.inheritsScope = text/plain
$1.scope = text/x-csharp
$0.CSharpFormattingPolicy = $2
$2.IndentSwitchBody = True
$2.IndentBlocksInsideExpressions = True
$2.AnonymousMethodBraceStyle = NextLine
$2.PropertyBraceStyle = NextLine
$2.PropertyGetBraceStyle = NextLine
$2.PropertySetBraceStyle = NextLine
$2.EventBraceStyle = NextLine
$2.EventAddBraceStyle = NextLine
$2.EventRemoveBraceStyle = NextLine
$2.StatementBraceStyle = NextLine
$2.ElseNewLinePlacement = NewLine
$2.CatchNewLinePlacement = NewLine
$2.FinallyNewLinePlacement = NewLine
$2.WhileNewLinePlacement = DoNotCare
$2.ArrayInitializerWrapping = DoNotChange
$2.ArrayInitializerBraceStyle = NextLine
$2.BeforeMethodDeclarationParentheses = False
$2.BeforeMethodCallParentheses = False
$2.BeforeConstructorDeclarationParentheses = False
$2.NewLineBeforeConstructorInitializerColon = NewLine
$2.NewLineAfterConstructorInitializerColon = SameLine
$2.BeforeDelegateDeclarationParentheses = False
$2.NewParentheses = False
$2.SpacesBeforeBrackets = False
$2.inheritsSet = Mono
$2.inheritsScope = text/x-csharp
$2.scope = text/x-csharp
$0.DotNetNamingPolicy = $3
$3.DirectoryNamespaceAssociation = None
$3.ResourceNamePolicy = FileFormatDefault
version = 1.0.0
EndGlobalSection
EndGlobal
5 changes: 4 additions & 1 deletion source/Handlebars.Test/Handlebars.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<DebugType>full</DebugType>
<TargetFrameworks>net461;netcoreapp1.1;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp1.1;netcoreapp2.0;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp1.1'">
Expand All @@ -11,6 +11,9 @@
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp2.0'">
<DefineConstants>$(DefineConstants);netstandard</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
<DefineConstants>$(DefineConstants);netstandard</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Handlebars\Handlebars.csproj" />
Expand Down
6 changes: 4 additions & 2 deletions source/Handlebars.Test/WhitespaceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public void ComplexTest()
{{~/if~}}
</a>
{{~/each}}";
var template = Handlebars.Compile(source);
var h = Handlebars.Create();
var template = h.Compile(source);
var data = new {
nav = new [] {
new {
Expand All @@ -77,7 +78,8 @@ public void ComplexTest()
public void StandaloneEach()
{
var source = "Links:\n {{#each nav}}\n <a href=\"{{url}}\">\n {{#if test}}\n {{title}}\n {{else}}\n Empty\n {{/if}}\n </a>\n {{/each}}";
var template = Handlebars.Compile(source);
var h = Handlebars.Create();
var template = h.Compile(source);
var data = new
{
nav = new[]
Expand Down