diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index f623d0046f..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,66 +0,0 @@ -version: 2.1 - -# this allows you to use CircleCI's dynamic configuration feature -setup: true - -# the path-filtering orb is required to continue a pipeline based on -# the path of an updated fileset -orbs: - path-filtering: circleci/path-filtering@0.1.3 - continuation: circleci/continuation@0.3.1 - python: circleci/python@2.0.3 - -jobs: - setup: - executor: python/default - steps: - - checkout # checkout code - - when: - condition: - and: - - not: - equal: [main, << pipeline.git.branch >>] - - not: - matches: - pattern: ".*/?ci/.*" - value: << pipeline.git.branch >> - - not: - matches: - pattern: ".*/all$" - value: << pipeline.git.tag >> - steps: - - run: git branch internal_circleci - # - path-filtering/set-parameters: - # mapping: | - # Core/.* core true - # (Core|Objects|ConnectorRhino|ConnectorGrasshopper|.*/ConverterRhinoGh)/.* rhino true - # (Core|Objects|ConnectorRevit|.*/ConverterRevit)/.* revit true - # (Core|Objects|ConnectorDynamo|.*/ConverterDynamo)/.* dynamo true - # (Core|Objects|ConnectorAutocadCivil|.*/ConverterAutocadCivil)/.* autocadcivil true - # (Core|Objects|ConnectorCSI|.*/ConverterCSI)/.* csi true - # (Core|Objects|ConnectorBentley|.*/ConverterBentley)/.* bentley true - # (Core|Objects|ConnectorTeklaStructures|.*/ConverterTeklaStructures)/.* teklastructures true - # (Core|Objects|ConnectorArchicad)/.* archicad true - # (Core|Objects|ConnectorNavisworks|.*/ConverterNavisworks)/.* navisworks true - # base-revision: main - # output-path: .circleci/scripts/parameters.json - - run: cat .circleci/scripts/parameters.json - - run: pip install pyyaml - - run: # run a command - name: Generate config - command: | - python .circleci/scripts/config-generator.py -d ${CIRCLE_TAG:-none} -o .circleci/continuation-config.yml -e ${CIRCLE_PR_REPONAME:-none} - - continuation/continue: - configuration_path: .circleci/continuation-config.yml # use newly generated config to continue -workflows: - setup: - jobs: - - setup: - name: Build Setup - - setup: - name: Deploy Setup - filters: - branches: - ignore: /.*/ - tags: - only: /^(nugets\/)?([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?(\/all)?$/ diff --git a/.circleci/scripts/common-jobs.yml b/.circleci/scripts/common-jobs.yml deleted file mode 100644 index 53eac01827..0000000000 --- a/.circleci/scripts/common-jobs.yml +++ /dev/null @@ -1,4 +0,0 @@ -core: - - test-core: - requires: - - build-sdk diff --git a/.circleci/scripts/config-generator.py b/.circleci/scripts/config-generator.py deleted file mode 100644 index b74cbda16e..0000000000 --- a/.circleci/scripts/config-generator.py +++ /dev/null @@ -1,236 +0,0 @@ -import json -from re import S -from typing import Any, Dict, List -import yaml -import sys -import getopt - - -def runCommand(argv: List[str]): - - deploy: bool = False - external_build: bool = False - output_filepath: str = ".circleci/continuation-config.yml" - arg_help = "{0} -d -o ".format(argv[0]) - - print(argv) - try: - opts, _ = getopt.getopt(argv[1:], "hd:o:e:") - except: - print(arg_help) - sys.exit(2) - - for opt, arg in opts: - if opt in ("-h", "--help"): - print(arg_help) # print the help message - sys.exit(2) - elif opt in ("-d", "--deploy"): - deploy = arg is not None and arg not in [ - "none", - "None", - "False", - "false", - "f", - ] - print("deploy arg -- " + str(arg) + " -- " + str(deploy)) - elif opt in ("-o", "--output"): - output_filepath = arg - elif opt in ("-e", "--external"): - external_build = arg is not None and arg not in [ - "none", - "None", - "False", - "false", - "f", - ] - print("Building for external PR " + str(external_build)) - createConfigFile(deploy, output_filepath, external_build) - - -def setup(): - # Grab the parameters file - with open(".circleci/scripts/parameters.json", "r") as f: - global params - params = json.load(f) - - # Grab the template configuration - with open(".circleci/scripts/config-template.yml", "r") as yf: - global config - config = yaml.safe_load(yf) - - # Grab available connector jobs - with open(".circleci/scripts/connector-jobs.yml", "r") as cf: - global connector_jobs - connector_jobs = yaml.safe_load(cf) - - with open(".circleci/scripts/common-jobs.yml", "r") as cf: - global common_jobs - common_jobs = yaml.safe_load(cf) - - -def getTagRegexString(connector_names: List[str]) -> str: - # Version format 'x.y.z' with optional suffix '-{SUFFIX_NAME}' and optional '/all' ending to force build all tags - return "/^([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-\\w+)?(\\/all)?$/" - - -def getTagFilter(connector_names: List[str]): - return { - "branches": {"ignore": "/.*/"}, - "tags": {"only": getTagRegexString(connector_names)}, - } - - -def createConfigFile(deploy: bool, outputPath: str, external_build: bool): - print("---- Started creating config ----") - print( - f"\n -- Settings --\n Deploy: {deploy}\n Output path: {outputPath}\n External build: {external_build}\n --\n" - ) - setup() - - # Get the main workflow - main_workflow = config["workflows"]["build"] - - build_core = False - if "core" in params.keys(): - build_core = params["core"] - - jobs_before_deploy: List[str] = [] - slugs_to_match: List[str] = [] - for connector, run in params.items(): - # Add any common jobs first - if connector in common_jobs.keys(): - common_jobs_to_run = common_jobs[connector] - main_workflow["jobs"] += common_jobs_to_run - print(f"Added common jobs: {connector}") - - # Add connector jobs - if run and connector in connector_jobs.keys(): - print(f"Started adding connector jobs: {connector}") - - # Get jobs to run per connector - jobs_to_run = connector_jobs[connector] - if connector not in slugs_to_match: - slugs_to_match.append(connector) - # Setup each job - for j in jobs_to_run: - # Job only has one key with the job name - job_name = next(iter(j.keys())) - jobAttrs = j[job_name] - - # Add common requirements only to connector jobs. - is_connector_job = job_name.find("build-connector") >= 0 - if is_connector_job: - # Get the slug - slug = ( - connector if "slug" not in jobAttrs.keys() else jobAttrs["slug"] - ) - - # Make sure you've initialized the 'requires' item - if "requires" not in jobAttrs.keys(): - jobAttrs["requires"] = [] - # Require objects to build for all connectors - jobAttrs["requires"] += ["build-sdk"] - - # Add name to all jobs - name = f"{slug}-build" - if "name" not in jobAttrs.keys(): - jobAttrs["name"] = name - n = jobAttrs["name"] - jobs_before_deploy.append(n) - print(f" Added connector job: {n}") - if deploy: - jobAttrs["filters"] = getTagFilter([connector]) - - # Append connector jobs to main workflow jobs - main_workflow["jobs"] += connector_jobs[connector] - if build_core: - # Require core tests too if core needs rebuilding. - jobs_before_deploy.append("test-core") - # Modify jobs for deployment - if deploy: - deploy_job = {} - 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 main_workflow["jobs"][0]["get-ci-tools"] != None: - main_workflow["jobs"].pop(0) - - ci_tools_job = { - "filters": getTagFilter(slugs_to_match), - "context": "github-dev-bot", - } - main_workflow["jobs"] += [{"get-ci-tools": ci_tools_job}] - print("Modified job for deploy: get-ci-tools") - - for job in main_workflow["jobs"]: - x = list(job.keys()) - jobAttrs = job[x[0]] - if "filters" not in jobAttrs.keys(): - jobAttrs["filters"] = getTagFilter(slugs_to_match) - print(f"Added missing filter to job: {x[0]}") - - jobsToWait = [] - for jobName in jobs_before_deploy: - if jobName == "test-core": - continue - job = getNewDeployJob(jobName) - if job["deploy-connector-new"]: - jobsToWait.append(job["deploy-connector-new"]["name"]) - main_workflow["jobs"] += [job] - main_workflow["jobs"] += [ - { - "notify-deploy": { - "requires": jobsToWait, - "context": "discord", - "filters": getTagFilter(slugs_to_match), - } - } - ] - if external_build: - removeStepsThatUseSecrets(config) - # Output continuation file - with open(outputPath, "w") as file: - yaml.dump(config, file, sort_keys=False) - - print("---- Finished creating config ----") - - -def removeStepsThatUseSecrets(config): - jobs: dict[str, dict[str, dict]] = config["workflows"]["build"]["jobs"] - filteredJobs = [] - - for jobItem in jobs: - key = next(iter(jobItem.keys())) - if key == "get-ci-tools": - continue - jobDict: dict = jobItem[key] - requires = jobDict["requires"] - if requires: - if "get-ci-tools" in requires: - requires.pop(requires.index("get-ci-tools")) - filteredJobs.append({f"{key}": jobDict}) - - config["workflows"]["build"]["jobs"] = filteredJobs - print("Cleaned up config for external build") - - -def getNewDeployJob(jobName: str): - slug: str = jobName.split("-build")[0] - isMac: bool = jobName.find("-mac") != -1 - deployJob: Dict[str, Any] = { - "slug": slug.split("-mac")[0] if isMac else slug, - "name": slug + "-deploy-mac" if isMac else slug + "-deploy", - "os": "OSX" if isMac else "Win", - "arch": "Any", - "extension": "zip" if isMac else "exe", - "requires": ["deploy-connectors", jobName], - "filters": getTagFilter([jobName]), - "context": ["do-spaces-speckle-releases"], - } - return {"deploy-connector-new": deployJob} - - -if __name__ == "__main__": - runCommand(sys.argv) diff --git a/.circleci/scripts/config-template.yml b/.circleci/scripts/config-template.yml deleted file mode 100644 index 35aa609d88..0000000000 --- a/.circleci/scripts/config-template.yml +++ /dev/null @@ -1,675 +0,0 @@ -version: 2.1 - -orbs: - win: circleci/windows@5.0.0 - aws-s3: circleci/aws-s3@2.0.0 - codecov: codecov/codecov@3.2.2 - wait-for: cobli/wait-for@0.0.2 - discord: antonioned/discord@0.1.0 - docker: circleci/docker@2.2.0 - -# The main workflows for our monorepo pipeline. - -workflows: - build: - jobs: - - get-ci-tools: - context: github-dev-bot - - build-sdk: - requires: - - get-ci-tools - build-dui3: - jobs: - - build-dui3-job - nuget: - jobs: - - build-sdk: - name: nuget-deploy-core - filters: - branches: - ignore: /.*/ - tags: - only: /^(nuget-core|nugets)\/([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w{1,10})?$/ - post-steps: - - packandpublish - context: nuget - -commands: - cached-checkout: - steps: - - checkout - - # Leaving this here to investigate further but currently IT DOES NOT WORK - # BASH_ENV says it doesn't exist or I don't have access to it. - set-version-vars: - steps: - - run: - name: Set version environment variables - command: | - echo 'export TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "2.0.999"; fi;)' >> "$BASH_ENV" - echo 'export SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')' >> "$BASH_ENV" - echo 'export VER=$(echo "$SEMVER" | sed -e 's/-.*//')' >> "$BASH_ENV" - echo 'export VERSION=$(echo $VER.$WORKFLOW_NUM)' >> "$BASH_ENV" - environment: - WORKFLOW_NUM: << pipeline.number >> - - packandpublish: - steps: - - run: - name: Build nuget packages - command: | - TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "2.0.999"; fi;) - NOPREFIX=$(echo $TAG | sed -e 's/^[a-zA-Z]*\///') - SEMVER=$(echo "$NOPREFIX" | sed -e 's/\/[a-zA-Z-]*//') - VER=$(echo "$SEMVER" | sed -e 's/-.*//') - VERSION=$(echo $VER.$WORKFLOW_NUM) - $HOME/.dotnet/dotnet pack All.sln -p:Version=$SEMVER -p:FileVersion=$VERSION -c Release -p:IsDesktopBuild=false - environment: - WORKFLOW_NUM: << pipeline.number >> - - run: - name: Push nuget packages - command: $HOME/.dotnet/dotnet nuget push "**/*.nupkg" -s https://api.nuget.org/v3/index.json -k $NUGET_APIKEY -n --skip-duplicate - - run-tests: - parameters: - project: - type: string - title: - type: string - steps: - - run: - name: << parameters.title >> - command: $HOME/.dotnet/dotnet test << parameters.project >> - -c Release - -p:IsDesktopBuild=false - --logger:"junit;LogFileName={assembly}.results.xml" - --results-directory=TestResults - --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover - -jobs: # Each project will have individual jobs for each specific task it has to execute (build, release...) - build-dui3-job: - executor: - name: win/default - shell: powershell.exe - steps: - - checkout - - run: - name: Enforce formatting - command: | - dotnet tool restore - dotnet csharpier --check . - - run: - name: Dotnet Restore - command: | - dotnet restore DUI3-DX.slnf - - run: - name: Build DUI3 Solution filter - command: | - msbuild DUI3-DX.slnf /p:Configuration=Release /p:IsDesktopBuild=false - build-sdk: - docker: - - image: cimg/base:2021.01 - steps: - - cached-checkout - - run: - name: Install dotnet - command: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel sts - $HOME/.dotnet/dotnet --version - - run: - name: Enforce formatting - command: | - $HOME/.dotnet/dotnet tool restore - $HOME/.dotnet/dotnet csharpier --check . - - run: - name: Build SDK Projects - command: | - TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "2.0.999"; fi;) - NOPREFIX=$(echo $TAG | sed -e 's/^[a-zA-Z]*\///') - SEMVER=$(echo "$NOPREFIX" | sed -e 's/\/[a-zA-Z-]*//') - VER=$(echo "$SEMVER" | sed -e 's/-.*//') - VERSION=$(echo $VER.$WORKFLOW_NUM) - $HOME/.dotnet/dotnet build SDK.slnf -c Release -p:IsDesktopBuild=false -p:Version=$SEMVER -p:FileVersion=$VERSION - environment: - WORKFLOW_NUM: << pipeline.number >> - - run-tests: - title: Core Unit Tests - project: Core/Tests/Speckle.Core.Tests.Unit/Speckle.Core.Tests.Unit.csproj - - run-tests: - title: Objects Unit Tests - project: Objects/Tests/Objects.Tests.Unit/Objects.Tests.Unit.csproj - - store_test_results: - path: TestResults - - test-core: - machine: - image: ubuntu-2204:2023.02.1 - resource_class: large - steps: - - cached-checkout - - run: - name: Install dotnet - command: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel sts - $HOME/.dotnet/dotnet --version - - run: - name: Startup the Speckle Server - command: docker compose -f Core/docker-compose.yml up -d - - run-tests: - title: Core Integration Tests - project: Core/Tests/Speckle.Core.Tests.Integration/Speckle.Core.Tests.Integration.csproj - - run-tests: - title: Automate Integration Tests - project: Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/Speckle.Automate.Sdk.Tests.Integration.csproj - - store_test_results: - path: TestResults - - build-connector: # Reusable job for basic connectors - executor: - name: win/default - shell: powershell.exe - parameters: - slnname: - type: string - projname: - type: string - default: "" - dllname: - type: string - slug: - type: string - default: "" - build-with-msbuild: - type: boolean - default: true - installer: - type: boolean - default: false - environment: - SSM: 'C:\Program Files\DigiCert\DigiCert One Signing Manager Tools' - steps: - - cached-checkout - - attach_workspace: - at: ./ - - run: - name: Restore << parameters.slnname >> - command: nuget restore << parameters.slnname >>/<< parameters.slnname >>.sln - - when: - condition: << parameters.build-with-msbuild >> - steps: - - run: - name: Build << parameters.slnname >> - command: | - $tag = if([string]::IsNullOrEmpty($env:CIRCLE_TAG)) { "2.0.999" } else { $env:CIRCLE_TAG } - $semver = if($tag.Contains('/')) {$tag.Split("/")[0] } else { $tag } - $ver = if($semver.Contains('-')) {$semver.Split("-")[0] } else { $semver } - $version = "$($ver).$($env:WORKFLOW_NUM)" - msbuild << parameters.slnname >>/<< parameters.slnname >>.sln /p:Configuration=Release /p:IsDesktopBuild=false /p:Version=$semver /p:FileVersion=$version - environment: - WORKFLOW_NUM: << pipeline.number >> - - unless: - condition: << parameters.build-with-msbuild >> - steps: - - run: - name: Build << parameters.slnname >> - command: | - $tag = if([string]::IsNullOrEmpty($env:CIRCLE_TAG)) { "2.0.999" } else { $env:CIRCLE_TAG } - $semver = if($tag.Contains('/')) {$tag.Split("/")[0] } else { $tag } - $ver = if($semver.Contains('-')) {$semver.Split("-")[0] } else { $semver } - $version = "$($ver).$($env:WORKFLOW_NUM)" - dotnet publish << parameters.slnname >>/<< parameters.slnname >>/<< parameters.projname >>.csproj -c Release -r win-x64 --self-contained /p:IsDesktopBuild=false /p:Version=$semver /p:FileVersion=$version - environment: - WORKFLOW_NUM: << pipeline.number >> - - run: - name: Exit if External PR - shell: bash.exe - command: if [ "$CIRCLE_PR_REPONAME" ]; then circleci-agent step halt; fi - - unless: # Build installers unsigned on non-tagged builds - condition: << pipeline.git.tag >> - steps: - - run: - name: Build Installer - command: speckle-sharp-ci-tools\InnoSetup\ISCC.exe speckle-sharp-ci-tools\%SLUG%.iss /Sbyparam=$p - shell: cmd.exe #does not work in powershell - environment: - SLUG: << parameters.slug >> - - when: # Setup certificates and build installers signed for tagged builds - condition: << pipeline.git.tag >> - steps: - - run: - name: "Digicert Signing Manager Setup" - command: | - cd C:\ - curl.exe -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:$env:SM_API_KEY" -o smtools-windows-x64.msi - msiexec.exe /i smtools-windows-x64.msi /quiet /qn | Wait-Process - - run: - name: Setup Digicert ONE Client Cert - command: | - cd C:\ - echo $env:SM_CLIENT_CERT_FILE_B64 > certificate.txt - certutil -decode certificate.txt certificate.p12 - - run: - name: Sync Certs - command: | - & $env:SSM\smksp_cert_sync.exe - - run: - name: Build Installer - command: speckle-sharp-ci-tools\InnoSetup\ISCC.exe speckle-sharp-ci-tools\%SLUG%.iss /Sbyparam=$p /DSIGN_INSTALLER /DCODE_SIGNING_CERT_FINGERPRINT=%SM_CODE_SIGNING_CERT_SHA1_HASH% - shell: cmd.exe #does not work in powershell - environment: - SLUG: << parameters.slug >> - - persist_to_workspace: - root: ./ - 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 - extension: - type: string - arch: - type: string - default: Any - steps: - - 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 "2.0.999"; fi;) - SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//') - VER=$(echo "$SEMVER" | sed -e 's/-.*//') - VERSION=$(echo $VER.$WORKFLOW_NUM) - /root/.dotnet/tools/Speckle.Manager.Feed deploy -s << parameters.slug >> -v ${SEMVER} -u https://releases.speckle.dev/installers/<< parameters.slug >>/<< parameters.slug >>-${SEMVER}.<< parameters.extension >> -o << parameters.os >> -a << parameters.arch >> -f speckle-sharp-ci-tools/Installers/<< parameters.slug >>/<< parameters.slug >>-${SEMVER}.<< parameters.extension >> - environment: - WORKFLOW_NUM: << pipeline.number >> - - build-connector-mac: - macos: - xcode: 12.5.1 - parameters: - slnname: - type: string - projname: - type: string - default: "" - slug: - type: string - default: "" - installer: - type: boolean - default: false - converter-files: - type: string - default: "" - installername: - type: string - default: "" - build-config: - type: string - default: Release - build-with-mono: - type: boolean - default: true - bundlename: - type: string - default: "" - steps: - - cached-checkout - - attach_workspace: - at: ./ - - run: - name: Install dotnet - command: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel sts - - $HOME/.dotnet/dotnet --version - $HOME/.dotnet/dotnet --list-runtimes - $HOME/.dotnet/dotnet --list-sdks - - when: - condition: << parameters.build-with-mono >> - steps: - - run: - name: Install mono - command: | - HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install mono mono-libgdiplus - - run: - name: Create installer target dir - command: | - mkdir -p speckle-sharp-ci-tools/Installers/<< parameters.slug >> - - when: - condition: << parameters.build-with-mono >> - steps: - - run: - name: Build << parameters.slnname >> - 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) - 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 >> - # Compress build files - - run: - name: Zip Objects Kit files - command: | - zip -j Objects.zip << parameters.converter-files >> - - run: - name: Zip Connector files - command: | - cd << parameters.slnname >>/<< parameters.projname >>/bin/ - zip -r <>.zip ./ - # Copy installer files - - run: - name: Copy files to installer - command: | - mkdir -p speckle-sharp-ci-tools/Mac/<>/.installationFiles/ - cp Objects.zip speckle-sharp-ci-tools/Mac/<>/.installationFiles - cp << parameters.slnname >>/<< parameters.projname >>/bin/<>.zip speckle-sharp-ci-tools/Mac/<>/.installationFiles - - 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 >> - - 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 "./" - # 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/<>/.installationFiles - cp << parameters.slnname >>/<< parameters.slnname >>/bin/Release/net6.0/osx-x64/publish/<< parameters.slug >>-mac-x64.zip speckle-sharp-ci-tools/Mac/<>/.installationFiles - # Create installer - - run: - name: Exit if External PR - command: if [ "$CIRCLE_PR_REPONAME" ]; then circleci-agent step halt; fi - - run: - name: Build Mac installer - command: ~/.dotnet/dotnet publish speckle-sharp-ci-tools/Mac/<>/<>.sln -r osx-x64 -c Release - - run: - name: Zip installer - command: | - cd speckle-sharp-ci-tools/Mac/<>/bin/Release/net6.0/osx-x64/publish/ - zip -r <>.zip ./ - - store_artifacts: - path: speckle-sharp-ci-tools/Mac/<>/bin/Release/net6.0/osx-x64/publish/<>.zip - - run: - name: Copy to installer location - 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) - cp speckle-sharp-ci-tools/Mac/<>/bin/Release/net6.0/osx-x64/publish/<>.zip speckle-sharp-ci-tools/Installers/<< parameters.slug >>/<>-$SEMVER.zip - environment: - WORKFLOW_NUM: << pipeline.number >> - - when: - condition: << pipeline.git.tag >> - steps: - - persist_to_workspace: - root: ./ - paths: - - speckle-sharp-ci-tools/Installers - - build-connector-dotnet-mac: - docker: - - image: mcr.microsoft.com/dotnet/sdk:7.0 - parameters: - slnname: - type: string - projname: - type: string - default: "" - slug: - type: string - default: "" - converter-files: - type: string - default: "" - installername: - type: string - default: "" - build-config: - type: string - default: Release - steps: - - cached-checkout - - attach_workspace: - at: ./ - - run: - name: Create installer target directory - command: | - mkdir -p speckle-sharp-ci-tools/Installers/<< parameters.slug >> - - run: - name: Build - 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) - dotnet build << parameters.slnname >>/<< parameters.slnname >>.slnf -c "<< parameters.build-config >>" -p:Version=$SEMVER -p:FileVersion=$VERSION -p:IsDesktopBuild=false - environment: - WORKFLOW_NUM: << pipeline.number >> - - run: - name: Install Zip - command: | - apt-get update -y - apt-get install zip -y - - run: - name: Zip Objects Kit files - command: | - zip -j Objects.zip << parameters.converter-files >> - - run: - name: Zip Connector files - command: | - cd << parameters.slnname >>/<< parameters.projname >>/bin/ - zip -r <>.zip ./ - - run: - name: Copy files to installer - command: | - mkdir -p speckle-sharp-ci-tools/Mac/<>/.installationFiles/ - cp Objects.zip speckle-sharp-ci-tools/Mac/<>/.installationFiles - cp << parameters.slnname >>/<< parameters.projname >>/bin/<>.zip speckle-sharp-ci-tools/Mac/<>/.installationFiles - # Create installer - - run: - name: Exit if External PR - command: if [ "$CIRCLE_PR_REPONAME" ]; then circleci-agent step halt; fi - - run: - name: Build Mac installer - command: dotnet publish speckle-sharp-ci-tools/Mac/<>/<>.sln -r osx-x64 -c Release - - run: - name: Zip installer - command: | - cd speckle-sharp-ci-tools/Mac/<>/bin/Release/net6.0/osx-x64/publish/ - zip -r <>.zip ./ - - store_artifacts: - path: speckle-sharp-ci-tools/Mac/<>/bin/Release/net6.0/osx-x64/publish/<>.zip - - run: - name: Copy to installer location - 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) - cp speckle-sharp-ci-tools/Mac/<>/bin/Release/net6.0/osx-x64/publish/<>.zip speckle-sharp-ci-tools/Installers/<< parameters.slug >>/<>-$SEMVER.zip - environment: - WORKFLOW_NUM: << pipeline.number >> - - when: - condition: << pipeline.git.tag >> - steps: - - persist_to_workspace: - root: ./ - paths: - - speckle-sharp-ci-tools/Installers - - get-ci-tools: # Clones our ci tools and persists them to the workspace - docker: - - image: cimg/base:2021.01 - steps: - - add_ssh_keys: - fingerprints: - - "62:b2:1a:86:b7:9f:83:91:9b:61:f8:52:66:38:78:64" - - run: - name: I know Github as a host - command: | - mkdir ~/.ssh - ssh-keyscan github.com >> ~/.ssh/known_hosts - - run: - name: Clone - command: git clone git@github.com:specklesystems/speckle-sharp-ci-tools.git speckle-sharp-ci-tools - - run: - name: Checkout branch - command: | - cd speckle-sharp-ci-tools - if [ -z "$CIRCLE_TAG" ] - then - git checkout ${CIRCLE_BRANCH} || git checkout main - else - git checkout ${CIRCLE_TAG} || git checkout main - fi - - - persist_to_workspace: - root: ./ - paths: - - speckle-sharp-ci-tools - - build-archicad-add-on: # build Archicad C++ add-on - parameters: - archicadversion: - type: string - default: "" - executor: - name: win/server-2019 - shell: bash.exe - version: 2023.04.1 # Version 2023.08.01 broke this step due to missing MSVC v142 C++ build tools. Fixed to the prior working version till a fix is issued. - steps: - - cached-checkout - - attach_workspace: - at: ./ - - run: - name: Install cmake - command: | - choco install cmake -y - - run: - name: Get Archicad devkit - command: | - mkdir Resources - cd Resources - curl -o Archicad<>DevKit.zip https://releases.speckle.dev/build-utils/Archicad<>DevKit.zip - unzip Archicad<>DevKit.zip -d Archicad<>DevKit - - run: - name: Generate cmake files - command: | - cd ConnectorArchicad/AddOn - mkdir Build.Win.x64.<> - export PATH=$PATH:"C:\Program Files\CMake\bin" - cmake -B "./Build.Win.x64.<>/" -A "x64" -T "v142" -DAC_API_DEVKIT_DIR="../../Resources/Archicad<>DevKit" -DAC_MDID_DEV=${GRAPHISOFT_DEV_ID:-1} -DAC_MDID_LOC=${GRAPHISOFT_ADDON_ID:-1} - - run: - name: Build add-on - command: | - cd ConnectorArchicad/AddOn - "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe" "Build.Win.x64.<>/Speckle Connector.sln" -property:Configuration=Release - - persist_to_workspace: - root: ./ - paths: - - ConnectorArchicad/AddOn/Build.Win.x64.<> - - build-archicad-add-on-mac: # build Archicad C++ add-on - macos: - xcode: 12.5.1 - parameters: - archicadversion: - type: string - default: "" - slug: - type: string - default: "" - installername: - type: string - default: "" - steps: - - cached-checkout - - attach_workspace: - at: ./ - - run: - name: Install cmake - command: | - HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install cmake - - run: - name: Get Archicad devkit - command: | - mkdir Resources - cd Resources - curl -o Archicad<>DevKitMac.zip https://releases.speckle.dev/build-utils/Archicad<>DevKitMac.zip - unzip Archicad<>DevKitMac.zip -d Archicad<>DevKitMac - - run: - name: Generate cmake files - command: | - cd ConnectorArchicad/AddOn - mkdir Build.macOS.x64.<> - cmake -B "./Build.macOS.x64.<>/" -G 'Xcode' -DCMAKE_OSX_ARCHITECTURES=x86_64 -DAC_API_DEVKIT_DIR="../../Resources/Archicad<>DevKitMac" -DAC_MDID_DEV=${GRAPHISOFT_DEV_ID:-1} -DAC_MDID_LOC=${GRAPHISOFT_ADDON_ID:-1} - - run: - name: Build add-on - command: | - cd ConnectorArchicad/AddOn - xcodebuild -scheme ALL_BUILD -configuration Release -project Build.macOS.x64.<>/Speckle\ Connector.xcodeproj build - # Compress build files - - run: - name: Zip Connector files - command: | - cd ConnectorArchicad/AddOn/Build.macOS.x64.<< parameters.archicadversion >>/Release - zip -r << parameters.slug >>-<< parameters.archicadversion >>-mac.zip ./Speckle\ Connector.bundle - # Copy installer files - - run: - name: Copy files to installer - command: | - mkdir -p speckle-sharp-ci-tools/Mac/<< parameters.installername >>/.installationFiles/ - cp ConnectorArchicad/AddOn/Build.macOS.x64.<< parameters.archicadversion >>/Release/<< parameters.slug >>-<>-mac.zip speckle-sharp-ci-tools/Mac/<< parameters.installername >>/.installationFiles - - persist_to_workspace: - root: ./ - paths: - - speckle-sharp-ci-tools/Mac/<< parameters.installername >>/.installationFiles/ - - deploy-connectors: # Uploads all installers found to S3 - docker: - - image: cimg/base:2021.01 - steps: - - run: - name: Proceed to deploy - command: echo "This step is just here to wait for all build jobs before proceeding to deploy each of them individually. If a job fails, no connector will be deployed." - - notify-deploy: - docker: - - image: cimg/base:2021.01 - steps: - - discord/status: - mentions: "1067457311980933140" - success_message: - ":tada: a new version of Speckle-Sharp connectors was build - successfully!" - failure_message: ":red_circle: oh no! Speckle-Sharp connectors build has failed!" diff --git a/.circleci/scripts/connector-jobs.yml b/.circleci/scripts/connector-jobs.yml deleted file mode 100644 index e5e31974cd..0000000000 --- a/.circleci/scripts/connector-jobs.yml +++ /dev/null @@ -1,208 +0,0 @@ -# This file contains the individual jobs each connector must run to build/deploy. -# Each application should have its own entry as a list of jobs. -# These jobs will be pulled into the 'config-template.yml' file when needed. -# The name of each build step will be set using the "slug" - -rhino: - - build-connector: - slnname: ConnectorRhino - dllname: SpeckleConnectorRhino.rhp - slug: rhino - context: - - digicert-keylocker - - build-connector: - slnname: ConnectorRhino - dllname: SpeckleConnectorRhino.rhp - slug: grasshopper - context: - - digicert-keylocker - - build-connector-dotnet-mac: - name: rhino-build-mac - slnname: ConnectorRhino - projname: ConnectorRhino7 - installername: SpeckleRhinoInstall - build-config: Release Mac - slug: rhino - converter-files: " - Objects/Converters/ConverterRhinoGh/ConverterRhino7/bin/Release/net48/Objects.dll - Objects/Converters/ConverterRhinoGh/ConverterRhino7/bin/Release/net48/Objects.Converter.Rhino7.dll - Objects/Converters/ConverterRhinoGh/ConverterRhino6/bin/Release/netstandard2.0/Objects.Converter.Rhino6.dll - Objects/Converters/ConverterRhinoGh/ConverterGrasshopper7/bin/Release/net48/Objects.Converter.Grasshopper7.dll - Objects/Converters/ConverterRhinoGh/ConverterGrasshopper6/bin/Release/netstandard2.0/Objects.Converter.Grasshopper6.dll - " - - build-connector-dotnet-mac: - name: grasshopper-build-mac - slnname: ConnectorRhino - projname: ConnectorRhino7 - build-config: Release Mac - installername: SpeckleGHInstall - slug: grasshopper - converter-files: " - Objects/Converters/ConverterRhinoGh/ConverterRhino7/bin/Release/net48/Objects.dll - Objects/Converters/ConverterRhinoGh/ConverterRhino7/bin/Release/net48/Objects.Converter.Rhino7.dll - Objects/Converters/ConverterRhinoGh/ConverterRhino6/bin/Release/netstandard2.0/Objects.Converter.Rhino6.dll - Objects/Converters/ConverterRhinoGh/ConverterGrasshopper7/bin/Release/net48/Objects.Converter.Grasshopper7.dll - Objects/Converters/ConverterRhinoGh/ConverterGrasshopper6/bin/Release/netstandard2.0/Objects.Converter.Grasshopper6.dll - " -dynamo: - - build-connector: - slnname: ConnectorDynamo - dllname: SpeckleConnectorDynamo.dll - slug: dynamo - context: - - digicert-keylocker - -revit: - - build-connector: - slnname: ConnectorRevit - dllname: SpeckleConnectorRevit.dll - slug: revit - context: - - digicert-keylocker - -autocadcivil: - - build-connector: - slnname: ConnectorAutocadCivil - dllname: SpeckleConnectorAutocad.dll - slug: autocad - context: - - digicert-keylocker - - build-connector: - slnname: ConnectorAutocadCivil - dllname: SpeckleConnectorAutocad.dll - slug: civil3d - context: - - digicert-keylocker - - build-connector: - slnname: ConnectorAutocadCivil - dllname: SpeckleConnectorAutocad.dll - slug: advancesteel - context: - - digicert-keylocker -bentley: - - build-connector: - slnname: ConnectorBentley - dllname: SpeckleConnectorMicroStation.dll - slug: microstation - context: - - digicert-keylocker - - build-connector: - slnname: ConnectorBentley - dllname: SpeckleConnectorOpenBuildings.dll - slug: openbuildings - context: - - digicert-keylocker - - build-connector: - slnname: ConnectorBentley - dllname: SpeckleConnectorOpenRail.dll - slug: openrail - context: - - digicert-keylocker - - build-connector: - slnname: ConnectorBentley - dllname: SpeckleConnectorOpenRoads.dll - slug: openroads - context: - - digicert-keylocker - -teklastructures: - - build-connector: - slnname: ConnectorTeklaStructures - dllname: SpeckleConnectorTeklaStructures.dll - slug: teklastructures - context: - - digicert-keylocker -csi: - - build-connector: - slnname: ConnectorCSI - dllname: SpeckleConnectorCSI.dll - slug: etabs - context: - - digicert-keylocker - - build-connector: - slnname: ConnectorCSI - dllname: SpeckleConnectorCSI.dll - slug: sap2000 - context: - - digicert-keylocker - - build-connector: - slnname: ConnectorCSI - dllname: SpeckleConnectorCSI.dll - slug: safe - context: - - digicert-keylocker - - build-connector: - slnname: ConnectorCSI - dllname: SpeckleConnectorCSI.dll - slug: csibridge - context: - - digicert-keylocker - -archicad: - - build-archicad-add-on: - archicadversion: "25" - requires: - - get-ci-tools - name: build-archicad-add-on-25 - - build-archicad-add-on: - archicadversion: "26" - requires: - - get-ci-tools - name: build-archicad-add-on-26 - - build-archicad-add-on: - archicadversion: "27" - requires: - - get-ci-tools - name: build-archicad-add-on-27 - - build-connector: - requires: - - build-archicad-add-on-25 - - build-archicad-add-on-26 - - build-archicad-add-on-27 - slnname: ConnectorArchicad - projname: ConnectorArchicad - dllname: ConnectorArchicad.dll - slug: archicad - build-with-msbuild: false - context: - - digicert-keylocker - - build-archicad-add-on-mac: - archicadversion: "25" - requires: - - get-ci-tools - name: build-archicad-add-on-25-mac - slug: archicad - installername: SpeckleArchicadInstall - - build-archicad-add-on-mac: - archicadversion: "26" - requires: - - get-ci-tools - name: build-archicad-add-on-26-mac - slug: archicad - installername: SpeckleArchicadInstall - - build-archicad-add-on-mac: - archicadversion: "27" - requires: - - get-ci-tools - name: build-archicad-add-on-27-mac - slug: archicad - installername: SpeckleArchicadInstall - - build-connector-mac: - name: archicad-build-mac - requires: - - build-archicad-add-on-25-mac - - build-archicad-add-on-26-mac - - build-archicad-add-on-27-mac - slnname: ConnectorArchicad - projname: ConnectorArchicad - slug: archicad - build-with-mono: false - installername: SpeckleArchicadInstall - -navisworks: - - build-connector: - slnname: ConnectorNavisworks - dllname: SpeckleConnectorNavisworks.dll - slug: navisworks - context: - - digicert-keylocker diff --git a/.circleci/scripts/parameters.json b/.circleci/scripts/parameters.json deleted file mode 100644 index 3530ba7244..0000000000 --- a/.circleci/scripts/parameters.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "core": true, - "rhino": true, - "revit": true, - "dynamo": true, - "csi": true, - "autocadcivil": true, - "bentley": true, - "archicad": true, - "teklastructures": true, - "navisworks": true -} diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index adcbb2674c..4bab4061b3 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,26 +1,50 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net - -name: .NET +name: .NET Build and Publish on: pull_request: - branches: ["dui3/alpha"] - + branches: ["dui3/alpha", "dui3/ci/github-actions-test"] +permissions: + contents: write jobs: - build: + build-and-publish: runs-on: windows-latest + steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 + - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 7.x.x - - name: Restore projects - run: dotnet restore DUI3-DX.slnf + + - name: NuGet Cache + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + + - name: Format + run: ./build.ps1 format + + - name: Restore + run: ./build.ps1 restore + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + - name: Build - run: msbuild DUI3-DX.slnf /p:Configuration=Release /p:IsDesktopBuild=false -v:m + run: ./build.ps1 build + + - name: Pack + run: ./build.ps1 zip + - name: Upload artifacts uses: actions/upload-artifact@v4 with: - path: dist/**/*.* + name: output.zip + path: output/*.* + compression-level: 0 # no compression + + - name: Trigger Build Installers + run: ./build.ps1 build-installers ${{ secrets.CONNECTORS_GH_TOKEN }} ${{ github.run_id }} diff --git a/.gitignore b/.gitignore index 1775cb1c7d..f7b3cd5d9a 100644 --- a/.gitignore +++ b/.gitignore @@ -382,3 +382,5 @@ ConnectorArchicad/AddOn/Build* **/yarn.lock + +output/ diff --git a/All.sln b/All.sln index b1eee8f127..e916f080e7 100644 --- a/All.sln +++ b/All.sln @@ -569,6 +569,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Converters.Autocad2 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Connectors.DUI.WebView", "DUI3-DX\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj", "{7420652C-3046-4F38-BE64-9B9E69D76FA2}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{326ECEE0-D009-4A65-B24C-00FA343D8B99}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "Build\Build.csproj", "{3973D572-5E24-476F-B058-8022D826B793}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug Mac|Any CPU = Debug Mac|Any CPU @@ -2851,6 +2855,22 @@ Global {7420652C-3046-4F38-BE64-9B9E69D76FA2}.Release|Any CPU.Build.0 = Release|Any CPU {7420652C-3046-4F38-BE64-9B9E69D76FA2}.Release|x64.ActiveCfg = Release|Any CPU {7420652C-3046-4F38-BE64-9B9E69D76FA2}.Release|x64.Build.0 = Release|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Debug Mac|Any CPU.ActiveCfg = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Debug Mac|Any CPU.Build.0 = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Debug Mac|x64.ActiveCfg = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Debug Mac|x64.Build.0 = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Debug|x64.ActiveCfg = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Debug|x64.Build.0 = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Release Mac|Any CPU.ActiveCfg = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Release Mac|Any CPU.Build.0 = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Release Mac|x64.ActiveCfg = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Release Mac|x64.Build.0 = Debug|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Release|Any CPU.Build.0 = Release|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Release|x64.ActiveCfg = Release|Any CPU + {3973D572-5E24-476F-B058-8022D826B793}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3072,6 +3092,7 @@ Global {631C295A-7CCF-4B42-8686-7034E31469E7} = {804E065F-914C-414A-AF84-009312C3CFF6} {D940853C-003A-482C-BDB0-665367F274A0} = {804E065F-914C-414A-AF84-009312C3CFF6} {7420652C-3046-4F38-BE64-9B9E69D76FA2} = {FD4D6594-D81E-456F-8F2E-35B09E04A755} + {3973D572-5E24-476F-B058-8022D826B793} = {326ECEE0-D009-4A65-B24C-00FA343D8B99} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {1D43D91B-4F01-4A78-8250-CC6F9BD93A14} diff --git a/Build/Build.csproj b/Build/Build.csproj new file mode 100644 index 0000000000..74408729a7 --- /dev/null +++ b/Build/Build.csproj @@ -0,0 +1,13 @@ + + + + Exe + net7.0 + enable + + + + + + + diff --git a/Build/Consts.cs b/Build/Consts.cs new file mode 100644 index 0000000000..65a4abf7e1 --- /dev/null +++ b/Build/Consts.cs @@ -0,0 +1,13 @@ +namespace Build; + +public static class Consts +{ + public static readonly string[] Solutions = { "DUI3-DX.slnf" }; + public static readonly (string, string)[] Projects = + { + ("DUI3-DX\\Connectors\\ArcGIS\\Speckle.Connectors.ArcGIS3", "net6.0-windows"), + ("DUI3-DX\\Connectors\\Autocad\\Speckle.Connectors.Autocad2023", "net48"), + ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023", "net48"), + ("DUI3-DX\\Connectors\\Rhino\\Speckle.Connectors.Rhino7", "net48") + }; +} diff --git a/Build/EnvFile.cs b/Build/EnvFile.cs new file mode 100644 index 0000000000..0734d8dfb9 --- /dev/null +++ b/Build/EnvFile.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace Build; + +public static class EnvFile +{ + public static Dictionary Parse(string path) + { + Dictionary data = new(); + + if (!File.Exists(path)) + { + throw new FileNotFoundException(path); + } + + using var reader = File.OpenText(path); + while (reader.ReadLine() is { } line) + { + var values = line.Split("=", StringSplitOptions.RemoveEmptyEntries); + if (values.Length < 2) + { + continue; + } + data.Add(values[0], string.Join('=', values.Skip(1))); + } + + return data; + } +} diff --git a/Build/Github.cs b/Build/Github.cs new file mode 100644 index 0000000000..88624baf99 --- /dev/null +++ b/Build/Github.cs @@ -0,0 +1,42 @@ +using System; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Mime; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Build; + +public static class Github +{ + public static async Task BuildInstallers(string token, string runId) + { + using var client = new HttpClient(); + var payload = new { event_type = "build-installers", client_payload = new { run_id = runId } }; + var content = new StringContent( + JsonSerializer.Serialize(payload), + new MediaTypeHeaderValue(MediaTypeNames.Application.Json) + ); + + var request = new HttpRequestMessage() + { + Method = HttpMethod.Post, + RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), + Headers = + { + Accept = { new MediaTypeWithQualityHeaderValue("application/vnd.github+json") }, + Authorization = new AuthenticationHeaderValue("Bearer", token), + UserAgent = { new ProductInfoHeaderValue("Speckle.build", "3.0.0") } + }, + Content = content + }; + request.Headers.Add("X-GitHub-Api-Version", "2022-11-28"); + var response = await client.SendAsync(request).ConfigureAwait(false); + if (!response.IsSuccessStatusCode) + { + throw new InvalidOperationException( + $"{response.StatusCode} {response.ReasonPhrase} {await response.Content.ReadAsStringAsync().ConfigureAwait(false)}" + ); + } + } +} diff --git a/Build/Program.cs b/Build/Program.cs new file mode 100644 index 0000000000..3ffbec8258 --- /dev/null +++ b/Build/Program.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Linq; +using Build; +using GlobExpressions; +using static Bullseye.Targets; +using static SimpleExec.Command; + +const string CLEAN = "clean"; +const string RESTORE = "restore"; +const string BUILD = "build"; +const string TEST = "test"; +const string FORMAT = "format"; +const string ZIP = "zip"; +const string BUILD_INSTALLERS = "build-installers"; + +var arguments = new List(); +if (args.Length > 1) +{ + arguments = args.ToList(); + args = new[] { arguments.First() }; + arguments = arguments.Skip(1).ToList(); +} + +Target( + CLEAN, + ForEach("**/output"), + dir => + { + IEnumerable GetDirectories(string d) + { + return Glob.Directories(".", d); + } + + void RemoveDirectory(string d) + { + if (Directory.Exists(d)) + { + Console.WriteLine(d); + Directory.Delete(d, true); + } + } + + foreach (var d in GetDirectories(dir)) + { + RemoveDirectory(d); + } + } +); + +Target( + FORMAT, + () => + { + Run("dotnet", "tool restore"); + Run("dotnet", "csharpier --check ."); + } +); +Target( + RESTORE, + DependsOn(FORMAT), + Consts.Solutions, + s => + { + Run("dotnet", $"dotnet restore --locked-mode {s}"); + } +); + +Target( + BUILD, + Consts.Solutions, + s => + { + Run("msbuild", $"{s} /p:Configuration=Release /p:IsDesktopBuild=false /p:NuGetRestorePackages=false -v:m"); + } +); + +Target( + TEST, + DependsOn(BUILD), + () => + { + IEnumerable GetFiles(string d) + { + return Glob.Files(".", d); + } + + foreach (var file in GetFiles("**/*.Test.csproj")) + { + Run("dotnet", $"test {file} -c Release --no-restore --verbosity=normal"); + } + } +); + +Target( + ZIP, + Consts.Projects, + x => + { + var (path, framework) = x; + + var fullPath = Path.Combine(".", path, "bin", "Release", framework); + var outputDir = Path.Combine(".", "output"); + Directory.CreateDirectory(outputDir); + + var outputPath = Path.Combine(outputDir, $"{Path.GetFileName(path)}.zip"); + + Console.WriteLine($"Zipping: '{fullPath}' to '{outputPath}'"); + ZipFile.CreateFromDirectory(fullPath, outputPath); + } +); + +Target( + BUILD_INSTALLERS, + async () => + { + var token = arguments.First(); + var runId = arguments.Skip(1).First(); + await Github.BuildInstallers(token, runId).ConfigureAwait(false); + } +); + +Target("default", DependsOn(ZIP), () => Console.WriteLine("Done!")); + +await RunTargetsAndExitAsync(args).ConfigureAwait(true); diff --git a/Build/packages.lock.json b/Build/packages.lock.json new file mode 100644 index 0000000000..52565140d1 --- /dev/null +++ b/Build/packages.lock.json @@ -0,0 +1,25 @@ +{ + "version": 1, + "dependencies": { + "net7.0": { + "Bullseye": { + "type": "Direct", + "requested": "[5.0.0, )", + "resolved": "5.0.0", + "contentHash": "bqyt+m17ym+5aN45C5oZRAjuLDt8jKiCm/ys1XfymIXSkrTFwvI/QsbY3ucPSHDz7SF7uON7B57kXFv5H2k1ew==" + }, + "Glob": { + "type": "Direct", + "requested": "[1.1.9, )", + "resolved": "1.1.9", + "contentHash": "AfK5+ECWYTP7G3AAdnU8IfVj+QpGjrh9GC2mpdcJzCvtQ4pnerAGwHsxJ9D4/RnhDUz2DSzd951O/lQjQby2Sw==" + }, + "SimpleExec": { + "type": "Direct", + "requested": "[12.0.0, )", + "resolved": "12.0.0", + "contentHash": "ptxlWtxC8vM6Y6e3h9ZTxBBkOWnWrm/Sa1HT+2i1xcXY3Hx2hmKDZP5RShPf8Xr9D+ivlrXNy57ktzyH8kyt+Q==" + } + } + } +} \ No newline at end of file diff --git a/Core/Tests/Speckle.Core.Tests.Performance/Speckle.Core.Tests.Performance.csproj b/Core/Tests/Speckle.Core.Tests.Performance/Speckle.Core.Tests.Performance.csproj index 8b53d9d4a8..625d087f71 100644 --- a/Core/Tests/Speckle.Core.Tests.Performance/Speckle.Core.Tests.Performance.csproj +++ b/Core/Tests/Speckle.Core.Tests.Performance/Speckle.Core.Tests.Performance.csproj @@ -1,7 +1,7 @@ - net481 + net48 enable disable exe @@ -13,7 +13,7 @@ - + diff --git a/Core/Tests/Speckle.Core.Tests.Performance/packages.lock.json b/Core/Tests/Speckle.Core.Tests.Performance/packages.lock.json index 805349344e..96a50343ba 100644 --- a/Core/Tests/Speckle.Core.Tests.Performance/packages.lock.json +++ b/Core/Tests/Speckle.Core.Tests.Performance/packages.lock.json @@ -1,14 +1,14 @@ { "version": 1, "dependencies": { - ".NETFramework,Version=v4.8.1": { + ".NETFramework,Version=v4.8": { "BenchmarkDotNet": { "type": "Direct", - "requested": "[0.13.7, )", - "resolved": "0.13.7", - "contentHash": "5MordgS1tEKFB/1KywxIaIl5gKI1vbTH9hta36LHFLNQQoPyqdIOdGbbunqLIRl7XvbOIYOvkscZkCnVzkFmoQ==", + "requested": "[0.13.12, )", + "resolved": "0.13.12", + "contentHash": "aKnzpUZJJfLBHG7zcfQZhCexZQKcJgElC8qcFUTXPMYFlVauJBobuOmtRnmrapqC2j7EjjZCsPxa3yLvFLx5/Q==", "dependencies": { - "BenchmarkDotNet.Annotations": "0.13.7", + "BenchmarkDotNet.Annotations": "0.13.12", "CommandLineParser": "2.9.1", "Gee.External.Capstone": "2.3.0", "Iced": "1.17.0", @@ -25,19 +25,10 @@ "System.Threading.Tasks.Extensions": "4.5.4" } }, - "Microsoft.NETFramework.ReferenceAssemblies": { - "type": "Direct", - "requested": "[1.0.3, )", - "resolved": "1.0.3", - "contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==", - "dependencies": { - "Microsoft.NETFramework.ReferenceAssemblies.net481": "1.0.3" - } - }, "BenchmarkDotNet.Annotations": { "type": "Transitive", - "resolved": "0.13.7", - "contentHash": "CG9XZHsGpm8BIXXTCdtgISLMucsbEgpcwcewa4BiAj33j/X5nMe5v0QrlQeAvPMcMOgfenUBhGS6as9Qcnq7Ew==" + "resolved": "0.13.12", + "contentHash": "4zmFOOJqW1GrEP/t5XKgh97LH9r6zixGy2IA0JAaoTNNnZ8kPBt9u/XagsGNyV0e7rglOpFcWc6wI5EjefKpKA==" }, "CommandLineParser": { "type": "Transitive", @@ -241,11 +232,6 @@ "System.Runtime.CompilerServices.Unsafe": "4.5.1" } }, - "Microsoft.NETFramework.ReferenceAssemblies.net481": { - "type": "Transitive", - "resolved": "1.0.3", - "contentHash": "Vv/20vgHS7VglVOVh8J3Iz/MA+VYKVRp9f7r2qiKBMuzviTOmocG70yq0Q8T5OTmCONkEAIJwETD1zhEfLkAXQ==" - }, "Microsoft.Win32.Registry": { "type": "Transitive", "resolved": "5.0.0", @@ -588,7 +574,7 @@ } } }, - ".NETFramework,Version=v4.8.1/win7-x86": { + ".NETFramework,Version=v4.8/win7-x86": { "Gee.External.Capstone": { "type": "Transitive", "resolved": "2.3.0", diff --git a/DUI3-DX.slnf b/DUI3-DX.slnf index 282d1fb349..bc327849bb 100644 --- a/DUI3-DX.slnf +++ b/DUI3-DX.slnf @@ -2,6 +2,7 @@ "solution": { "path": "All.sln", "projects": [ + "Build\\Build.csproj", "Core\\Core\\Core.csproj", "Core\\Tests\\Speckle.Core.Tests.Integration\\Speckle.Core.Tests.Integration.csproj", "Core\\Tests\\Speckle.Core.Tests.Performance\\Speckle.Core.Tests.Performance.csproj", diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000000..e7638ce844 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,3 @@ +$ErrorActionPreference = "Stop"; + +dotnet run --project build/build.csproj -- $args \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000000..2951a6666b --- /dev/null +++ b/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail + +dotnet run --project build/build.csproj -- "$@" \ No newline at end of file