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

Draft build test #1407

Draft
wants to merge 3 commits into
base: release/27.3.5
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ static DotnetScriptBootstrapper()

public static string FindBundledExecutable()
{
if (ScriptingEnvironment.IsNetFramework())
throw new CommandException("dotnet-script requires .NET Core 6 or later");

var exeName = $"dotnet-script.{(CalamariEnvironment.IsRunningOnWindows ? "cmd" : "dll")}";
var myPath = typeof(DotnetScriptExecutor).Assembly.Location;
var parent = Path.GetDirectoryName(myPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Calamari.ConsolidateCalamariPackages.Tests
[TestFixture]
public class IntegrationTests
{
readonly Assent.Configuration assentConfiguration = new Assent.Configuration().UsingSanitiser(s => Sanitise4PartVersions(SanitiseHashes(s)));
readonly Assent.Configuration assentConfiguration = new Assent.Configuration().UsingSanitiser(s => Sanitise4PartVersions(SanitiseFilenamesInIndex(s)));
static readonly string TestPackagesDirectory = "../../../testPackages";

private string temp;
Expand Down Expand Up @@ -85,7 +85,7 @@ public void AndThenThePackageIsCreated()
public void AndThenThePackageContentsShouldBe()
{
using (var zip = ZipFile.Open(expectedZip, ZipArchiveMode.Read))
this.Assent(string.Join("\r\n", zip.Entries.Select(e => SanitiseHashes(e.FullName)).OrderBy(k => k)), assentConfiguration);
this.Assent(string.Join("\r\n", zip.Entries.Select(e => SanitiseHashesInPackageList(e.FullName)).OrderBy(k => k)), assentConfiguration);
}

public void AndThenTheIndexShouldBe()
Expand All @@ -96,8 +96,12 @@ public void AndThenTheIndexShouldBe()
this.Assent(sr.ReadToEnd(), assentConfiguration);
}

private static string SanitiseHashes(string s)
=> Regex.Replace(s, "[a-z0-9]{32}", "<hash>");
private static string SanitiseFilenamesInIndex(string s)
=> Regex.Replace(s, "[a-z0-9]{32}\\\\[^\"]*", "<hash>");

private static string SanitiseHashesInPackageList(string s)
=> Regex.Replace(s, "[a-z0-9]{32}", "<hash>");


private static string Sanitise4PartVersions(string s)
=> Regex.Replace(s, @"[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+", "<version>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Dictionary<string, string[]> GroupByPlatform(IEnumerable<SourceFile> filesForPac
.GroupBy(f => f.Platform)
.ToDictionary(
g => g.Key,
g => g.Select(f => f.Hash).OrderBy(h => h).ToArray()
g => g.Select(f => Path.Combine(f.Hash, f.FullNameInDestinationArchive.Replace('/', Path.DirectorySeparatorChar))).OrderBy(h => h).ToArray()
);

var index = new ConsolidatedPackageIndex(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public GoogleCloudContextScriptWrapper(ILog log, IVariables variables)
public bool IsEnabled(ScriptSyntax syntax) => supportedScriptSyntax.Contains(syntax);

public IScriptWrapper? NextWrapper { get; set; }

public CommandResult ExecuteScript(Script script,
ScriptSyntax scriptSyntax,
ICommandLineRunner commandLineRunner,
Expand Down
2 changes: 1 addition & 1 deletion source/Calamari/Calamari.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<ItemGroup>
<FSharpFiles Include="$(FSharpCompilerTools)" />
<ScriptCSFiles Include="$(ScriptCS)" />
<DotnetScriptFiles Include="$(MSBuildProjectDirectory)/../Calamari.Scripting/DotnetScript/dotnet-script.*.zip" Condition="'$(TargetFramework)' == 'net6.0'" />
<DotnetScriptFiles Include="$(MSBuildProjectDirectory)/../Calamari.Scripting/DotnetScript/dotnet-script.*.zip"/>
</ItemGroup>
</Target>
<Target Name="CopyToolsAfterBuild" AfterTargets="Build" DependsOnTargets="GetToolFiles">
Expand Down