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

Merge dev -> dui3/alpha with merge conflict #3562

Merged
merged 15 commits into from
Jul 8, 2024
Merged
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
51 changes: 32 additions & 19 deletions .circleci/scripts/config-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,28 @@ jobs: # Each project will have individual jobs for each specific task it has to
msbuild << parameters.slnname >>/<< parameters.slnname >>.sln /r /p:Configuration='<< parameters.build-config >>' /p:IsDesktopBuild=false /p:Version=$SEMVER /p:FileVersion=$VERSION
environment:
WORKFLOW_NUM: << pipeline.number >>
- unless:
condition: << parameters.build-with-mono >>
steps:
- run:
name: Publish x64 and arm64
command: |
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "2.0.999"; fi;)
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
VERSION=$(echo $VER.$WORKFLOW_NUM)
$HOME/.dotnet/dotnet publish << parameters.slnname >>/<< parameters.projname >>/<< parameters.projname >>.csproj -c Release -r osx-arm64 --self-contained /p:IsDesktopBuild=false /p:Version=$SEMVER /p:FileVersion=$VERSION
$HOME/.dotnet/dotnet publish << parameters.slnname >>/<< parameters.projname >>/<< parameters.projname >>.csproj -c Release -r osx-x64 --self-contained /p:IsDesktopBuild=false /p:Version=$SEMVER /p:FileVersion=$VERSION
environment:
WORKFLOW_NUM: << pipeline.number >>
# Create installer
- run:
name: Exit if External PR
command: if [ "$CIRCLE_PR_REPONAME" ]; then circleci-agent step halt; fi
# Zip files for installer
- when:
condition: << parameters.build-with-mono >>
steps:
# Compress build files
- run:
name: Zip Objects Kit files
Expand All @@ -362,34 +384,25 @@ jobs: # Each project will have individual jobs for each specific task it has to
condition: << parameters.build-with-mono >>
steps:
- run:
name: Publish x64 and arm64
name: Create app bundles
command: |
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "2.0.999"; fi;)
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
VERSION=$(echo $VER.$WORKFLOW_NUM)
$HOME/.dotnet/dotnet publish << parameters.slnname >>/<< parameters.projname >>/<< parameters.projname >>.csproj -c Release -r osx-arm64 --self-contained /p:IsDesktopBuild=false /p:Version=$SEMVER /p:FileVersion=$VERSION
$HOME/.dotnet/dotnet publish << parameters.slnname >>/<< parameters.projname >>/<< parameters.projname >>.csproj -c Release -r osx-x64 --self-contained /p:IsDesktopBuild=false /p:Version=$SEMVER /p:FileVersion=$VERSION
environment:
WORKFLOW_NUM: << pipeline.number >>
sh ./speckle-sharp-ci-tools/Mac/AppBundle/bundle.sh ./<< parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-arm64/publish/ ./<< parameters.slnname >>/<< parameters.slnname >>/Info.plist ./<< parameters.slnname >>/<< parameters.slnname >>/Assets/icon-mac.icns ./<< parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-arm64/<< parameters.slnname >>
sh ./speckle-sharp-ci-tools/Mac/AppBundle/bundle.sh ./<< parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-x64/publish/ ./<< parameters.slnname >>/<< parameters.slnname >>/Info.plist ./<< parameters.slnname >>/<< parameters.slnname >>/Assets/icon-mac.icns ./<< parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-x64/<< parameters.slnname >>
- run:
name: Zip Connector files
command: |
cd "<< parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-arm64/publish"
zip -r << parameters.slug >>-mac-arm64.zip "./"
cd "../../osx-x64/publish"
zip -r << parameters.slug >>-mac-x64.zip "./"
cd "<< parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-arm64/"
zip -r << parameters.slug >>-mac-arm64.zip "./<< parameters.slnname >>.app"
cd "../osx-x64/"
zip -r << parameters.slug >>-mac-x64.zip "./<< parameters.slnname >>.app"
# Copy installer files
- run:
name: Copy files to installer
command: |
mkdir -p speckle-sharp-ci-tools/Mac/<< parameters.installername >>/.installationFiles/
cp << parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-arm64/publish/<< parameters.slug >>-mac-arm64.zip speckle-sharp-ci-tools/Mac/<<parameters.installername>>/.installationFiles
cp << parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-x64/publish/<< parameters.slug >>-mac-x64.zip speckle-sharp-ci-tools/Mac/<<parameters.installername>>/.installationFiles
# Create installer
- run:
name: Exit if External PR
command: if [ "$CIRCLE_PR_REPONAME" ]; then circleci-agent step halt; fi
cp << parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-arm64/<< parameters.slug >>-mac-arm64.zip speckle-sharp-ci-tools/Mac/<<parameters.installername>>/.installationFiles
cp << parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-x64/<< parameters.slug >>-mac-x64.zip speckle-sharp-ci-tools/Mac/<<parameters.installername>>/.installationFiles

