Skip to content

Commit

Permalink
CI: Fix different issues on CI because of SDK implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
seclerp committed Apr 15, 2024
1 parent 360a289 commit 7363fac
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
File renamed without changes.
20 changes: 16 additions & 4 deletions Cesium.Sdk.Tests/SdkTestBase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.Json;
using Cesium.Solution.Metadata;
using Xunit.Abstractions;
Expand Down Expand Up @@ -92,8 +93,8 @@ protected BuildResult ExecuteTargets(string projectName, params string[] targets
var properties = MSBuildCLI.EvaluateProperties(testProjectFile, objFolderPropertyName, binFolderPropertyName);
_testOutputHelper.WriteLine($"Properties request result: {JsonSerializer.Serialize(properties, new JsonSerializerOptions { WriteIndented = false })}");

var binFolder = Path.Combine(testProjectFolder, properties[binFolderPropertyName]);
var objFolder = Path.Combine(testProjectFolder, properties[objFolderPropertyName]);
var binFolder = NormalizePath(Path.GetFullPath(properties[binFolderPropertyName], testProjectFolder));
var objFolder = NormalizePath(Path.GetFullPath(properties[objFolderPropertyName], testProjectFolder));

var binArtifacts = CollectArtifacts(binFolder);
var objArtifacts = CollectArtifacts(objFolder);
Expand All @@ -102,12 +103,15 @@ protected BuildResult ExecuteTargets(string projectName, params string[] targets
_testOutputHelper.WriteLine($"Build result: {JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true })}");
return result;

IReadOnlyCollection<BuildArtifact> CollectArtifacts(string folder) =>
Directory.Exists(folder)
IReadOnlyCollection<BuildArtifact> CollectArtifacts(string folder)
{
_testOutputHelper.WriteLine($"Collecting artifacts from '{folder}' folder");
return Directory.Exists(folder)
? Directory.GetFiles(folder, "*.*", SearchOption.AllDirectories)
.Select(path => new BuildArtifact(Path.GetRelativePath(folder, path), path))
.ToList()
: Array.Empty<BuildArtifact>();
}
}

private static void EmitNuGetConfig(string configFilePath, string packageSourcePath)
Expand Down Expand Up @@ -152,6 +156,14 @@ private static void CopyDirectoryRecursive(string source, string target)
}
}

private static string NormalizePath(string path)
{
var normalizedPath = new Uri(path).LocalPath;
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? normalizedPath
: normalizedPath.Replace('\\', '/');
}

protected record BuildResult(
int ExitCode,
IReadOnlyCollection<BuildArtifact> OutputArtifacts,
Expand Down
1 change: 0 additions & 1 deletion build/Build.Sdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public partial class Build

void PublishCompiler(string runtimeId)
{
Log.Information(SkipCaches+"");
if (!SkipCaches && !NeedPublishCompilerPack(compilerProject, runtimeId))
{
Log.Information($"Skipping {runtimeId} because it was already published. Use '--skip-caches true' to re-publish.");
Expand Down
6 changes: 3 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "8.0.0",
"rollForward": "latestMinor",
"allowPrerelease": true
"rollForward": "latestFeature",
"allowPrerelease": false
}
}
}
1 change: 0 additions & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="cesium_compiler" value="artifacts/package/debug" />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>

0 comments on commit 7363fac

Please sign in to comment.