This commit is contained in:
Jerome Laban 2019-10-01 15:02:26 -04:00
Родитель bdf3fba7b9
Коммит 2e159b73c7
14 изменённых файлов: 306 добавлений и 65 удалений

Просмотреть файл

@ -1,8 +1,3 @@
resources:
containers:
- container: nv-bionic-wasm
image: nventive/wasm-build:1.4.1
jobs:
- template: .vsts-linux-build.yml
- template: .vsts-windows-build.yml

Просмотреть файл

@ -1,59 +1,6 @@
parameters:
pool: ''
jobs:
- job: Windows
pool:
vmImage: 'vs2017-win2016'
variables:
NUGET_PACKAGES: $(build.sourcesdirectory)/.nuget
steps:
- checkout: self
clean: true
- task: GitVersion@4
inputs:
updateAssemblyInfo: false
- task: NuGetToolInstaller@0
inputs:
versionSpec: 4.9.1
checkLatest: false
- task: MSBuild@1
inputs:
solution: $(build.sourcesdirectory)/source/SkiaSharp.Views/SkiaSharp.Views.Uno/SkiaSharp.Views.Uno.csproj
msbuildLocationMethod: version
msbuildVersion: latest
msbuildArchitecture: x86
msbuildArguments: /r /p:Configuration=Release /detailedsummary "/p:PackageOutputPath=$(build.artifactstagingdirectory)\nuget" "/p:PackageVersion=$(GITVERSION.FullSemVer)" "/p:InformationalVersion=$(GITVERSION.InformationalVersion)" /detailedsummary
clean: false
maximumCpuCount: true
restoreNugetPackages: false
logProjectEvents: false
createLogFile: false
- task: CopyFiles@2
displayName: 'Publish Nuget Packages'
inputs:
SourceFolder: $(build.sourcesdirectory)/source
Contents: '**/Uno.SkiaSharp.*.nupkg'
TargetFolder: $(build.artifactstagingdirectory)/skiasharp-wasm
CleanTargetFolder: false
OverWrite: false
flattenFolders: false
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: skiasharp-drop
ArtifactType: Container
- job: Linux
container: nv-bionic-wasm
container: nventive/wasm-build:1.4.1
pool:
vmImage: 'ubuntu-16.04'
@ -73,8 +20,16 @@ jobs:
displayName: 'Setup Enscripten'
- bash: |
source /emsdk/emsdk_env.sh
msbuild /r /p:Configuration=Release $(build.sourcesdirectory)/source/SkiaSharpSample/SkiaSharpSample.Wasm/SkiaSharpSample.Wasm.csproj
chmod +x scripts/wasm-uitest-run.sh
scripts/wasm-uitest-run.sh
env:
GIT_TARGETBRANCH: "$(System.PullRequest.TargetBranch)"
GIT_SOURCEBRANCH: "$(Build.SourceBranch)"
BUILD_SOURCESDIRECTORY: "$(build.sourcesdirectory)"
BUILD_ARTIFACTSTAGINGDIRECTORY: "$(build.artifactstagingdirectory)"
displayName: 'Running build'
- task: CopyFiles@2
displayName: 'Publish Wasm Binaries'
@ -85,10 +40,16 @@ jobs:
CleanTargetFolder: false
OverWrite: false
flattenFolders: false
- task: PublishTestResults@2
condition: always()
inputs:
testRunTitle: 'WebAssembly Test Run'
testResultsFormat: 'NUnit'
testResultsFiles: '$(build.sourcesdirectory)/scripts/TestResult.xml'
- task: PublishBuildArtifacts@1
# https://developercommunity.visualstudio.com/content/problem/284991/public-vsts-previouw-cant-set-build-number-of-pr-b.html
condition: eq(variables['System.PullRequest.IsFork'], 'False')
condition: always()
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: skiasharp-aot-drop

54
.vsts-windows-build.yml Normal file
Просмотреть файл

