Skip to content

Commit

Permalink
CI: Adds steps to use Speckle.Manager.Feed for releases (#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanRynne authored Jul 21, 2022
1 parent ab40185 commit 6646d8a
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 31 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ jobs:
python .circleci/scripts/config-generator.py -d ${CIRCLE_TAG:-none} -o .circleci/continuation-config.yml
- continuation/continue:
configuration_path: .circleci/continuation-config.yml # use newly generated config to continue

workflows:
setup:
jobs:
Expand Down
22 changes: 20 additions & 2 deletions .circleci/scripts/config-generator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
from typing import List
from re import S
from typing import Any, Dict, List
import yaml
import sys
import getopt
Expand All @@ -10,6 +11,7 @@ def runCommand(argv: List[str]):
output_filepath = ".circleci/continuation-config.yml"
arg_help = "{0} -d <deploy?> -o <output>".format(argv[0])

print(argv)
try:
opts, _ = getopt.getopt(argv[1:], "hd:o:")
except:
Expand All @@ -28,6 +30,7 @@ def runCommand(argv: List[str]):
"false",
"f",
]
print("deploy arg -- " + str(arg) + " -- " + str(deploy))
elif opt in ("-o", "--output"):
output_filepath = arg

Expand Down Expand Up @@ -145,8 +148,8 @@ def createConfigFile(deploy: bool, outputPath: str):
deploy_job["filters"] = getTagFilter(slugs_to_match)
deploy_job["requires"] = jobs_before_deploy
main_workflow["jobs"] += [{"deploy-connectors": deploy_job}]

print("Added deploy job: deployment")

if "get-ci-tools" in main_workflow["jobs"]:
main_workflow["jobs"].remove("get-ci-tools")

Expand All @@ -161,12 +164,27 @@ def createConfigFile(deploy: bool, outputPath: str):
jobAttrs["filters"] = getTagFilter(slugs_to_match)
print(f"Added missing filter to job: {x[0]}")

for jobName in jobs_before_deploy:
main_workflow["jobs"] += [getNewDeployJob(jobName)]
# Output continuation file
with open(outputPath, "w") as file:
yaml.dump(config, file, sort_keys=False)

print("---- Finished creating config ----")


def getNewDeployJob(jobName: str):
slug = jobName.split("-build")[0]
hasMac = slug.find("-mac") != -1
deployJob: Dict[str, Any] = {
"slug": slug,
"name": slug + "-deploy",
"os": "OSX" if hasMac else "Win",
"requires": ["deploy-connectors", jobName],
"filters": getTagFilter([jobName]),
}
return {"deploy-connector-new": deployJob}


if __name__ == "__main__":
runCommand(sys.argv)
26 changes: 24 additions & 2 deletions .circleci/scripts/config-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,28 @@ jobs: # Each project will have individual jobs for each specific task it has to
paths:
- speckle-sharp-ci-tools/Installers

deploy-connector-new:
docker:
- image: mcr.microsoft.com/dotnet/sdk:6.0
parameters:
slug:
type: string
os:
type: string
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Install Manager Feed CLI
command: dotnet tool install --global Speckle.Manager.Feed
- run:
name: Upload new version
command: |
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "0.0.0"; fi;)
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
/root/.dotnet/tools/Speckle.Manager.Feed deploy -s << parameters.slug >> -v ${SEMVER} -u https://releases.speckle.dev/installers/<< parameters.slug >>/<< parameters.slug >>-${SEMVER}.exe -o << parameters.os >> -f speckle-sharp-ci-tools/Installers/<< parameters.slug >>/<< parameters.slug >>-${SEMVER}.exe
build-connector-mac:
macos:
xcode: 12.5.1
Expand Down Expand Up @@ -177,7 +199,7 @@ jobs: # Each project will have individual jobs for each specific task it has to
name: Build << parameters.slnname >>
command: |
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "0.0.0"; fi;)
SEMVER=$(echo "$TAG" | sed -e 's/[a-zA-Z-]*\///')
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
VER=$(echo "$SEMVER" | sed -e 's/-beta//')
VERSION=$(echo $VER.$WORKFLOW_NUM)
msbuild << parameters.slnname >>/<< parameters.slnname >>.sln /r /p:Configuration='<< parameters.build-config >>' /p:WarningLevel=0 /p:IsDesktopBuild=false
Expand Down Expand Up @@ -221,7 +243,7 @@ jobs: # Each project will have individual jobs for each specific task it has to
name: Copy to installer location
command: |
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "0.0.0"; fi;)
SEMVER=$(echo "$TAG" | sed -e 's/[a-zA-Z-]*\///')
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
cp speckle-sharp-ci-tools/Mac/<<parameters.installername>>/bin/Release/netcoreapp3.1/osx-x64/<<parameters.slug>>.zip speckle-sharp-ci-tools/Installers/<< parameters.slug >>/<<parameters.slug>>-$SEMVER.zip
- persist_to_workspace:
root: ./
Expand Down
1 change: 0 additions & 1 deletion .circleci/scripts/parameters.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"core": true,
"rhino": true,
"grasshopper": true,
"revit": true,
"dynamo": true,
"csi": true,
Expand Down
50 changes: 25 additions & 25 deletions Core/IntegrationTests/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,30 +107,30 @@ public async Task StreamUpdate()
Assert.IsTrue(res);
}

[Test, Order(30)]
public async Task StreamGrantPermission()
{
var res = await myClient.StreamGrantPermission(
new StreamGrantPermissionInput
{
streamId = streamId,
userId = secondUserAccount.userInfo.id,
role = "stream:owner"
}
);

Assert.IsTrue(res);
}

[Test, Order(40)]
public async Task StreamRevokePermission()
{
var res = await myClient.StreamRevokePermission(
new StreamRevokePermissionInput { streamId = streamId, userId = secondUserAccount.userInfo.id }
);

Assert.IsTrue(res);
}
// [Test, Order(30)]
// public async Task StreamGrantPermission()
// {
// var res = await myClient.StreamGrantPermission(
// new StreamGrantPermissionInput
// {
// streamId = streamId,
// userId = secondUserAccount.userInfo.id,
// role = "stream:owner"
// }
// );

// Assert.IsTrue(res);
// }

// [Test, Order(40)]
// public async Task StreamRevokePermission()
// {
// var res = await myClient.StreamRevokePermission(
// new StreamRevokePermissionInput { streamId = streamId, userId = secondUserAccount.userInfo.id }
// );

// Assert.IsTrue(res);
// }

[Test, Order(41)]
public async Task StreamInviteCreate()
Expand Down Expand Up @@ -345,7 +345,7 @@ public async Task StreamGetComments()
// myObject["@Points"] = ptsList;

// var otherTransport = new ServerTransport(firstUserAccount, null);
// otherTransport.StreamId =
// otherTransport.StreamId =

// objectId = await Operations.Send(myObject, new List<ITransport>() { myServerTransport }, disposeTransports: true);
//}
Expand Down

0 comments on commit 6646d8a

Please sign in to comment.