Skip to content

Commit f25a268

Browse files
committed
testing the linux native artifacts in docker
1 parent eb194ba commit f25a268

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

build/artifacts-test.cake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Task("Artifacts-Native-Test")
4242
{
4343
var (os, distro, targetframework) = dockerImage;
4444

45+
PackPrepareNative(Context, parameters, distro);
46+
4547
var cmd = $"-file {rootPrefix}/scripts/Test-Native.ps1 -repoPath {rootPrefix}/repo -runtime {distro}";
4648

4749
DockerTestArtifact(dockerImage, parameters, cmd);

build/pack.cake

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -132,33 +132,40 @@ void PackPrepareNative(ICakeContext context, BuildParameters parameters)
132132

133133
foreach (var runtime in runtimes)
134134
{
135-
var outputPath = parameters.Paths.Directories.Native.Combine(platform.ToString().ToLower()).Combine(runtime);
136-
137-
var settings = new DotNetCorePublishSettings
138-
{
139-
Framework = parameters.CoreFxVersion31,
140-
Runtime = runtime,
141-
NoRestore = false,
142-
Configuration = parameters.Configuration,
143-
OutputDirectory = outputPath,
144-
MSBuildSettings = parameters.MSBuildSettings,
145-
};
146-
147-
settings.ArgumentCustomization =
148-
arg => arg
149-
.Append("/p:PublishSingleFile=true")
150-
.Append("/p:PublishTrimmed=true")
151-
.Append("/p:IncludeSymbolsInSingleFile=true");
152-
153-
context.DotNetCorePublish("./src/GitVersionExe/GitVersionExe.csproj", settings);
154-
155-
context.Information("Validating native lib:");
135+
var outputPath = PackPrepareNative(context, parameters, runtime);
156136

157137
// testing windows and macos artifacts, ther linux is tested with docker
158138
if (platform != PlatformFamily.Linux)
159139
{
140+
context.Information("Validating native lib:");
160141
var nativeExe = outputPath.CombineWithFilePath(IsRunningOnWindows() ? "gitversion.exe" : "gitversion");
161142
ValidateOutput(nativeExe.FullPath, "/showvariable FullSemver", parameters.Version.GitVersion.FullSemVer);
162143
}
163144
}
164145
}
146+
147+
DirectoryPath PackPrepareNative(ICakeContext context, BuildParameters parameters, string runtime)
148+
{
149+
var platform = Context.Environment.Platform.Family;
150+
var outputPath = parameters.Paths.Directories.Native.Combine(platform.ToString().ToLower()).Combine(runtime);
151+
152+
var settings = new DotNetCorePublishSettings
153+
{
154+
Framework = parameters.CoreFxVersion31,
155+
Runtime = runtime,
156+
NoRestore = false,
157+
Configuration = parameters.Configuration,
158+
OutputDirectory = outputPath,
159+
MSBuildSettings = parameters.MSBuildSettings,
160+
};
161+
162+
settings.ArgumentCustomization =
163+
arg => arg
164+
.Append("/p:PublishSingleFile=true")
165+
.Append("/p:PublishTrimmed=true")
166+
.Append("/p:IncludeSymbolsInSingleFile=true");
167+
168+
context.DotNetCorePublish("./src/GitVersionExe/GitVersionExe.csproj", settings);
169+
170+
return outputPath;
171+
}

0 commit comments

Comments
 (0)