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

Moved benchmarking project go Github Actions #2129

Merged
merged 78 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
3fdc14e
Added action test
papafe Nov 18, 2020
cf0b181
Added test benchmark
papafe Nov 19, 2020
6ef9ac8
Correction to benchmark
papafe Nov 19, 2020
45780d7
Added necessary to build wrappers
papafe Nov 19, 2020
5a4c35e
Added commitId
papafe Nov 19, 2020
0fe2e0c
Corrected string
papafe Nov 19, 2020
1101bba
Print location
papafe Nov 19, 2020
f364017
Correction
papafe Nov 19, 2020
9b02028
correction
papafe Nov 19, 2020
cca0e1c
Test
papafe Nov 19, 2020
93420dc
Changed order
papafe Nov 19, 2020
cf7599c
Test
papafe Nov 19, 2020
6f228cf
Corrected workspace
papafe Nov 20, 2020
9c89373
Added test
papafe Nov 20, 2020
23b5c39
Correction to test
papafe Nov 20, 2020
71984f1
Try again
papafe Nov 20, 2020
70bc1d6
Added submodule retrieval
papafe Nov 20, 2020
16e9589
Added caching
papafe Nov 20, 2020
4376437
Correction
papafe Nov 20, 2020
639c937
test
papafe Nov 20, 2020
90f5340
Added recursive
papafe Nov 20, 2020
e478e93
Update benchmark-test.yml
papafe Nov 20, 2020
e5edefb
Added several things
papafe Nov 20, 2020
429824f
Update benchmark-test.yml
papafe Nov 20, 2020
2f6dc6c
Update benchmark-test.yml
papafe Nov 20, 2020
aa57f08
Added caching for wrappers
papafe Nov 20, 2020
9c0abb2
Trying to cache things
papafe Nov 20, 2020
f719f66
Removed unnecessary
papafe Nov 20, 2020
1c5ba03
Added benchmark back
papafe Nov 20, 2020
8f659a8
Changed from debug to release
papafe Nov 20, 2020
d95a320
Update benchmark-test.yml
papafe Nov 20, 2020
65d2946
Update benchmark-test.yml
papafe Nov 20, 2020
1e37929
Update benchmark-test.yml
papafe Nov 20, 2020
587aa6b
Update benchmark-test.yml
papafe Nov 20, 2020
e002a1d
Update benchmark-test.yml
papafe Nov 23, 2020
e444fe6
Tried to modularize
papafe Nov 23, 2020
9ad266b
Added missing runtime to dotnet run
papafe Nov 23, 2020
2efe98c
Corrected to 64 bits
papafe Nov 23, 2020
0b49475
Corrected response file
papafe Nov 23, 2020
f3c5f07
Merge branch 'fp/benchmark-github-action-2119' of github.com:realm/re…
papafe Nov 23, 2020
587193a
Update benchmark-test.yml
papafe Nov 23, 2020
bdca867
Update benchmark-test.yml
papafe Nov 23, 2020
5f1be3b
Update benchmark-test.yml
papafe Nov 23, 2020
26136a9
Added automatic creation pages
papafe Nov 23, 2020
802bba2
Final
papafe Nov 23, 2020
e25874a
Added different branch for pages
papafe Nov 23, 2020
0ef6179
Added comments
papafe Nov 23, 2020
2a14072
Improved comments
papafe Nov 23, 2020
7b348ba
Print wrappers
papafe Nov 24, 2020
b4e52cd
Update benchmark-test.yml
papafe Nov 24, 2020
b3f7610
Added space to test hash
papafe Nov 24, 2020
a4c21c9
To test that hash remains the same
papafe Nov 24, 2020
fe1b12e
Added checking of cache
papafe Nov 24, 2020
e4a6168
Revert "Added space to test hash"
papafe Nov 24, 2020
efcb53d
Revert "To test that hash remains the same"
papafe Nov 24, 2020
b4e674b
Several corrections
papafe Nov 24, 2020
b24c3df
Merge branch 'fp/benchmark-github-action-2119' of github.com:realm/re…
papafe Nov 24, 2020
5132e85
Update benchmark-test.yml
papafe Nov 24, 2020
02489b9
Update benchmark-test.yml
papafe Nov 24, 2020
7658303
Update benchmark-test.yml
papafe Nov 24, 2020
b590bf3
Update benchmark-test.yml
papafe Nov 24, 2020
1087e5c
Update benchmark-test.yml
papafe Nov 24, 2020
f44bf51
Final version
papafe Nov 24, 2020
dfff79f
Removed unnecessary exporter
papafe Nov 24, 2020
bfccb0f
Added correction
papafe Nov 25, 2020
df5e24c
Trying to add new tests
papafe Nov 25, 2020
386a0d6
Final correction
papafe Nov 25, 2020
3db45d6
Testing join
papafe Nov 25, 2020
1028d63
corrected syntax
papafe Nov 25, 2020
2f2d314
corrected syntax again
papafe Nov 25, 2020
13a5808
Correction
papafe Nov 25, 2020
11589d2
Correction
papafe Nov 25, 2020
4bbfb69
Correction
papafe Nov 25, 2020
8fc7f27
Final correction
papafe Nov 25, 2020
b25d618
added missing
papafe Nov 25, 2020
e2bf19d
Merge branch 'master' into fp/benchmark-github-action-2119
papafe Dec 3, 2020
25f0272
Updated jenkins file to remove benchmarks
papafe Dec 3, 2020
708a5e1
Update wrappers/build.ps1
papafe Dec 3, 2020
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
84 changes: 84 additions & 0 deletions .github/workflows/benchmark-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: benchmark-windows
on:
# To enable running it manually, possibility of adding parameters. It can be run manually only if this file is in master.
workflow_dispatch:
push:
branches:
- master
env:
# Branch for Github Pages
gh-pages-branch: gh-pages
jobs:
build-wrappers:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Check if cache contains wrappers already
id: wrapper-cache
uses: actions/cache@v2
with:
path: .\wrappers\build\Windows\Release-x64\
key: wrapper-windows-release-64-${{hashfiles('.\wrappers\**')}}
- name: Get CMake
# If there is a cache hit, no need to do any of the following steps. Unfortunately there is no way to cancel the rest of the job.
if: steps.wrapper-cache.outputs.cache-hit != 'true'
uses: lukka/get-cmake@latest
- name: Restore from cache and run vcpkg
if: steps.wrapper-cache.outputs.cache-hit != 'true'
uses: lukka/run-vcpkg@v5
with:
# Contains the list of packages and the triplet. If we need more than one triplet, we can't use the file it seems
vcpkgArguments: '@${{ env.vcpkgResponseFile }}'
vcpkgGitCommitId: ec6fe06e8da05a8157dc8581fa96b36b571c1bd5
# If the cache key is the same, it does not execute
appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }}
env:
vcpkgResponseFile: '${{ github.workspace }}\.github\workflows\response_file.txt'
- name: Build wrappers Release
if: steps.wrapper-cache.outputs.cache-hit != 'true'
run: .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 -Toolchain "${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake"
execute-benchmarks:
needs: [build-wrappers]
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Download previously built wrappers
id: wrapper-cache
uses: actions/cache@v2
with:
path: .\wrappers\build\Windows\Release-x64\
# This needs to be changed to something meaningful
key: wrapper-windows-release-64-${{hashfiles('.\wrappers\**')}}
- name: Check cache hit
# If there is no cache hit, just fail
if: steps.wrapper-cache.outputs.cache-hit != 'true'
run: exit 1
- name: Run benchmarks
run: |
dotnet run -p .\Tests\PerformanceTests\ run -c Release --framework net5.0 -- -f * --join
rename-item -path ".\BenchmarkDotNet.Artifacts\results\*.json" -newname "benchmark-output.json"
- name: Save artifacts
# Not mandatory, but maybe it's good to do it?
uses: actions/upload-artifact@v2
with:
name: benchmark-results
# Could be put in an environmental variable
path: .\BenchmarkDotNet.Artifacts\results
# Download previous benchmark result from cache (if exists)
- name: Store benchmark results
uses: Happypig375/[email protected]
with:
tool: 'benchmarkdotnet'
# Where the output from the benchmark tool is stored
output-file-path: .\BenchmarkDotNet.Artifacts\results\benchmark-output.json
# Workflow will not fail when an alert happens
fail-on-alert: false
gh-pages-branch: ${{env.gh-pages-branch}}
auto-push: true
github-token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .github/workflows/response_file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
zlib
openssl
--triplet
x64-windows-static
17 changes: 1 addition & 16 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -334,21 +334,6 @@ stage('Test') {
reportTests 'TestResults.Weaver.xml'
}
}
},
'Benchmarks': {
rlmNode('dotnet && windows') {
unstash 'dotnet-source'
dir('Realm/packages') { unstash 'packages' }

dir('Tests/PerformanceTests') {
bat """
dotnet build -c ${configuration} -f net5.0 -p:RestoreConfigFile=${env.WORKSPACE}/Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${packageVersion}
dotnet run -c ${configuration} -f net5.0 --no-build -- -f *
""".trim()

archiveArtifacts "BenchmarkDotNet.Artifacts/results/*.md"
}
}
}
]

