Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2eec40a4be | |||
| c0fecb160b | |||
| 4b9d6b051d | |||
| 35ca711c5f | |||
| 811bc7f95b | |||
| 5c0ac4e8e8 |
@@ -29,7 +29,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
python main.py generate_schema ${HOME}/${{ env.FUNCTION_SCHEMA_FILE_NAME }}
|
python main.py generate_schema ${HOME}/${{ env.FUNCTION_SCHEMA_FILE_NAME }}
|
||||||
- name: Speckle Automate Function - Build and Publish
|
- name: Speckle Automate Function - Build and Publish
|
||||||
uses: specklesystems/speckle-automate-github-composite-action@0.8.0
|
uses: specklesystems/speckle-automate-github-composite-action@0.8.1
|
||||||
with:
|
with:
|
||||||
speckle_automate_url: ${{ env.SPECKLE_AUTOMATE_URL || 'https://automate.speckle.dev' }}
|
speckle_automate_url: ${{ env.SPECKLE_AUTOMATE_URL || 'https://automate.speckle.dev' }}
|
||||||
speckle_token: ${{ secrets.SPECKLE_FUNCTION_TOKEN }}
|
speckle_token: ${{ secrets.SPECKLE_FUNCTION_TOKEN }}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Speckle Automate function",
|
"name": "Speckle Automate function",
|
||||||
"type": "python",
|
"type": "debugpy",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "main.py",
|
"program": "main.py",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
"speckleToken": "YOUR SPEKCLE TOKEN",
|
"speckleToken": "YOUR SPEKCLE TOKEN",
|
||||||
"functionInputs": {
|
"functionInputs": {
|
||||||
"whisperMessage": "you are doing something weird",
|
"whisperMessage": "you are doing something weird",
|
||||||
"forbiddenSpeckleType": ""
|
"forbiddenSpeckleType": "wall"
|
||||||
},
|
},
|
||||||
"automationRunData": {
|
"automationRunData": {
|
||||||
"project_id": "project id",
|
"project_id": "project id",
|
||||||
"model_id": "model id",
|
|
||||||
"branch_name": "branch name",
|
|
||||||
"version_id": "version id",
|
|
||||||
"speckle_server_url": "https://latest.speckle.systems",
|
"speckle_server_url": "https://latest.speckle.systems",
|
||||||
"automation_id": "automation id",
|
"automation_id": "automation id",
|
||||||
"automation_revision_id": "automation revision id",
|
|
||||||
"automation_run_id": "automation run id",
|
"automation_run_id": "automation run id",
|
||||||
"function_id": "function id",
|
"function_run_id": "function run id",
|
||||||
"function_name": "function name",
|
"triggers": [
|
||||||
"function_logo": null
|
{
|
||||||
|
"payload": { "modelId": "model id", "versionId": "version id" },
|
||||||
|
"triggerType": "versionCreation"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-3
@@ -6,8 +6,22 @@ from specklepy.objects import Base
|
|||||||
|
|
||||||
|
|
||||||
def flatten_base(base: Base) -> Iterable[Base]:
|
def flatten_base(base: Base) -> Iterable[Base]:
|
||||||
"""Take a base and flatten it to an iterable of bases."""
|
"""Flatten a base object into an iterable of bases.
|
||||||
if hasattr(base, "elements"):
|
|
||||||
for element in base["elements"]:
|
This function recursively traverses the `elements` or `@elements` attribute of the
|
||||||
|
base object, yielding each nested base object.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
base (Base): The base object to flatten.
|
||||||
|
|
||||||
|
Yields:
|
||||||
|
Base: Each nested base object in the hierarchy.
|
||||||
|
"""
|
||||||
|
# Attempt to get the elements attribute, fallback to @elements if necessary
|
||||||
|
elements = getattr(base, "elements", getattr(base, "@elements", None))
|
||||||
|
|
||||||
|
if elements is not None:
|
||||||
|
for element in elements:
|
||||||
yield from flatten_base(element)
|
yield from flatten_base(element)
|
||||||
|
|
||||||
yield base
|
yield base
|
||||||
|
|||||||
Generated
+451
-443
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -7,7 +7,7 @@ readme = "README.md"
|
|||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.11"
|
python = "^3.11"
|
||||||
specklepy = "2.17.16"
|
specklepy = "^2.19.0"
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
black = "^23.3.0"
|
black = "^23.3.0"
|
||||||
|
|||||||
+21
-5
@@ -1,11 +1,16 @@
|
|||||||
"""Run integration tests with a speckle server."""
|
"""Run integration tests with a speckle server."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
from pydantic import SecretStr
|
||||||
|
from specklepy.logging.exceptions import SpeckleException
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from gql import gql
|
from gql import gql
|
||||||
from speckle_automate import (
|
from speckle_automate import (
|
||||||
|
AutomationContext,
|
||||||
AutomationRunData,
|
AutomationRunData,
|
||||||
AutomationStatus,
|
AutomationStatus,
|
||||||
run_function,
|
run_function,
|
||||||
@@ -115,6 +120,8 @@ def automation_run_data(
|
|||||||
test_object, [ServerTransport(project_id, test_client)]
|
test_object, [ServerTransport(project_id, test_client)]
|
||||||
)
|
)
|
||||||
version_id = test_client.commit.create(project_id, root_obj_id)
|
version_id = test_client.commit.create(project_id, root_obj_id)
|
||||||
|
if isinstance(version_id, SpeckleException):
|
||||||
|
raise version_id
|
||||||
|
|
||||||
automation_name = crypto_random_string(10)
|
automation_name = crypto_random_string(10)
|
||||||
automation_id = crypto_random_string(10)
|
automation_id = crypto_random_string(10)
|
||||||
@@ -131,7 +138,7 @@ def automation_run_data(
|
|||||||
|
|
||||||
automation_run_id = crypto_random_string(10)
|
automation_run_id = crypto_random_string(10)
|
||||||
function_id = crypto_random_string(10)
|
function_id = crypto_random_string(10)
|
||||||
function_revision = crypto_random_string(10)
|
|
||||||
return AutomationRunData(
|
return AutomationRunData(
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
model_id=model_id,
|
model_id=model_id,
|
||||||
@@ -142,17 +149,26 @@ def automation_run_data(
|
|||||||
automation_revision_id=automation_revision_id,
|
automation_revision_id=automation_revision_id,
|
||||||
automation_run_id=automation_run_id,
|
automation_run_id=automation_run_id,
|
||||||
function_id=function_id,
|
function_id=function_id,
|
||||||
function_revision=function_revision,
|
function_name=crypto_random_string(10),
|
||||||
|
function_logo=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.makr.skip(
|
||||||
|
"For now the new automate experience doesn't have an easy testing mechanism"
|
||||||
|
)
|
||||||
def test_function_run(automation_run_data: AutomationRunData, speckle_token: str):
|
def test_function_run(automation_run_data: AutomationRunData, speckle_token: str):
|
||||||
"""Run an integration test for the automate function."""
|
"""Run an integration test for the automate function."""
|
||||||
|
automation_context = AutomationContext.initialize(
|
||||||
|
automation_run_data, speckle_token
|
||||||
|
)
|
||||||
automate_sdk = run_function(
|
automate_sdk = run_function(
|
||||||
|
automation_context,
|
||||||
automate_function,
|
automate_function,
|
||||||
automation_run_data,
|
FunctionInputs(
|
||||||
speckle_token,
|
forbidden_speckle_type="Base",
|
||||||
FunctionInputs(forbidden_speckle_type="Base"),
|
whisper_message=SecretStr("testing automatically"),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
assert automate_sdk.run_status == AutomationStatus.FAILED
|
assert automate_sdk.run_status == AutomationStatus.FAILED
|
||||||
|
|||||||
Reference in New Issue
Block a user