- run:
name: Build Mac installer
command: ~/.dotnet/dotnet publish speckle-sharp-ci-tools/Mac/<<parameters.installername>>/<<parameters.installername>>.sln -r osx-x64 -c Release
Expand Down
2 changes: 2 additions & 0 deletions Automate/Speckle.Automate.Sdk/AutomationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ private void MarkRun(AutomationStatus status, string? statusMessage)

public void MarkRunFailed(string statusMessage) => MarkRun(AutomationStatus.Failed, statusMessage);

public void MarkRunException(string? statusMessage) => MarkRun(AutomationStatus.Exception, statusMessage);

public void MarkRunSuccess(string? statusMessage) => MarkRun(AutomationStatus.Succeeded, statusMessage);

/// <summary>
Expand Down
25 changes: 17 additions & 8 deletions Automate/Speckle.Automate.Sdk/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TInput inputs
catch (Exception ex) when (!ex.IsFatal())
{
Console.WriteLine(ex.ToString());
automationContext.MarkRunFailed("Function error. Check the automation run logs for details.");
automationContext.MarkRunException("Function error. Check the automation run logs for details.");
}
finally
{
Expand All @@ -59,16 +59,14 @@ public static async Task<AutomationContext> RunFunction(
Func<AutomationContext, Task> automateFunction,
AutomationRunData automationRunData,
string speckleToken
)
{
return await RunFunction(
) =>
await RunFunction(
async (context, _) => await automateFunction(context).ConfigureAwait(false),
automationRunData,
speckleToken,
new Fake()
)
.ConfigureAwait(false);
}

private struct Fake { }

Expand Down Expand Up @@ -100,14 +98,25 @@ public static async Task<int> Main<TInput>(string[] args, Func<AutomationContext
Argument<string> pathArg = new(name: "Input Path", description: "A file path to retrieve function inputs");
RootCommand rootCommand = new();

// a stupid hack to be able to exit with a specific integer exit code
// read more at https://github.com/dotnet/command-line-api/issues/1570
var exitCode = 0;

rootCommand.AddArgument(pathArg);
rootCommand.SetHandler(
async inputPath =>
{
FunctionRunData<TInput> data = FunctionRunDataParser.FromPath<TInput>(inputPath);

await RunFunction(automateFunction, data.AutomationRunData, data.SpeckleToken, data.FunctionInputs)
var context = await RunFunction(
automateFunction,
data.AutomationRunData,
data.SpeckleToken,
data.FunctionInputs
)
.ConfigureAwait(false);

exitCode = context.RunStatus == "EXCEPTION" ? 1 : 0;
},
pathArg
);
Expand All @@ -118,7 +127,7 @@ await RunFunction(automateFunction, data.AutomationRunData, data.SpeckleToken, d
Command generateSchemaCommand = new("generate-schema", "Generate JSON schema for the function inputs");
generateSchemaCommand.AddArgument(schemaFilePathArg);
generateSchemaCommand.SetHandler(
(schemaFilePath) =>
schemaFilePath =>
{
JSchemaGenerator generator = new() { ContractResolver = new CamelCasePropertyNamesContractResolver() };
generator.GenerationProviders.Add(new SpeckleSecretProvider());
Expand All @@ -134,7 +143,7 @@ await RunFunction(automateFunction, data.AutomationRunData, data.SpeckleToken, d

// if we've gotten this far, the execution should technically be completed as expected
// thus exiting with 0 is the semantically correct thing to do
return 0;
return exitCode;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Automate/Speckle.Automate.Sdk/Schema/AutomationRunData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ public struct AutomationRunData
public string AutomationId { get; set; }
public string AutomationRunId { get; set; }
public string FunctionRunId { get; set; }
public List<AutomationRunTriggerBase> Triggers { get; set; }
public List<VersionCreationTrigger> Triggers { get; set; }
}
3 changes: 2 additions & 1 deletion Automate/Speckle.Automate.Sdk/Schema/AutomationStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ public enum AutomationStatus
Initializing,
Running,
Failed,
Succeeded
Succeeded,
Exception
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public abstract class AutomationStatusMapping
private const string RUNNING = "RUNNING";
private const string FAILED = "FAILED";
private const string SUCCEEDED = "SUCCEEDED";
private const string EXCEPTION = "EXCEPTION";

public static string Get(AutomationStatus status) =>
status switch
Expand All @@ -14,6 +15,7 @@ public static string Get(AutomationStatus status) =>
AutomationStatus.Failed => FAILED,
AutomationStatus.Succeeded => SUCCEEDED,
AutomationStatus.Initializing => INITIALIZING,
AutomationStatus.Exception => EXCEPTION,
_ => throw new ArgumentOutOfRangeException($"Not valid value for enum {status}")
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class VersionCreationTrigger : AutomationRunTriggerBase
public VersionCreationTrigger(string modelId, string versionId)
{
TriggerType = "versionCreation";
Payload = new VersionCreationTriggerPayload() { ModelId = modelId, VersionId = versionId };
Payload = new VersionCreationTriggerPayload { ModelId = modelId, VersionId = versionId };
}
}

Expand Down
5 changes: 1 addition & 4 deletions Automate/Speckle.Automate.Sdk/Test/TestAutomateUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ mutation Mutation($projectId: ID!, $automationId: ID!) {
AutomationId = TestAutomateEnvironment.GetSpeckleAutomationId(),
AutomationRunId = runData["automationRunId"],
FunctionRunId = runData["functionRunId"],
Triggers = new List<AutomationRunTriggerBase>()
{
new VersionCreationTrigger(modelId: modelId, versionId: versionId)
}
Triggers = new List<VersionCreationTrigger> { new(modelId: modelId, versionId: versionId) }
};

return data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private async Task<AutomationRunData> AutomationRunData(Base testObject)
string functionRelease = Utils.RandomString(10);
string functionRunId = Utils.RandomString(10);

var triggers = new List<AutomationRunTriggerBase>() { new VersionCreationTrigger(modelId, versionId) };
var triggers = new List<VersionCreationTrigger> { new(modelId, versionId) };

return new AutomationRunData
{
Expand All @@ -59,7 +59,7 @@ private async Task<AutomationRunData> AutomationRunData(Base testObject)
};
}

private VersionCreationTrigger GetVersionCreationTrigger(List<AutomationRunTriggerBase> triggers)
private VersionCreationTrigger GetVersionCreationTrigger(List<VersionCreationTrigger> triggers)
{
if (triggers.FirstOrDefault() is not VersionCreationTrigger trigger)
{
Expand Down
47 changes: 23 additions & 24 deletions ConnectorArchicad/AddOn/Sources/AddOn/AddOnMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "Commands/GetElementBaseData.hpp"
#include "Commands/GetGridElementData.hpp"
#include "Commands/GetObjectData.hpp"
#include "Commands/GetOpeningData.hpp"
#include "Commands/GetSlabData.hpp"
#include "Commands/GetRoofData.hpp"
#include "Commands/GetShellData.hpp"
Expand All @@ -31,6 +32,7 @@
#include "Commands/CreateColumn.hpp"
#include "Commands/CreateGridElement.hpp"
#include "Commands/CreateObject.hpp"
#include "Commands/CreateOpening.hpp"
#include "Commands/CreateRoof.hpp"
#include "Commands/CreateSkylight.hpp"
#include "Commands/CreateSlab.hpp"
Expand Down Expand Up @@ -90,46 +92,41 @@ class AvaloniaProcessManager {
private:
GS::UniString GetPlatformSpecificExecutablePath ()
{
#if defined (macintosh)
static const char* FileName = "ConnectorArchicad";
#else
static const char* FileName = "ConnectorArchicad.exe";
#endif
static const char* FolderNameCommon = "Common";
static const char* FolderName = "ConnectorArchicad";

IO::Location ownFileLoc;
auto err = ACAPI_GetOwnLocation (&ownFileLoc);
if (err != NoError) {
return "";
}

#if defined (macintosh)
static const char* ProductionConnector = "../../../Common/ConnectorArchicad/ConnectorArchicad.app/Contents/MacOS/ConnectorArchicad";
#else
static const char* ProductionConnector = "../../../Common/ConnectorArchicad/ConnectorArchicad.exe";
#endif

IO::Location location (ownFileLoc);
location.DeleteLastLocalName ();
location.DeleteLastLocalName ();
location.DeleteLastLocalName ();
location.AppendToLocal (IO::Name (FolderNameCommon));
location.AppendToLocal (IO::Name (FolderName));
location.AppendToLocal (IO::Name (FileName));
location.AppendToLocal (IO::RelativeLocation (ProductionConnector));

bool exist (false);
err = IO::fileSystem.Contains (location, &exist);
if (err != NoError || !exist) {
location = ownFileLoc;
location.DeleteLastLocalName ();
location.DeleteLastLocalName ();
location.DeleteLastLocalName ();
location.DeleteLastLocalName ();

location.AppendToLocal (IO::Name (FolderName));
location.AppendToLocal (IO::Name ("bin"));
#if defined (macintosh)
#ifdef DEBUG
location.AppendToLocal (IO::Name ("Debug"));
static const char* DevelopmentConnector = "../../../../ConnectorArchicad/bin/Debug/net6.0/ConnectorArchicad";
#else
location.AppendToLocal (IO::Name ("Release"));
static const char* DevelopmentConnector = "../../../../ConnectorArchicad/bin/Release/net6.0/ConnectorArchicad";
#endif
location.AppendToLocal (IO::Name ("net6.0"));
location.AppendToLocal (IO::Name (FileName));
#else
#ifdef DEBUG
static const char* DevelopmentConnector = "../../../../ConnectorArchicad/bin/Debug/net6.0/ConnectorArchicad.exe";
#else
static const char* DevelopmentConnector = "../../../../ConnectorArchicad/bin/Release/net6.0/ConnectorArchicad.exe";
#endif
#endif

location.AppendToLocal (IO::RelativeLocation (DevelopmentConnector));
}

GS::UniString executableStr;
Expand Down Expand Up @@ -200,6 +197,7 @@ static GSErrCode RegisterAddOnCommands ()
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::GetElementBaseData> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::GetGridElementData> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::GetObjectData> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::GetOpeningData> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::GetRoofData> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::GetShellData> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::GetSkylightData> ()));
Expand All @@ -213,6 +211,7 @@ static GSErrCode RegisterAddOnCommands ()
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::CreateGridElement> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::CreateColumn> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::CreateObject> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::CreateOpening> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::CreateRoof> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::CreateShell> ()));
CHECKERROR (ACAPI_AddOnAddOnCommunication_InstallAddOnCommandHandler (NewOwned<AddOnCommands::CreateSkylight> ()));
Expand Down
Loading
Loading