@ -0,0 +1,54 @@
parameters:
pool: ''
jobs:
- job: Windows
pool:
vmImage: 'vs2017-win2016'
variables:
NUGET_PACKAGES: $(build.sourcesdirectory)/.nuget
steps:
- checkout: self
clean: true
- task: GitVersion@4
inputs:
updateAssemblyInfo: false
- task: NuGetToolInstaller@0
inputs:
versionSpec: 4.9.1
checkLatest: false
- task: MSBuild@1
inputs:
solution: $(build.sourcesdirectory)/source/SkiaSharp.Views/SkiaSharp.Views.Uno/SkiaSharp.Views.Uno.csproj
msbuildLocationMethod: version
msbuildVersion: latest
msbuildArchitecture: x86
msbuildArguments: /r /p:Configuration=Release /detailedsummary "/p:PackageOutputPath=$(build.artifactstagingdirectory)\nuget" "/p:PackageVersion=$(GITVERSION.FullSemVer)" "/p:InformationalVersion=$(GITVERSION.InformationalVersion)" /detailedsummary
clean: false
maximumCpuCount: true
restoreNugetPackages: false
logProjectEvents: false
createLogFile: false
- task: CopyFiles@2
displayName: 'Publish Nuget Packages'
inputs:
SourceFolder: $(build.sourcesdirectory)/source
Contents: '**/Uno.SkiaSharp.*.nupkg'
TargetFolder: $(build.artifactstagingdirectory)/skiasharp-wasm
CleanTargetFolder: false
OverWrite: false
flattenFolders: false
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: skiasharp-drop
ArtifactType: Container

Просмотреть файл

@ -59,7 +59,7 @@
</ListView.GroupStyle>
<ListView.ItemTemplate>
<DataTemplate x:DataType="sample:SampleBase">
<TextBlock Text="{x:Bind Title}" />
<TextBlock Text="{x:Bind Title}" Name="{x:Bind Title}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

Просмотреть файл

