From 47a2b912d6b2ad62be01dd23d66d091c90e2e07b Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Sun, 15 Mar 2020 10:55:08 -0700 Subject: [PATCH 01/11] Create pull_request.yml --- .github/workflows/pull_request.yml | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/pull_request.yml diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 00000000..1962ea20 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -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 -c Release ./Handlebars/Handlebars.csproj + + 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 --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/Handlebars.csproj -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 }} From 54d3f1ed32484b4bd5451be83be532d35c94beda Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Sun, 15 Mar 2020 11:15:00 -0700 Subject: [PATCH 02/11] Create ci.yml --- .github/workflows/ci.yml | 73 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f27dfff4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,73 @@ +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.sln --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 + + - 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=1.0.0-beta-${{ github.run_number }} && dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json From 8311487ac4d37086bc78f656abef040804c7495c Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Sun, 15 Mar 2020 11:16:07 -0700 Subject: [PATCH 03/11] Create release.yml --- .github/workflows/release.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..ce4a5237 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 From 8eae4682e5b07db68c383235742e8d29b2779b27 Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Sun, 15 Mar 2020 11:17:00 -0700 Subject: [PATCH 04/11] Update pull_request.yml --- .github/workflows/pull_request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 1962ea20..43881793 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -15,7 +15,7 @@ jobs: dotnet-version: 3.1.102 - name: Build working-directory: ./source - run: dotnet build -c Release ./Handlebars/Handlebars.csproj + run: dotnet build Handlebars.Code.sln -c Release test: runs-on: windows-latest @@ -38,7 +38,7 @@ jobs: - name: Sonarscanner for dotnet uses: Secbyte/dotnet-sonarscanner@v2.2 with: - buildCommand: dotnet build source/Handlebars/Handlebars.csproj -f netstandard2.0 + 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 From 942420f17a1747cd9bfbae4cd5adde6fe020b051 Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Mon, 16 Mar 2020 15:25:34 -0700 Subject: [PATCH 05/11] Add `Handlebars.Code.sln` --- source/Handlebars.Code.sln | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 source/Handlebars.Code.sln diff --git a/source/Handlebars.Code.sln b/source/Handlebars.Code.sln new file mode 100644 index 00000000..1a5ef6e5 --- /dev/null +++ b/source/Handlebars.Code.sln @@ -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 From d7e3c112ad75bebd3f828ac8ea6d4df9437e0404 Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Mon, 16 Mar 2020 15:43:43 -0700 Subject: [PATCH 06/11] Update pull_request.yml --- .github/workflows/pull_request.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 43881793..45e4d681 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -26,6 +26,10 @@ jobs: uses: actions/setup-dotnet@v1 with: dotnet-version: 3.1.102 + - name: Setup dotnet (legacy) + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 1.1.2 - name: Test working-directory: ./source run: dotnet test ./Handlebars.Test/Handlebars.Test.csproj --logger:trx From cfea4b0d490e00d66cdf72b791d14ac226df4049 Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Mon, 16 Mar 2020 15:47:46 -0700 Subject: [PATCH 07/11] Update pull_request.yml --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 45e4d681..a32881ef 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -29,7 +29,7 @@ jobs: - name: Setup dotnet (legacy) uses: actions/setup-dotnet@v1 with: - dotnet-version: 1.1.2 + dotnet-version: 1.1.14 - name: Test working-directory: ./source run: dotnet test ./Handlebars.Test/Handlebars.Test.csproj --logger:trx From 53e01096c52e4ff41d3d8e3bf65baf83c0e80745 Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Mon, 16 Mar 2020 15:55:13 -0700 Subject: [PATCH 08/11] Add netcoreapp3.1 --- source/Handlebars.Test/Handlebars.Test.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Handlebars.Test/Handlebars.Test.csproj b/source/Handlebars.Test/Handlebars.Test.csproj index f9157cfe..e9c73b82 100644 --- a/source/Handlebars.Test/Handlebars.Test.csproj +++ b/source/Handlebars.Test/Handlebars.Test.csproj @@ -2,7 +2,7 @@ full - net461;netcoreapp1.1;netcoreapp2.0 + net461;netcoreapp1.1;netcoreapp2.0;netcoreapp3.1 From c8f5ccccb41baa0e104bb4a6f8a99f4a777c3ac4 Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Mon, 16 Mar 2020 15:56:01 -0700 Subject: [PATCH 09/11] Update pull_request.yml --- .github/workflows/pull_request.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index a32881ef..bf218810 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -26,13 +26,9 @@ jobs: uses: actions/setup-dotnet@v1 with: dotnet-version: 3.1.102 - - name: Setup dotnet (legacy) - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 1.1.14 - name: Test working-directory: ./source - run: dotnet test ./Handlebars.Test/Handlebars.Test.csproj --logger:trx + run: dotnet test ./Handlebars.Test/Handlebars.Test.csproj -f netcoreapp3.1 --logger:trx sonar-pr: runs-on: ubuntu-latest From b8b548b047875d615579ad88d2d83899d1150d88 Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Mon, 16 Mar 2020 16:12:48 -0700 Subject: [PATCH 10/11] Fix tests --- source/Handlebars.Test/Handlebars.Test.csproj | 3 +++ source/Handlebars.Test/WhitespaceTests.cs | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/Handlebars.Test/Handlebars.Test.csproj b/source/Handlebars.Test/Handlebars.Test.csproj index e9c73b82..662482e0 100644 --- a/source/Handlebars.Test/Handlebars.Test.csproj +++ b/source/Handlebars.Test/Handlebars.Test.csproj @@ -11,6 +11,9 @@ $(DefineConstants);netstandard + + $(DefineConstants);netstandard + diff --git a/source/Handlebars.Test/WhitespaceTests.cs b/source/Handlebars.Test/WhitespaceTests.cs index cf73457d..ca64a623 100644 --- a/source/Handlebars.Test/WhitespaceTests.cs +++ b/source/Handlebars.Test/WhitespaceTests.cs @@ -54,7 +54,8 @@ public void ComplexTest() {{~/if~}} {{~/each}}"; - var template = Handlebars.Compile(source); + var h = Handlebars.Create(); + var template = h.Compile(source); var data = new { nav = new [] { new { @@ -77,7 +78,8 @@ public void ComplexTest() public void StandaloneEach() { var source = "Links:\n {{#each nav}}\n \n {{#if test}}\n {{title}}\n {{else}}\n Empty\n {{/if}}\n \n {{/each}}"; - var template = Handlebars.Compile(source); + var h = Handlebars.Create(); + var template = h.Compile(source); var data = new { nav = new[] From e367f9e8e1e39839e629226baebad17eef8161de Mon Sep 17 00:00:00 2001 From: Oleh Formaniuk Date: Tue, 17 Mar 2020 08:17:17 -0700 Subject: [PATCH 11/11] Update ci.yml --- .github/workflows/ci.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f27dfff4..9166b109 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: dotnet-version: 3.1.102 - name: Test working-directory: ./source - run: dotnet test Handlebars.sln --logger:trx + run: dotnet test ./Handlebars.Test/Handlebars.Test.csproj -f netcoreapp3.1 --logger:trx sonar-ci: runs-on: ubuntu-latest @@ -62,12 +62,16 @@ jobs: 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=1.0.0-beta-${{ github.run_number }} && dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json + 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