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
69 changes: 26 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@ on:
jobs:
build:
name: Build
runs-on: windows-2019
runs-on: windows-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
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
10.0.x
- name: Build
working-directory: ./source
run: dotnet build -c Release
Expand All @@ -30,53 +26,45 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-2019 ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
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
10.0.x
- name: Test
working-directory: ./source
run: dotnet test --logger:trx --logger:GitHubActions

sonar-ci:
name: SonarCloud
runs-on: windows-2019
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup dotnet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
2.1.x
3.1.x
6.0.x
10.0.x
- uses: actions/setup-java@v4
with:
java-version: '21' # The JDK version to make available on the path.
java-version: '21'
distribution: 'zulu'
- 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: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
Expand All @@ -92,52 +80,47 @@ jobs:
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: 22a5e1c1df52b7200ac14fc139ed1dfbe53dda4d
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.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/**/*.*"
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Handlebars-Net_Handlebars.Net" /o:"handlebars-net" /d:sonar.token="$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 }}"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="$env:SONAR_TOKEN"

benchmark:
name: Run Benchmark.Net
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
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
10.0.x
- name: Run benchmark
working-directory: ./source/Handlebars.Benchmark
run: dotnet run -c Release --exporters json --filter '*' -m --join
run: dotnet run -c Release -f net10.0 --exporters json --filter '*' -m --join
- name: Get benchmark file name
id: benchmarkfilename
working-directory: ./source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results
run: |
filePath=$(find . -type f -name 'BenchmarkRun-joined-*-report-full-compressed.json' | rev | cut -d '/' -f1 | rev)
echo $filePath
echo "::set-output name=file::$filePath"
echo "file=$filePath" >> $GITHUB_OUTPUT
- name: Store benchmark result
uses: Happypig375/github-action-benchmark@v1.8.2
uses: Happypig375/github-action-benchmark@e7cb068f90622402c0ae5b54e2c781052fcd9343 # v1.8.2
with:
name: Benchmark.Net Benchmark
tool: 'benchmarkdotnet'
output-file-path: source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results/${{ steps.benchmarkfilename.outputs.file }}
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: '@zjklee'
- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Benchmark
path: source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results/
Expand All @@ -147,6 +130,6 @@ jobs:
runs-on: ubuntu-latest
needs: [build, test, sonar-ci]
steps:
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71 changes: 28 additions & 43 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@ on:
jobs:
build:
name: Build
runs-on: windows-2019
runs-on: windows-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
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
10.0.x
- name: Build
working-directory: ./source
run: dotnet build -c Release
Expand All @@ -30,53 +26,45 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-2019 ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
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
10.0.x
- name: Test
working-directory: ./source
run: dotnet test --logger:trx --logger:GitHubActions

sonar-pr:
name: SonarCloud
runs-on: windows-2019
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup dotnet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
2.1.x
3.1.x
6.0.x
10.0.x
- uses: actions/setup-java@v4
with:
java-version: '21' # The JDK version to make available on the path.
java-version: '21'
distribution: 'zulu'
- 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: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
Expand All @@ -92,53 +80,50 @@ jobs:
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: 22a5e1c1df52b7200ac14fc139ed1dfbe53dda4d
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
PR_KEY: ${{ github.event.number }}
PR_BRANCH: ${{ github.event.pull_request.head.ref }}
PR_BASE: ${{ github.event.pull_request.base.ref }}
shell: powershell
run: |
.\.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/**/*.*" /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 }}
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Handlebars-Net_Handlebars.Net" /o:"handlebars-net" /d:sonar.token="$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/**/*.*" /d:sonar.pullrequest.key="$env:PR_KEY" /d:sonar.pullrequest.branch="$env:PR_BRANCH" /d:sonar.pullrequest.base="$env:PR_BASE"
dotnet build source/Handlebars.sln -c Release
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ env.SONAR_TOKEN }}"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="$env:SONAR_TOKEN"

benchmark:
name: Run Benchmark.Net
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
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
10.0.x
- name: Run benchmark
working-directory: ./source/Handlebars.Benchmark
run: dotnet run -c Release --exporters json --filter '*' -m --join
run: dotnet run -c Release -f net10.0 --exporters json --filter '*' -m --join
- name: Get benchmark file name
working-directory: ./source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results
id: benchmarkfilename
run: |
filePath=$(find . -type f -name 'BenchmarkRun-joined-*-report-full-compressed.json' | rev | cut -d '/' -f1 | rev)
echo $filePath
echo "::set-output name=file::$filePath"
echo "file=$filePath" >> $GITHUB_OUTPUT
- name: Store benchmark result
uses: Happypig375/github-action-benchmark@v1.8.2
uses: Happypig375/github-action-benchmark@e7cb068f90622402c0ae5b54e2c781052fcd9343 # v1.8.2
with:
name: Benchmark.Net Benchmark
tool: 'benchmarkdotnet'
output-file-path: source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results/${{ steps.benchmarkfilename.outputs.file }}
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: false # disabled for PRs
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: '@zjklee'

- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Benchmark
path: source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results/
4 changes: 2 additions & 2 deletions source/Handlebars.Benchmark/Handlebars.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<RootNamespace>HandlebarsNet.Benchmark</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

Expand Down
9 changes: 3 additions & 6 deletions source/Handlebars.Benchmark/Program.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Toolchains.CsProj;

namespace HandlebarsNet.Benchmark
{
static class Program
{
public static void Main(string[] args)
{
var job = Job.MediumRun
.WithToolchain(CsProjCoreToolchain.NetCoreApp31)
.WithLaunchCount(1);
var job = Job.MediumRun.WithLaunchCount(1);

var manualConfig = DefaultConfig.Instance
.AddJob(job);

manualConfig.AddLogicalGroupRules(BenchmarkLogicalGroupRule.ByMethod);

BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, manualConfig);
}
}
}
}
11 changes: 5 additions & 6 deletions source/Handlebars.Test/Handlebars.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT'">$(TargetFrameworks);net452;net46;net461;net472</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT'">$(TargetFrameworks);net472</TargetFrameworks>
<ProjectGuid>6BA232A6-8C4D-4C7D-BD75-1844FE9774AF</ProjectGuid>
<RootNamespace>HandlebarsDotNet.Test</RootNamespace>
<IsPackable>false</IsPackable>
Expand Down Expand Up @@ -30,16 +30,15 @@
</ItemGroup>


<ItemGroup Condition="'$(TargetFramework)'=='net46' or '$(TargetFramework)'=='net461' or '$(TargetFramework)'=='net472' or '$(TargetFramework)'=='net452'">
<ItemGroup Condition="'$(TargetFramework)'=='net472'">
<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)'!='net46' and '$(TargetFramework)'!='net461' and '$(TargetFramework)'!='net472' and '$(TargetFramework)'!='net452'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<ItemGroup Condition="'$(TargetFramework)'!='net472'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
<PackageReference Include="CsQuery.NetStandard" Version="1.3.6.1" />
</ItemGroup>
Expand Down
Loading
Loading