Expand Down Expand Up @@ -487,4 +472,4 @@ List<List<?>> mapToList(Map map) {
@NonCPS
String getVersion(String name) {
return (name =~ /Realm.Fody.(.+).nupkg/)[0][1]
}
}
31 changes: 1 addition & 30 deletions Tests/PerformanceTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,15 @@
//
////////////////////////////////////////////////////////////////////////////

using System;
using System.Linq;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Exporters.Json;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Order;
using BenchmarkDotNet.Portability.Cpu;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Toolchains.InProcess.Emit;
using Perfolizer.Horology;

namespace PerformanceTests
{
Expand All @@ -50,32 +44,9 @@ public static void Main(string[] args)
.AddDiagnoser(MemoryDiagnoser.Default)
.AddJob(Job.Default.WithToolchain(InProcessEmitToolchain.Instance))
.WithOrderer(new DefaultOrderer(SummaryOrderPolicy.Method, MethodOrderPolicy.Alphabetical))
.AddExporter(new JenkinsHtmlExporter(), MarkdownExporter.GitHub, JsonExporter.Full);
.AddExporter(MarkdownExporter.GitHub, JsonExporter.FullCompressed);

BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config);
}

// This is needed because the Jenkins user does not have permissions to use System.Management.ManagementObjectSearcher.
// There's no public API to prevent BenchmarkDotNet from looking it up, so when building the summary, we get an access
// denied exception. This uses reflection to replace the HostEnvironmentInfo.CpuInfo lazy with one that returns a mock
// CpuInfo. Since this is the first exporter being run, it will modify the summary for the rest, so we don't need to
// fiddle with them. Once we move to Github actions, this can be removed.
private class JenkinsHtmlExporter : HtmlExporter
{
private CpuInfo _mockCpuInfo = new CpuInfo("MockIntel(R) Core(TM) i7-6700HQ CPU 2.60GHz",
physicalProcessorCount: 1,
physicalCoreCount: 4,
logicalCoreCount: 8,
nominalFrequency: Frequency.FromMHz(3100),
maxFrequency: Frequency.FromMHz(3100),
minFrequency: Frequency.FromMHz(3100));

public override void ExportToLog(Summary summary, ILogger logger)
{
var cpuInfoProp = typeof(HostEnvironmentInfo).GetProperty(nameof(HostEnvironmentInfo.CpuInfo));
cpuInfoProp.SetValue(summary.HostEnvironmentInfo, new Lazy<CpuInfo>(() => _mockCpuInfo));
base.ExportToLog(summary, logger);
}
}
}
}
4 changes: 3 additions & 1 deletion wrappers/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ param(
[Parameter(Position=0)]
[string]$Target = 'Windows',

[string]$Toolchain = 'c:\\src\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake',

[Switch]$Incremental
)

Expand All @@ -40,7 +42,7 @@ $vs = Get-VSSetupInstance | Select-VSSetupInstance -Product * -Latest -Require M
$Env:path += ";$($vs.InstallationPath)\MSBuild\Current\Bin"

$cmake = Join-Path $vs.InstallationPath -ChildPath "Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
$cmakeArgs = "-DCMAKE_GENERATOR_INSTANCE=$($vs.InstallationPath)", "-DCMAKE_BUILD_TYPE=$Configuration", "-DCMAKE_SYSTEM_NAME=$Target", "-DCMAKE_INSTALL_PREFIX=$PSScriptRoot\build", "-DCMAKE_TOOLCHAIN_FILE=c:\\src\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
$cmakeArgs = "-DCMAKE_GENERATOR_INSTANCE=$($vs.InstallationPath)", "-DCMAKE_BUILD_TYPE=$Configuration", "-DCMAKE_SYSTEM_NAME=$Target", "-DCMAKE_INSTALL_PREFIX=$PSScriptRoot\build", "-DCMAKE_TOOLCHAIN_FILE=$Toolchain"

if ($Target -eq 'WindowsStore') {
$cmakeArgs += "-DCMAKE_SYSTEM_VERSION='10.0'"
Expand Down