@ -18,6 +18,7 @@ using SkiaSharp;
using SkiaSharp.Views.UWP;
using Windows.UI.Xaml.Data;
using Uno.Foundation;
using Uno.Extensions;
namespace SkiaSharpSample
{
@ -92,6 +93,9 @@ namespace SkiaSharpSample
#else
listView.ItemsSource = samples;
var tests = samples.Select(s => $"[TestCase(\"{s.Title}\")]").JoinBy("\n");
Console.WriteLine(tests);
commandBar.Visibility = Visibility.Collapsed;
#endif

Двоичные данные
scripts/nuget.exe Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,27 @@
#!/bin/bash
cd $BUILD_SOURCESDIRECTORY
source /emsdk/emsdk_env.sh
msbuild /r /p:Configuration=Release $BUILD_SOURCESDIRECTORY/source/SkiaSharpSample/SkiaSharpSample.Wasm/SkiaSharpSample.Wasm.csproj
msbuild /r /p:Configuration=Release $BUILD_SOURCESDIRECTORY/source/SkiaSharpSample/SkiaSharpSample.UITests/SkiaSharpSample.UITests.csproj
cd $BUILD_SOURCESDIRECTORY/scripts
npm i chromedriver@74.0.0
npm i puppeteer@1.13.0
mono nuget.exe install NUnit.ConsoleRunner -Version 3.10.0
export UNO_UITEST_TARGETURI=http://localhost:8000
export UNO_UITEST_DRIVERPATH_CHROME=$BUILD_SOURCESDIRECTORY/scripts/node_modules/chromedriver/lib/chromedriver
export UNO_UITEST_CHROME_BINARY_PATH=$BUILD_SOURCESDIRECTORY/scripts/node_modules/puppeteer/.local-chromium/linux-637110/chrome-linux/chrome
export UNO_UITEST_SCREENSHOT_PATH=$BUILD_ARTIFACTSTAGINGDIRECTORY/screenshots/wasm
export UNO_UITEST_PLATFORM=Browser
export UNO_UITEST_CHROME_CONTAINER_MODE=true
mkdir -p $UNO_UITEST_SCREENSHOT_PATH
## The python server serves the current working directory, and may be changed by the nunit runner
bash -c "cd $BUILD_SOURCESDIRECTORY/source/SkiaSharpSample/SkiaSharpSample.Wasm/bin/Release/netstandard2.0/dist/; python server.py &"
mono $BUILD_SOURCESDIRECTORY/scripts/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe --trace=Verbose --inprocess --agents=1 --workers=1 $BUILD_SOURCESDIRECTORY/source/SkiaSharpSample/SkiaSharpSample.UITests/bin/Release/net47/SkiaSharpSample.UITests.dll

Просмотреть файл

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Uno.UITest.Helpers.Queries;
namespace SkiaSharpSample.UITests
{
public class Constants
{
public readonly static string WebAssemblyDefaultUri = "http://localhost:50720/";
public readonly static string iOSAppName = "uno.platform.uitestsample";
public readonly static string AndroidAppName = "uno.platform.uitestsample";
public readonly static string iOSDeviceNameOrId = "iPad Pro (12.9-inch) (3rd generation)";
public readonly static Platform CurrentPlatform = Platform.Browser;
}
}

Просмотреть файл

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net47</TargetFramework>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Uno.UITest" Version="1.0.0-dev.80" />
<PackageReference Include="Uno.UITest.Helpers" Version="1.0.0-dev.80" />
<PackageReference Include="Uno.UITest.Selenium" Version="1.0.0-dev.80" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,58 @@
using System;
using NUnit.Framework;
using Uno.UITest;
using Uno.UITest.Selenium;
using Uno.UITests.Helpers;
namespace SkiaSharpSample.UITests
{
public class TestBase
{
private IApp _app;
static TestBase()
{
AppInitializer.TestEnvironment.AndroidAppName = Constants.AndroidAppName;
AppInitializer.TestEnvironment.WebAssemblyDefaultUri = Constants.WebAssemblyDefaultUri;
AppInitializer.TestEnvironment.iOSAppName = Constants.iOSAppName;
AppInitializer.TestEnvironment.AndroidAppName = Constants.AndroidAppName;
AppInitializer.TestEnvironment.iOSDeviceNameOrId = Constants.iOSDeviceNameOrId;
AppInitializer.TestEnvironment.CurrentPlatform = Constants.CurrentPlatform;
#if DEBUG
AppInitializer.TestEnvironment.WebAssemblyHeadless = false;
#endif
// Start the app only once, so the tests runs don't restart it
// and gain some time for the tests.
AppInitializer.ColdStartApp();
}
protected IApp App
{
get => _app;
private set
{
_app = value;
Uno.UITest.Helpers.Queries.Helpers.App = value;
}
}
[SetUp]
public void StartApp()
{
App = AppInitializer.AttachToApp();
}
[TearDown]
public void CloseApp()
{
}
protected void TakeScreenshot(string testName)
{
var f = App.Screenshot(testName);
TestContext.AddTestAttachment(f.FullName);
}
}
}

Просмотреть файл

@ -0,0 +1,51 @@
using System;
using NUnit.Framework;
using Query = System.Func<Uno.UITest.IAppQuery, Uno.UITest.IAppQuery>;
namespace SkiaSharpSample.UITests
{
public class SamplesTest : TestBase
{
[TestCase("Bitmap Decoder")]
[TestCase("Bitmap Lattice (9-patch)")]
[TestCase("Bitmap Shader")]
[TestCase("Blur Image Filter")]
[TestCase("Blur Mask Filter")]
[TestCase("Chained Image Filter")]
[TestCase("Color Matrix Color Filter")]
[TestCase("Color Table Color Filter")]
[TestCase("Compose Shader")]
[TestCase("Dilate Image Filter")]
[TestCase("Draw Matrix")]
[TestCase("Erode Image Filter")]
[TestCase("Filled Heptagram")]
[TestCase("Fractal Perlin Noise Shader")]
[TestCase("Gradient")]
[TestCase("Luma Color Filter")]
[TestCase("Magnifier Image Filter")]
[TestCase("Bitmap Shader (Manipulated)")]
[TestCase("Measure Text")]
[TestCase("Path Bounds")]
[TestCase("Path (conic to quads)")]
[TestCase("2D Path Effect")]
[TestCase("Path Effects")]
[TestCase("Path Measure")]
[TestCase("Sweep Gradient Shader")]
[TestCase("Text")]
[TestCase("3D Rotation (ortho)")]
[TestCase("3D Rotation (perspective)")]
[TestCase("Turbulence Perlin Noise Shader")]
[TestCase("\"Xamagon\"")]
[TestCase("Blend Mode Color Filter")]
[TestCase("Blend Mode")]
public void SkiaSample(string testName)
{
Query testSelector = q => q.Marked(testName);
App.WaitForElement(testSelector);
App.Tap(testSelector);
TakeScreenshot(testName.Replace("\"", "_"));
}
}
}

Просмотреть файл

@ -19,6 +19,8 @@ namespace SkiaSharpSample.Wasm
static int Main(string[] args)
{
Uno.UI.FeatureConfiguration.UIElement.AssignDOMXamlName = true;
WebAssemblyRuntime.InvokeJS("Uno.UI.Demo.Analytics.reportPageView('main');");
ConfigureFilters(LogExtensionPoint.AmbientLoggerFactory);

Просмотреть файл

@ -12,6 +12,7 @@
<TypeScriptToolsVersion>3.3</TypeScriptToolsVersion>
<CompileTypeScriptDependsOn>_UnoSourceGenerator; $(CompileTypeScriptDependsOn)</CompileTypeScriptDependsOn>
<MonoWasmRuntimeConfiguration>release-dynamic</MonoWasmRuntimeConfiguration>
<IsUiAutomationMappingEnabled>true</IsUiAutomationMappingEnabled>
</PropertyGroup>
<ItemGroup>
<Content Include="..\SkiaSharpSample.UWP\Assets\*.png" Link="Assets\%(FileName)%(Extension)" />

Просмотреть файл

@ -111,6 +111,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PlatformShared", "..\sample
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Wasm", "..\binding\SkiaSharp.Wasm\SkiaSharp.Wasm.csproj", "{8DB9D82C-27F0-4978-8E66-2C0009D5940D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharpSample.UITests", "SkiaSharpSample\SkiaSharpSample.UITests\SkiaSharpSample.UITests.csproj", "{78314072-801F-49E7-BE3B-9613ED286945}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\samples\Gallery\PlatformShared\PlatformShared.projitems*{0cc41ab0-0c4c-4daa-8f10-a249725ebf5d}*SharedItemsImports = 13
@ -2303,6 +2305,54 @@ Global
{8DB9D82C-27F0-4978-8E66-2C0009D5940D}.Release|x64.Build.0 = Release|Any CPU
{8DB9D82C-27F0-4978-8E66-2C0009D5940D}.Release|x86.ActiveCfg = Release|Any CPU
{8DB9D82C-27F0-4978-8E66-2C0009D5940D}.Release|x86.Build.0 = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|ARM.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|iPhone.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|x64.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|x64.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|x86.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.AppStore|x86.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|ARM.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|ARM.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|iPhone.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|x64.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|x64.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|x86.ActiveCfg = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Debug|x86.Build.0 = Debug|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|Any CPU.Build.0 = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|ARM.ActiveCfg = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|ARM.Build.0 = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|iPhone.ActiveCfg = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|iPhone.Build.0 = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|x64.ActiveCfg = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|x64.Build.0 = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|x86.ActiveCfg = Release|Any CPU
{78314072-801F-49E7-BE3B-9613ED286945}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -2355,6 +2405,7 @@ Global
{509B233A-35A0-41CA-A585-0B1A9F79D470} = {63924C1B-F8FB-4637-AC84-27280C301029}
{0CC41AB0-0C4C-4DAA-8F10-A249725EBF5D} = {63924C1B-F8FB-4637-AC84-27280C301029}
{8DB9D82C-27F0-4978-8E66-2C0009D5940D} = {C335869B-7CC8-4239-B4A5-8031AA9758D3}
{78314072-801F-49E7-BE3B-9613ED286945} = {63924C1B-F8FB-4637-AC84-27280C301029}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {67EACD19-0CEA-4127-9842-549AA6FB84C9}