зеркало из https://github.com/mono/SkiaSharp.git
Added a Groovy script for CI (#615)
* Improved the native task dependencies and some whitespace * Fixed the CI / NuGet-only / combined build * Created a groovy script to build the entire repository in a job
This commit is contained in:
Родитель
4451420e56
Коммит
f77c073e01
66
build.cake
66
build.cake
|
@ -29,6 +29,7 @@ using NuGet.Versioning;
|
|||
var TARGET = Argument ("t", Argument ("target", Argument ("Target", "Default")));
|
||||
var VERBOSITY = (Verbosity) Enum.Parse (typeof(Verbosity), Argument ("v", Argument ("verbosity", Argument ("Verbosity", "Normal"))), true);
|
||||
var SKIP_EXTERNALS = Argument ("skipexternals", Argument ("SkipExternals", "")).ToLower ().Split (',');
|
||||
var PACK_ALL_PLATFORMS = Argument ("packall", Argument ("PackAll", Argument ("PackAllPlatforms", TARGET.ToLower() == "ci" || TARGET.ToLower() == "nuget-only")));
|
||||
|
||||
var NuGetSources = new [] { MakeAbsolute (Directory ("./output/nugets")).FullPath, "https://api.nuget.org/v3/index.json" };
|
||||
var NuGetToolPath = Context.Tools.Resolve ("nuget.exe");
|
||||
|
@ -37,10 +38,6 @@ var MDocPath = Context.Tools.Resolve ("mdoc.exe");
|
|||
var MSBuildToolPath = GetMSBuildToolPath (EnvironmentVariable ("MSBUILD_EXE"));
|
||||
var PythonToolPath = EnvironmentVariable ("PYTHON_EXE") ?? "python";
|
||||
|
||||
var CI_TARGETS = new string[] { "CI", "WINDOWS-CI", "LINUX-CI", "MAC-CI" };
|
||||
var IS_ON_CI = CI_TARGETS.Contains (TARGET.ToUpper ());
|
||||
var IS_ON_FINAL_CI = TARGET.ToUpper () == "CI";
|
||||
|
||||
DirectoryPath ANDROID_SDK_ROOT = EnvironmentVariable ("ANDROID_SDK_ROOT") ?? EnvironmentVariable ("ANDROID_HOME") ?? EnvironmentVariable ("HOME") + "/Library/Developer/Xamarin/android-sdk-macosx";
|
||||
DirectoryPath ANDROID_NDK_HOME = EnvironmentVariable ("ANDROID_NDK_HOME") ?? EnvironmentVariable ("ANDROID_NDK_ROOT") ?? EnvironmentVariable ("HOME") + "/Library/Developer/Xamarin/android-ndk";
|
||||
DirectoryPath TIZEN_STUDIO_HOME = EnvironmentVariable ("TIZEN_STUDIO_HOME") ?? EnvironmentVariable ("HOME") + "/tizen-studio";
|
||||
|
@ -56,14 +53,14 @@ DirectoryPath PACKAGE_CACHE_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/pac
|
|||
DirectoryPath PROFILE_PATH = EnvironmentVariable ("USERPROFILE") ?? EnvironmentVariable ("HOME");
|
||||
DirectoryPath NUGET_PACKAGES = EnvironmentVariable ("NUGET_PACKAGES") ?? PROFILE_PATH.Combine (".nuget/packages");
|
||||
|
||||
var GIT_SHA = EnvironmentVariable ("GIT_COMMIT") ?? string.Empty;
|
||||
var GIT_SHA = EnvironmentVariable ("GIT_COMMIT") ?? "";
|
||||
if (!string.IsNullOrEmpty (GIT_SHA) && GIT_SHA.Length >= 6) {
|
||||
GIT_SHA = GIT_SHA.Substring (0, 6);
|
||||
} else {
|
||||
GIT_SHA = "{GIT_SHA}";
|
||||
}
|
||||
|
||||
var BUILD_NUMBER = EnvironmentVariable ("BUILD_NUMBER") ?? string.Empty;
|
||||
var BUILD_NUMBER = EnvironmentVariable ("BUILD_NUMBER") ?? "";
|
||||
if (string.IsNullOrEmpty (BUILD_NUMBER)) {
|
||||
BUILD_NUMBER = "0";
|
||||
}
|
||||
|
@ -86,10 +83,7 @@ var TRACKED_NUGETS = new Dictionary<string, Version> {
|
|||
|
||||
// this builds all the externals
|
||||
Task ("externals")
|
||||
.IsDependentOn ("externals-native")
|
||||
.Does (() =>
|
||||
{
|
||||
});
|
||||
.IsDependentOn ("externals-native");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// LIBS - the managed C# libraries
|
||||
|
@ -97,7 +91,7 @@ Task ("externals")
|
|||
|
||||
Task ("libs")
|
||||
.IsDependentOn ("externals")
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
// build the managed libraries
|
||||
var platform = "";
|
||||
|
@ -126,7 +120,7 @@ Task ("libs")
|
|||
Task ("tests")
|
||||
.IsDependentOn ("libs")
|
||||
.IsDependentOn ("nuget")
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
var RunDesktopTest = new Action<string> (arch => {
|
||||
var platform = "";
|
||||
|
@ -195,7 +189,7 @@ Task ("tests")
|
|||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task ("samples")
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
// create the samples archive
|
||||
CreateSamplesZip ("./samples/", "./output/");
|
||||
|
@ -291,10 +285,16 @@ Task ("samples")
|
|||
|
||||
Task ("nuget")
|
||||
.IsDependentOn ("libs")
|
||||
.Does (() =>
|
||||
.IsDependentOn ("nuget-only")
|
||||
.Does (() =>
|
||||
{
|
||||
});
|
||||
|
||||
Task ("nuget-only")
|
||||
.Does (() =>
|
||||
{
|
||||
var platform = "";
|
||||
if (!IS_ON_FINAL_CI) {
|
||||
if (!PACK_ALL_PLATFORMS) {
|
||||
if (IsRunningOnWindows ()) {
|
||||
platform = "windows";
|
||||
} else if (IsRunningOnMac ()) {
|
||||
|
@ -398,11 +398,9 @@ Task ("nuget")
|
|||
|
||||
Task ("clean")
|
||||
.IsDependentOn ("clean-externals")
|
||||
.IsDependentOn ("clean-managed")
|
||||
.Does (() =>
|
||||
{
|
||||
});
|
||||
Task ("clean-managed").Does (() =>
|
||||
.IsDependentOn ("clean-managed");
|
||||
Task ("clean-managed")
|
||||
.Does (() =>
|
||||
{
|
||||
CleanDirectories ("./binding/*/bin");
|
||||
CleanDirectories ("./binding/*/obj");
|
||||
|
@ -449,6 +447,8 @@ Task ("Everything")
|
|||
.IsDependentOn ("tests")
|
||||
.IsDependentOn ("samples");
|
||||
|
||||
Task ("Nothing");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CI - the master target to build everything
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -474,19 +474,31 @@ Task ("Linux-CI")
|
|||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Information ("");
|
||||
|
||||
Information ("Tool Paths:");
|
||||
Information (" Cake.exe: {0}", CakeToolPath);
|
||||
Information (" nuget.exe: {0}", NuGetToolPath);
|
||||
Information (" mdoc: {0}", MDocPath);
|
||||
Information (" msbuild: {0}", MSBuildToolPath);
|
||||
Information (" nuget.exe: {0}", NuGetToolPath);
|
||||
Information (" python: {0}", PythonToolPath);
|
||||
Information ("");
|
||||
|
||||
Information ("Build Environment:");
|
||||
if (IS_ON_CI) {
|
||||
Information (" Detected that we are building on CI, {0}.", IS_ON_FINAL_CI ? "and on FINAL CI" : "but NOT on final CI");
|
||||
} else {
|
||||
Information (" Detected that we are {0} on CI.", "NOT");
|
||||
}
|
||||
Information ("Build Paths:");
|
||||
Information (" ~: {0}", PROFILE_PATH);
|
||||
Information (" NuGet Cache: {0}", NUGET_PACKAGES);
|
||||
Information (" root: {0}", ROOT_PATH);
|
||||
Information (" docs: {0}", DOCS_PATH);
|
||||
Information (" package_cache: {0}", PACKAGE_CACHE_PATH);
|
||||
Information (" ANGLE: {0}", ANGLE_PATH);
|
||||
Information (" depot_tools: {0}", DEPOT_PATH);
|
||||
Information (" harfbuzz: {0}", HARFBUZZ_PATH);
|
||||
Information (" skia: {0}", SKIA_PATH);
|
||||
Information ("");
|
||||
|
||||
Information ("SDK Paths:");
|
||||
Information (" Android SDK: {0}", ANDROID_SDK_ROOT);
|
||||
Information (" Android NDK: {0}", ANDROID_NDK_HOME);
|
||||
Information (" Tizen Studio: {0}", TIZEN_STUDIO_HOME);
|
||||
Information ("");
|
||||
|
||||
Information ("Environment Variables:");
|
||||
|
|
|
@ -59,7 +59,7 @@ void RunLipo (DirectoryPath directory, FilePath output, FilePath[] inputs)
|
|||
Task ("externals-init")
|
||||
.IsDependentOn ("externals-angle-uwp")
|
||||
.IsDependentOn ("externals-harfbuzz")
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
RunProcess (PythonToolPath, new ProcessSettings {
|
||||
Arguments = SKIA_PATH.CombineWithFilePath ("tools/git-sync-deps").FullPath,
|
||||
|
@ -68,26 +68,16 @@ Task ("externals-init")
|
|||
});
|
||||
|
||||
// this builds the native C and C++ externals
|
||||
Task ("externals-native")
|
||||
.IsDependentOn ("externals-uwp")
|
||||
.IsDependentOn ("externals-windows")
|
||||
.IsDependentOn ("externals-osx")
|
||||
.IsDependentOn ("externals-ios")
|
||||
.IsDependentOn ("externals-tvos")
|
||||
.IsDependentOn ("externals-watchos")
|
||||
.IsDependentOn ("externals-android")
|
||||
.IsDependentOn ("externals-linux")
|
||||
.IsDependentOn ("externals-tizen")
|
||||
.Does (() =>
|
||||
{
|
||||
});
|
||||
Task ("externals-native");
|
||||
Task ("externals-native-skip");
|
||||
|
||||
// this builds the native C and C++ externals for Windows
|
||||
Task ("externals-windows")
|
||||
.IsDependentOn ("externals-init")
|
||||
.WithCriteria (!SKIP_EXTERNALS.Contains ("windows"))
|
||||
.IsDependeeOf (ShouldBuildExternal ("windows") ? "externals-native" : "externals-native-skip")
|
||||
.WithCriteria (ShouldBuildExternal ("windows"))
|
||||
.WithCriteria (IsRunningOnWindows ())
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
// libSkiaSharp
|
||||
|
||||
|
@ -131,9 +121,10 @@ Task ("externals-windows")
|
|||
// this builds the native C and C++ externals for Windows UWP
|
||||
Task ("externals-uwp")
|
||||
.IsDependentOn ("externals-init")
|
||||
.WithCriteria (!SKIP_EXTERNALS.Contains ("uwp"))
|
||||
.IsDependeeOf (ShouldBuildExternal ("uwp") ? "externals-native" : "externals-native-skip")
|
||||
.WithCriteria (ShouldBuildExternal ("uwp"))
|
||||
.WithCriteria (IsRunningOnWindows ())
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
// libSkiaSharp
|
||||
|
||||
|
@ -190,11 +181,14 @@ Task ("externals-uwp")
|
|||
});
|
||||
|
||||
// this builds the native C and C++ externals for Mac OS X
|
||||
Task ("externals-macos")
|
||||
.IsDependentOn ("externals-osx");
|
||||
Task ("externals-osx")
|
||||
.IsDependentOn ("externals-init")
|
||||
.WithCriteria (!SKIP_EXTERNALS.Contains ("osx"))
|
||||
.IsDependeeOf (ShouldBuildExternal ("osx") ? "externals-native" : "externals-native-skip")
|
||||
.WithCriteria (ShouldBuildExternal ("osx"))
|
||||
.WithCriteria (IsRunningOnMac ())
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
// SkiaSharp
|
||||
|
||||
|
@ -265,9 +259,10 @@ Task ("externals-osx")
|
|||
// this builds the native C and C++ externals for iOS
|
||||
Task ("externals-ios")
|
||||
.IsDependentOn ("externals-init")
|
||||
.WithCriteria (!SKIP_EXTERNALS.Contains ("ios"))
|
||||
.IsDependeeOf (ShouldBuildExternal ("ios") ? "externals-native" : "externals-native-skip")
|
||||
.WithCriteria (ShouldBuildExternal ("ios"))
|
||||
.WithCriteria (IsRunningOnMac ())
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
// SkiaSharp
|
||||
|
||||
|
@ -362,9 +357,10 @@ Task ("externals-ios")
|
|||
// this builds the native C and C++ externals for tvOS
|
||||
Task ("externals-tvos")
|
||||
.IsDependentOn ("externals-init")
|
||||
.WithCriteria (!SKIP_EXTERNALS.Contains ("tvos"))
|
||||
.IsDependeeOf (ShouldBuildExternal ("tvos") ? "externals-native" : "externals-native-skip")
|
||||
.WithCriteria (ShouldBuildExternal ("tvos"))
|
||||
.WithCriteria (IsRunningOnMac ())
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
// SkiaSharp
|
||||
|
||||
|
@ -437,9 +433,10 @@ Task ("externals-tvos")
|
|||
// this builds the native C and C++ externals for watchOS
|
||||
Task ("externals-watchos")
|
||||
.IsDependentOn ("externals-init")
|
||||
.WithCriteria (!SKIP_EXTERNALS.Contains ("watchos"))
|
||||
.IsDependeeOf (ShouldBuildExternal ("watchos") ? "externals-native" : "externals-native-skip")
|
||||
.WithCriteria (ShouldBuildExternal ("watchos"))
|
||||
.WithCriteria (IsRunningOnMac ())
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
// SkiaSharp
|
||||
|
||||
|
@ -520,9 +517,10 @@ Task ("externals-watchos")
|
|||
// this builds the native C and C++ externals for Android
|
||||
Task ("externals-android")
|
||||
.IsDependentOn ("externals-init")
|
||||
.WithCriteria (!SKIP_EXTERNALS.Contains ("android"))
|
||||
.IsDependeeOf (ShouldBuildExternal ("android") ? "externals-native" : "externals-native-skip")
|
||||
.WithCriteria (ShouldBuildExternal ("android"))
|
||||
.WithCriteria (IsRunningOnMac () || IsRunningOnWindows ())
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
var cmd = IsRunningOnWindows () ? ".cmd" : "";
|
||||
var ndkbuild = ANDROID_NDK_HOME.CombineWithFilePath ($"ndk-build{cmd}").FullPath;
|
||||
|
@ -568,9 +566,10 @@ Task ("externals-android")
|
|||
// this builds the native C and C++ externals for Linux
|
||||
Task ("externals-linux")
|
||||
.IsDependentOn ("externals-init")
|
||||
.WithCriteria (!SKIP_EXTERNALS.Contains ("linux"))
|
||||
.IsDependeeOf (ShouldBuildExternal ("linux") ? "externals-native" : "externals-native-skip")
|
||||
.WithCriteria (ShouldBuildExternal ("linux"))
|
||||
.WithCriteria (IsRunningOnLinux ())
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
var arches = EnvironmentVariable ("BUILD_ARCH") ?? (Environment.Is64BitOperatingSystem ? "x64" : "x86"); // x64, x86, ARM
|
||||
var BUILD_ARCH = arches.Split (',').Select (a => a.Trim ()).ToArray ();
|
||||
|
@ -636,7 +635,8 @@ Task ("externals-linux")
|
|||
|
||||
Task ("externals-tizen")
|
||||
.IsDependentOn ("externals-init")
|
||||
.WithCriteria (!SKIP_EXTERNALS.Contains ("tizen"))
|
||||
.IsDependeeOf (ShouldBuildExternal ("tizen") ? "externals-native" : "externals-native-skip")
|
||||
.WithCriteria (ShouldBuildExternal ("tizen"))
|
||||
.Does (() =>
|
||||
{
|
||||
var bat = IsRunningOnWindows () ? ".bat" : "";
|
||||
|
@ -699,7 +699,7 @@ Task ("externals-tizen")
|
|||
|
||||
Task ("externals-angle-uwp")
|
||||
.WithCriteria (!FileExists (ANGLE_PATH.CombineWithFilePath ("uwp/ANGLE.WindowsStore.nuspec")))
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
var version = GetVersion ("ANGLE.WindowsStore", "release");
|
||||
var angleUrl = $"https://www.nuget.org/api/v2/package/ANGLE.WindowsStore/{version}";
|
||||
|
@ -717,7 +717,7 @@ Task ("externals-harfbuzz")
|
|||
.WithCriteria (
|
||||
!FileExists (HARFBUZZ_PATH.CombineWithFilePath ("harfbuzz/README")) ||
|
||||
!FileExists (HARFBUZZ_PATH.CombineWithFilePath ($"harfbuzz-{GetVersion ("harfbuzz", "release")}.tar.bz2")))
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
var version = GetVersion ("harfbuzz", "release");
|
||||
var url = $"https://github.com/behdad/harfbuzz/releases/download/{version}/harfbuzz-{version}.tar.bz2";
|
||||
|
|
|
@ -29,7 +29,7 @@ void CopyChangelogs (DirectoryPath diffRoot, string id, string version)
|
|||
}
|
||||
|
||||
Task ("docs-api-diff")
|
||||
.Does (async () =>
|
||||
.Does (async () =>
|
||||
{
|
||||
var baseDir = "./output/api-diff";
|
||||
CleanDirectories (baseDir);
|
||||
|
@ -65,7 +65,7 @@ Task ("docs-api-diff")
|
|||
});
|
||||
|
||||
Task ("docs-api-diff-past")
|
||||
.Does (async () =>
|
||||
.Does (async () =>
|
||||
{
|
||||
var baseDir = "./output/api-diffs-past";
|
||||
CleanDirectories (baseDir);
|
||||
|
@ -108,7 +108,7 @@ Task ("docs-api-diff-past")
|
|||
});
|
||||
|
||||
Task ("docs-update-frameworks")
|
||||
.Does (async () =>
|
||||
.Does (async () =>
|
||||
{
|
||||
// clear the temp dir
|
||||
var docsTempPath = "./output/docs/temp";
|
||||
|
@ -177,7 +177,7 @@ Task ("docs-update-frameworks")
|
|||
});
|
||||
|
||||
Task ("docs-format-docs")
|
||||
.Does (() =>
|
||||
.Does (() =>
|
||||
{
|
||||
// process the generated docs
|
||||
var docFiles = GetFiles ("./docs/**/*.xml");
|
||||
|
@ -273,7 +273,5 @@ Task ("update-docs")
|
|||
.IsDependentOn ("docs-api-diff")
|
||||
.IsDependentOn ("docs-api-diff-past")
|
||||
.IsDependentOn ("docs-update-frameworks")
|
||||
.IsDependentOn ("docs-format-docs")
|
||||
.Does (() =>
|
||||
{
|
||||
});
|
||||
.IsDependentOn ("docs-format-docs");
|
||||
|
|
@ -60,3 +60,26 @@ string GetVersion (string lib, string type = "nuget")
|
|||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
bool ShouldBuildExternal (string platform)
|
||||
{
|
||||
platform = platform?.ToLower() ?? "";
|
||||
|
||||
if (SKIP_EXTERNALS.Contains ("all"))
|
||||
return false;
|
||||
|
||||
switch (platform) {
|
||||
case "mac":
|
||||
case "macos":
|
||||
platform = "osx";
|
||||
break;
|
||||
case "win":
|
||||
platform = "windows";
|
||||
break;
|
||||
}
|
||||
|
||||
if (SKIP_EXTERNALS.Contains (platform))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
|
@ -106,7 +106,7 @@ var RunTests = new Action<FilePath, string[], bool> ((testAssembly, skip, is32)
|
|||
var RunNetCoreTests = new Action<FilePath, string[]> ((testAssembly, skip) =>
|
||||
{
|
||||
var dir = testAssembly.GetDirectory ();
|
||||
string skipString = string.Empty;
|
||||
string skipString = "";
|
||||
if (skip != null) {
|
||||
foreach (var s in skip) {
|
||||
skipString += $" -notrait \"Category={skip}\"";
|
||||
|
@ -138,6 +138,7 @@ var CreateSamplesZip = new Action<DirectoryPath, DirectoryPath> ((samplesDirPath
|
|||
".gtk",
|
||||
".ios",
|
||||
".mac",
|
||||
".macos",
|
||||
".netstandard",
|
||||
".osx",
|
||||
".portable",
|
||||
|
|
|
@ -0,0 +1,319 @@
|
|||
import groovy.transform.Field
|
||||
|
||||
@Field def commitHash = null
|
||||
@Field def linuxPackages = "xvfb xauth libfontconfig1-dev libglu1-mesa-dev g++ mono-complete msbuild curl ca-certificates-mono unzip python git referenceassemblies-pcl dotnet-sdk-2.0.0 ttf-ancient-fonts openjdk-8-jdk zip gettext openvpn acl libxcb-render-util0 libv4l-0 libsdl1.2debian libxcb-image0 bridge-utils rpm2cpio libxcb-icccm4 libwebkitgtk-1.0-0 cpio"
|
||||
|
||||
@Field def customEnv = [
|
||||
"windows": [
|
||||
"TIZEN_STUDIO_HOME=C:\\Tizen",
|
||||
"ANDROID_NDK_ROOT=C:\\ProgramData\\Microsoft\\AndroidNDK64\\android-ndk-r14b"
|
||||
],
|
||||
"macos": [
|
||||
"ANDROID_NDK_HOME=/Users/builder/Library/Developer/Xamarin/android-ndk",
|
||||
],
|
||||
"linux": [
|
||||
]
|
||||
]
|
||||
|
||||
properties([
|
||||
compressBuildLog()
|
||||
])
|
||||
|
||||
// ============================================================================
|
||||
// Stages
|
||||
|
||||
node("ubuntu-1604-amd64") {
|
||||
stage("Prepare") {
|
||||
timestamps {
|
||||
checkout scm
|
||||
commitHash = cmdResult("git rev-parse HEAD").trim()
|
||||
}
|
||||
}
|
||||
|
||||
stage("Native Builds") {
|
||||
parallel([
|
||||
// windows
|
||||
win32: createNativeBuilder("Win32", "Windows", "components-windows"),
|
||||
uwp: createNativeBuilder("UWP", "Windows", "components-windows"),
|
||||
android_windows: createNativeBuilder("Android", "Windows", "components-windows"),
|
||||
tizen_windows: createNativeBuilder("Tizen", "Windows", "components-windows"),
|
||||
|
||||
// macos
|
||||
macos: createNativeBuilder("macOS", "macOS", "components"),
|
||||
ios: createNativeBuilder("iOS", "macOS", "components"),
|
||||
tvos: createNativeBuilder("tvOS", "macOS", "components"),
|
||||
watchos: createNativeBuilder("watchOS", "macOS", "components"),
|
||||
android_macos: createNativeBuilder("Android", "macOS", "components"),
|
||||
tizen_macos: createNativeBuilder("Tizen", "macOS", "components"),
|
||||
|
||||
// linux
|
||||
linux: createNativeBuilder("Linux", "Linux", "ubuntu-1604-amd64"),
|
||||
tizen_linux: createNativeBuilder("Tizen", "Linux", "ubuntu-1604-amd64"),
|
||||
])
|
||||
}
|
||||
|
||||
stage("Managed Builds") {
|
||||
parallel([
|
||||
windows: createManagedBuilder("Windows", "components-windows"),
|
||||
macos: createManagedBuilder("macOS", "components"),
|
||||
linux: createManagedBuilder("Linux", "ubuntu-1604-amd64"),
|
||||
])
|
||||
}
|
||||
|
||||
stage("Packaging") {
|
||||
parallel([
|
||||
package: createPackagingBuilder()
|
||||
])
|
||||
}
|
||||
|
||||
stage("Clean Up") {
|
||||
timestamps {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
|
||||
def createNativeBuilder(platform, host, label) {
|
||||
def githubContext = "Build Native - ${platform} on ${host}"
|
||||
platform = platform.toLowerCase();
|
||||
host = host.toLowerCase();
|
||||
|
||||
reportGitHubStatus(commitHash, githubContext, env.BUILD_URL, "PENDING", "Building...")
|
||||
|
||||
return {
|
||||
stage(githubContext) {
|
||||
node(label) {
|
||||
timestamps {
|
||||
withEnv(customEnv[host] + ["NODE_LABEL=${label}"]) {
|
||||
ws("${getWSRoot()}/native-${platform}") {
|
||||
try {
|
||||
|
||||
checkout scm
|
||||
cmd("git submodule update --init --recursive")
|
||||
|
||||
def pre = ""
|
||||
if (host == "linux" && platform == "tizen") {
|
||||
pre = "./scripts/install-tizen.sh && "
|
||||
}
|
||||
bootstrapper("-t externals-${platform} -v normal", host, pre)
|
||||
|
||||
uploadBlobs("native-${platform}_${host}")
|
||||
|
||||
reportGitHubStatus(commitHash, githubContext, env.BUILD_URL, "SUCCESS", "Build complete.")
|
||||
} catch (Exception e) {
|
||||
reportGitHubStatus(commitHash, githubContext, env.BUILD_URL, "FAILURE", "Build failed.")
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def createManagedBuilder(host, label) {
|
||||
def githubContext = "Build Managed - ${host}"
|
||||
host = host.toLowerCase();
|
||||
|
||||
reportGitHubStatus(commitHash, githubContext, env.BUILD_URL, "PENDING", "Building...")
|
||||
|
||||
return {
|
||||
stage(githubContext) {
|
||||
node(label) {
|
||||
timestamps {
|
||||
withEnv(customEnv[host] + ["NODE_LABEL=${label}"]) {
|
||||
ws("${getWSRoot()}/managed-${host}") {
|
||||
try {
|
||||
checkout scm
|
||||
downloadBlobs("native-*")
|
||||
|
||||
bootstrapper("-t everything -v normal --skipexternals=all", host, "")
|
||||
|
||||
step([
|
||||
$class: "XUnitBuilder",
|
||||
testTimeMargin: "3000",
|
||||
thresholdMode: 1,
|
||||
thresholds: [[
|
||||
$class: "FailedThreshold",
|
||||
failureNewThreshold: "0",
|
||||
failureThreshold: "0",
|
||||
unstableNewThreshold: "0",
|
||||
unstableThreshold: "0"
|
||||
], [
|
||||
$class: "SkippedThreshold",
|
||||
failureNewThreshold: "",
|
||||
failureThreshold: "",
|
||||
unstableNewThreshold: "",
|
||||
unstableThreshold: ""
|
||||
]],
|
||||
tools: [[
|
||||
$class: "NUnitJunitHudsonTestType",
|
||||
deleteOutputFiles: true,
|
||||
failIfNotNew: true,
|
||||
pattern: "output/tests/*/TestResult.xml",
|
||||
skipNoTestFiles: false,
|
||||
stopProcessingIfError: true
|
||||
]]
|
||||
])
|
||||
|
||||
uploadBlobs("managed-${host}")
|
||||
|
||||
reportGitHubStatus(commitHash, githubContext, env.BUILD_URL, "SUCCESS", "Build complete.")
|
||||
} catch (Exception e) {
|
||||
reportGitHubStatus(commitHash, githubContext, env.BUILD_URL, "FAILURE", "Build failed.")
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def createPackagingBuilder() {
|
||||
def githubContext = "Packing"
|
||||
def host = "linux"
|
||||
def label = "ubuntu-1604-amd64"
|
||||
|
||||
reportGitHubStatus(commitHash, githubContext, env.BUILD_URL, "PENDING", "Packing...")
|
||||
|
||||
return {
|
||||
stage(githubContext) {
|
||||
node(label) {
|
||||
timestamps{
|
||||
withEnv(customEnv[host] + ["NODE_LABEL=${label}"]) {
|
||||
ws("${getWSRoot()}/packing-${host}") {
|
||||
try {
|
||||
checkout scm
|
||||
downloadBlobs("managed-*");
|
||||
|
||||
bootstrapper("-t nuget-only -v normal", host, "")
|
||||
|
||||
uploadBlobs("packing-${host}")
|
||||
|
||||
reportGitHubStatus(commitHash, githubContext, env.BUILD_URL, "SUCCESS", "Pack complete.")
|
||||
} catch (Exception e) {
|
||||
reportGitHubStatus(commitHash, githubContext, env.BUILD_URL, "FAILURE", "Pack failed.")
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def bootstrapper(args, host, pre) {
|
||||
host = host.toLowerCase()
|
||||
if (host == "linux") {
|
||||
chroot(
|
||||
chrootName: "${env.NODE_LABEL}-stable",
|
||||
command: "bash ${pre} ./bootstrapper.sh ${args}",
|
||||
additionalPackages: "${linuxPackages}")
|
||||
} else if (host == "macos") {
|
||||
sh("bash ${pre} ./bootstrapper.sh ${args}")
|
||||
} else if (host == "windows") {
|
||||
powershell("${pre} .\\bootstrapper.ps1 ${args}")
|
||||
} else {
|
||||
throw new Exception("Unknown host platform: ${host}")
|
||||
}
|
||||
}
|
||||
|
||||
def uploadBlobs(blobs) {
|
||||
fingerprint("output/**/*")
|
||||
step([
|
||||
$class: "WAStoragePublisher",
|
||||
allowAnonymousAccess: true,
|
||||
cleanUpContainer: false,
|
||||
cntPubAccess: true,
|
||||
containerName: "skiasharp-public-artifacts",
|
||||
doNotFailIfArchivingReturnsNothing: false,
|
||||
doNotUploadIndividualFiles: false,
|
||||
doNotWaitForPreviousBuild: true,
|
||||
excludeFilesPath: "",
|
||||
filesPath: "output/**/*",
|
||||
storageAccName: "credential for xamjenkinsartifact",
|
||||
storageCredentialId: "fbd29020e8166fbede5518e038544343",
|
||||
uploadArtifactsOnlyIfSuccessful: false,
|
||||
uploadZips: false,
|
||||
virtualPath: "ArtifactsFor-${env.BUILD_NUMBER}/${commitHash}/${blobs}/",
|
||||
])
|
||||
}
|
||||
|
||||
def downloadBlobs(blobs) {
|
||||
step([
|
||||
$class: "AzureStorageBuilder",
|
||||
downloadType: [
|
||||
value: "container",
|
||||
containerName: "skiasharp-public-artifacts",
|
||||
],
|
||||
includeFilesPattern: "ArtifactsFor-${env.BUILD_NUMBER}/${commitHash}/${blobs}/**/*",
|
||||
excludeFilesPattern: "",
|
||||
downloadDirLoc: "",
|
||||
flattenDirectories: false,
|
||||
includeArchiveZips: false,
|
||||
strAccName: "credential for xamjenkinsartifact",
|
||||
storageCredentialId: "fbd29020e8166fbede5518e038544343",
|
||||
])
|
||||
if (isUnix()) {
|
||||
sh("cp -rf ArtifactsFor-${env.BUILD_NUMBER}/${commitHash}/*/* .")
|
||||
sh("rm -rf ArtifactsFor-*")
|
||||
} else {
|
||||
powershell("copy -recurse -force ArtifactsFor-${env.BUILD_NUMBER}/${commitHash}/*/* .")
|
||||
powershell("del -recurse -force ArtifactsFor-*")
|
||||
}
|
||||
}
|
||||
|
||||
def reportGitHubStatus(commitHash, context, backref, statusResult, statusResultMessage) {
|
||||
step([
|
||||
$class: "GitHubCommitStatusSetter",
|
||||
commitShaSource: [
|
||||
$class: "ManuallyEnteredShaSource",
|
||||
sha: commitHash
|
||||
],
|
||||
contextSource: [
|
||||
$class: "ManuallyEnteredCommitContextSource",
|
||||
context: context
|
||||
],
|
||||
statusBackrefSource: [
|
||||
$class: "ManuallyEnteredBackrefSource",
|
||||
backref: backref
|
||||
],
|
||||
statusResultSource: [
|
||||
$class: "ConditionalStatusResultSource",
|
||||
results: [[
|
||||
$class: "AnyBuildResult",
|
||||
state: statusResult,
|
||||
message: statusResultMessage
|
||||
]]
|
||||
]
|
||||
])
|
||||
}
|
||||
|
||||
def cmd(script) {
|
||||
if (isUnix()) {
|
||||
return sh(script)
|
||||
} else {
|
||||
return powershell(script)
|
||||
}
|
||||
}
|
||||
|
||||
def cmdResult(script) {
|
||||
if (isUnix()) {
|
||||
return sh(script: script, returnStdout: true)
|
||||
} else {
|
||||
return powershell(script: script, returnStdout: true)
|
||||
}
|
||||
}
|
||||
|
||||
def getWSRoot() {
|
||||
def cleanBranch = env.BRANCH_NAME.replace("/", "_").replace("\\", "_")
|
||||
def wsRoot = (isUnix()) ? "workspace" : "C:/bld"
|
||||
return "${wsRoot}/SkiaSharp/${cleanBranch}"
|
||||
}
|
Загрузка…
Ссылка в новой задаче