From 73b58abec6e7ec1d9a237a0cd5a6acd62426a0de Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 09:06:28 +0100 Subject: [PATCH 01/52] try adding back cache with no restore --- .github/workflows/dotnet.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index adcbb2674c..ddafdd92e6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,10 +16,15 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 7.x.x + - uses: actions/cache@v4 + id: cache + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - name: Restore projects - run: dotnet restore DUI3-DX.slnf + run: dotnet restore --locked-mode DUI3-DX.slnf - name: Build - run: msbuild DUI3-DX.slnf /p:Configuration=Release /p:IsDesktopBuild=false -v:m + run: msbuild --no-restore DUI3-DX.slnf /p:Configuration=Release /p:IsDesktopBuild=false -v:m - name: Upload artifacts uses: actions/upload-artifact@v4 with: From 3780fb7ff56fde3aa6d19b6a7c029ae2c2e9d9cf Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 09:08:19 +0100 Subject: [PATCH 02/52] try only correct action and no circle ci --- .circleci/config.yml | 66 --- .circleci/scripts/common-jobs.yml | 4 - .circleci/scripts/config-generator.py | 236 --------- .circleci/scripts/config-template.yml | 675 -------------------------- .circleci/scripts/connector-jobs.yml | 208 -------- .circleci/scripts/parameters.json | 12 - .github/workflows/dotnet.yml | 2 +- 7 files changed, 1 insertion(+), 1202 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .circleci/scripts/common-jobs.yml delete mode 100644 .circleci/scripts/config-generator.py delete mode 100644 .circleci/scripts/config-template.yml delete mode 100644 .circleci/scripts/connector-jobs.yml delete mode 100644 .circleci/scripts/parameters.json 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 ddafdd92e6..a6eb2582b0 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -5,7 +5,7 @@ name: .NET on: pull_request: - branches: ["dui3/alpha"] + branches: ["dui3/alpha". "dui3/ci/github-actions-test"] jobs: build: From 5073efc8c3d3b12d9e5217ad7c5c05d0a99ba4e3 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 09:08:54 +0100 Subject: [PATCH 03/52] typo --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index a6eb2582b0..dca6e8dc75 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -5,7 +5,7 @@ name: .NET on: pull_request: - branches: ["dui3/alpha". "dui3/ci/github-actions-test"] + branches: ["dui3/alpha", "dui3/ci/github-actions-test"] jobs: build: From 253082dd7cb225b01a8dd9df2930e846d78d884d Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 09:13:44 +0100 Subject: [PATCH 04/52] try updating benchmark tests --- .../Speckle.Core.Tests.Performance.csproj | 2 +- .../packages.lock.json | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) 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..2f5e2cf26b 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 @@ -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..7f005fe60e 100644 --- a/Core/Tests/Speckle.Core.Tests.Performance/packages.lock.json +++ b/Core/Tests/Speckle.Core.Tests.Performance/packages.lock.json @@ -4,11 +4,11 @@ ".NETFramework,Version=v4.8.1": { "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", @@ -36,8 +36,8 @@ }, "BenchmarkDotNet.Annotations": { "type": "Transitive", - "resolved": "0.13.7", - "contentHash": "CG9XZHsGpm8BIXXTCdtgISLMucsbEgpcwcewa4BiAj33j/X5nMe5v0QrlQeAvPMcMOgfenUBhGS6as9Qcnq7Ew==" + "resolved": "0.13.12", + "contentHash": "4zmFOOJqW1GrEP/t5XKgh97LH9r6zixGy2IA0JAaoTNNnZ8kPBt9u/XagsGNyV0e7rglOpFcWc6wI5EjefKpKA==" }, "CommandLineParser": { "type": "Transitive", From 64efd3b8e3e956401c968ee0230b53d80d389099 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 09:17:58 +0100 Subject: [PATCH 05/52] reducing framework version for github runner --- .../Speckle.Core.Tests.Performance.csproj | 2 +- .../packages.lock.json | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) 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 2f5e2cf26b..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 diff --git a/Core/Tests/Speckle.Core.Tests.Performance/packages.lock.json b/Core/Tests/Speckle.Core.Tests.Performance/packages.lock.json index 7f005fe60e..96a50343ba 100644 --- a/Core/Tests/Speckle.Core.Tests.Performance/packages.lock.json +++ b/Core/Tests/Speckle.Core.Tests.Performance/packages.lock.json @@ -1,7 +1,7 @@ { "version": 1, "dependencies": { - ".NETFramework,Version=v4.8.1": { + ".NETFramework,Version=v4.8": { "BenchmarkDotNet": { "type": "Direct", "requested": "[0.13.12, )", @@ -25,15 +25,6 @@ "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.12", @@ -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", From 06ac26dd8851fecf125ed8940e528f245daf67a9 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 09:22:42 +0100 Subject: [PATCH 06/52] use msbuild setup action --- .github/workflows/dotnet.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index dca6e8dc75..2a201e0fb0 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,8 +16,10 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 7.x.x - - uses: actions/cache@v4 - id: cache + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + - name: NuGet Cache + uses: actions/cache@v4 with: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} From 05633b9e1627ce73bb24f29a44574c0366f19dee Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 09:27:05 +0100 Subject: [PATCH 07/52] use correct msbuild switch for no restore --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 2a201e0fb0..32a7bd94f5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -26,7 +26,7 @@ jobs: - name: Restore projects run: dotnet restore --locked-mode DUI3-DX.slnf - name: Build - run: msbuild --no-restore DUI3-DX.slnf /p:Configuration=Release /p:IsDesktopBuild=false -v:m + run: msbuild DUI3-DX.slnf /p:RestorePackages=false /p:Configuration=Release /p:IsDesktopBuild=false -v:m - name: Upload artifacts uses: actions/upload-artifact@v4 with: From a0759c8e9946f976fb873f66b1f1083e2631e5b3 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 09:35:13 +0100 Subject: [PATCH 08/52] touch file to test caching speed --- .../Tests/Speckle.Core.Tests.Performance/RegressionTestConfig.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/Tests/Speckle.Core.Tests.Performance/RegressionTestConfig.cs b/Core/Tests/Speckle.Core.Tests.Performance/RegressionTestConfig.cs index ac3a03d54f..f60b3db82b 100644 --- a/Core/Tests/Speckle.Core.Tests.Performance/RegressionTestConfig.cs +++ b/Core/Tests/Speckle.Core.Tests.Performance/RegressionTestConfig.cs @@ -4,6 +4,7 @@ using BenchmarkDotNet.Environments; using BenchmarkDotNet.Jobs; + namespace Speckle.Core.Tests.Performance; [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true)] From 8897cea3bee447ff8a7f6a9d7e15b9ceccfafa1a Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 11:03:55 +0100 Subject: [PATCH 09/52] intermediate build commit --- All.sln | 21 +++++++++++ Build/Build.csproj | 12 ++++++ Build/Program.cs | 79 ++++++++++++++++++++++++++++++++++++++++ Build/packages.lock.json | 25 +++++++++++++ DUI3-DX.slnf | 1 + 5 files changed, 138 insertions(+) create mode 100644 Build/Build.csproj create mode 100644 Build/Program.cs create mode 100644 Build/packages.lock.json 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..ab3cdcd6e1 --- /dev/null +++ b/Build/Build.csproj @@ -0,0 +1,12 @@ + + + + Exe + net7.0 + + + + + + + diff --git a/Build/Program.cs b/Build/Program.cs new file mode 100644 index 0000000000..710723f0ab --- /dev/null +++ b/Build/Program.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.IO; +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 PUBLISH = "publish"; + +Target( + CLEAN, + ForEach("**/bin", "**/obj"), + 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), () => Run("dotnet", "restore")); + +Target( + BUILD, + DependsOn(RESTORE), + () => + { + Run("dotnet", "build src/SharpCompress/SharpCompress.csproj -c Release --no-restore"); + } +); + +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("default", DependsOn(PUBLISH), () => Console.WriteLine("Done!")); + +await RunTargetsAndExitAsync(args); 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/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", From 89d00362706210d565bf4d9d1205b4ed51e21f03 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 11:36:12 +0100 Subject: [PATCH 10/52] add build --- Build/Consts.cs | 6 ++ Build/Program.cs | 90 +++++++++---------- .../RegressionTestConfig.cs | 1 - 3 files changed, 51 insertions(+), 46 deletions(-) create mode 100644 Build/Consts.cs diff --git a/Build/Consts.cs b/Build/Consts.cs new file mode 100644 index 0000000000..f5cb4b618c --- /dev/null +++ b/Build/Consts.cs @@ -0,0 +1,6 @@ +namespace Build; + +public static class Consts +{ + public static readonly string[] SOLUTIONS = { "DUI3-DX.slnf" }; +} diff --git a/Build/Program.cs b/Build/Program.cs index 710723f0ab..4888347837 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using Build; using GlobExpressions; using static Bullseye.Targets; using static SimpleExec.Command; @@ -10,70 +11,69 @@ const string BUILD = "build"; const string TEST = "test"; const string FORMAT = "format"; -const string PUBLISH = "publish"; Target( - CLEAN, - ForEach("**/bin", "**/obj"), - dir => + CLEAN, + ForEach("**/bin", "**/obj"), + dir => + { + IEnumerable GetDirectories(string d) { - IEnumerable GetDirectories(string d) - { - return Glob.Directories(".", d); - } + return Glob.Directories(".", d); + } - void RemoveDirectory(string d) - { - if (Directory.Exists(d)) - { - Console.WriteLine(d); - Directory.Delete(d, true); - } - } + void RemoveDirectory(string d) + { + if (Directory.Exists(d)) + { + Console.WriteLine(d); + Directory.Delete(d, true); + } + } - foreach (var d in GetDirectories(dir)) - { - RemoveDirectory(d); - } + foreach (var d in GetDirectories(dir)) + { + RemoveDirectory(d); } + } ); Target( - FORMAT, - () => - { - Run("dotnet", "tool restore"); - Run("dotnet", "csharpier --check ."); - } + FORMAT, + () => + { + Run("dotnet", "tool restore"); + Run("dotnet", "csharpier --check ."); + } ); -Target(RESTORE, DependsOn(FORMAT), () => Run("dotnet", "restore")); +Target(RESTORE, DependsOn(FORMAT), Consts.SOLUTIONS, s => Run("dotnet", $"dotnet restore --locked-mode {s}")); Target( - BUILD, - DependsOn(RESTORE), - () => - { - Run("dotnet", "build src/SharpCompress/SharpCompress.csproj -c Release --no-restore"); - } + BUILD, + Consts.SOLUTIONS, + s => + { + Run("dotnet", $"build {s} -c Release --no-restore"); + } ); Target( - TEST, - DependsOn(BUILD), - () => + TEST, + DependsOn(BUILD), + () => + { + IEnumerable GetFiles(string d) { - IEnumerable GetFiles(string d) - { - return Glob.Files(".", d); - } + return Glob.Files(".", d); + } - foreach (var file in GetFiles("**/*.Test.csproj")) - { - Run("dotnet", $"test {file} -c Release --no-restore --verbosity=normal"); - } + foreach (var file in GetFiles("**/*.Test.csproj")) + { + Run("dotnet", $"test {file} -c Release --no-restore --verbosity=normal"); } + } ); -Target("default", DependsOn(PUBLISH), () => Console.WriteLine("Done!")); +Target("default", DependsOn(BUILD), () => Console.WriteLine("Done!")); await RunTargetsAndExitAsync(args); diff --git a/Core/Tests/Speckle.Core.Tests.Performance/RegressionTestConfig.cs b/Core/Tests/Speckle.Core.Tests.Performance/RegressionTestConfig.cs index f60b3db82b..ac3a03d54f 100644 --- a/Core/Tests/Speckle.Core.Tests.Performance/RegressionTestConfig.cs +++ b/Core/Tests/Speckle.Core.Tests.Performance/RegressionTestConfig.cs @@ -4,7 +4,6 @@ using BenchmarkDotNet.Environments; using BenchmarkDotNet.Jobs; - namespace Speckle.Core.Tests.Performance; [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true)] From 8bf73626e83aeb173a985621fe0e50003908899d Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 11:42:12 +0100 Subject: [PATCH 11/52] use build project --- .github/workflows/dotnet.yml | 6 +++--- Build/Program.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 32a7bd94f5..c168e19991 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -23,10 +23,10 @@ jobs: with: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - - name: Restore projects - run: dotnet restore --locked-mode DUI3-DX.slnf + - name: Restore + run: dotnet run --project Build/Build.csproj -- restore - name: Build - run: msbuild DUI3-DX.slnf /p:RestorePackages=false /p:Configuration=Release /p:IsDesktopBuild=false -v:m + run: dotnet run --project Build/Build.csproj -- build - name: Upload artifacts uses: actions/upload-artifact@v4 with: diff --git a/Build/Program.cs b/Build/Program.cs index 4888347837..1ed9017344 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -76,4 +76,4 @@ IEnumerable GetFiles(string d) Target("default", DependsOn(BUILD), () => Console.WriteLine("Done!")); -await RunTargetsAndExitAsync(args); +await RunTargetsAndExitAsync(args).ConfigureAwait(true); From 15b7f80d3086822601e5761c8a1ecc578456acab Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 May 2024 11:45:49 +0100 Subject: [PATCH 12/52] remove msbuild to path --- .github/workflows/dotnet.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c168e19991..b8eb6676e7 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,8 +16,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 7.x.x - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v2 - name: NuGet Cache uses: actions/cache@v4 with: From 316a9d3058772c2abe8ecabd1d0b4f16bd49ce4a Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Mon, 13 May 2024 08:28:21 +0100 Subject: [PATCH 13/52] use MS build again --- Build/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Build/Program.cs b/Build/Program.cs index 1ed9017344..c3e1b14c81 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -53,7 +53,8 @@ void RemoveDirectory(string d) Consts.SOLUTIONS, s => { - Run("dotnet", $"build {s} -c Release --no-restore"); + //Run("dotnet", $"build {s} -c Release --no-restore"); + Run("msbuild", $"{s} /p:Configuration=Release /p:IsDesktopBuild=false /p:NuGetRestorePackages=false -v:m"); } ); From c71e18050ee5282e3d1672ff1e29e25bf510d521 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Mon, 13 May 2024 08:55:14 +0100 Subject: [PATCH 14/52] add back msbuild to build path --- .github/workflows/dotnet.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b8eb6676e7..47d37be51f 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -11,20 +11,29 @@ jobs: build: 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: NuGet Cache uses: actions/cache@v4 with: path: ~/.nuget/packages - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + - name: Restore run: dotnet run --project Build/Build.csproj -- restore + - name: Build run: dotnet run --project Build/Build.csproj -- build + - name: Upload artifacts uses: actions/upload-artifact@v4 with: From df4aeb099de8a575e2d1e6592c826f2ffb4da8dc Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Mon, 13 May 2024 14:43:57 +0100 Subject: [PATCH 15/52] add packing --- Build/Consts.cs | 6 +++++- Build/Program.cs | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Build/Consts.cs b/Build/Consts.cs index f5cb4b618c..4b10ef37fe 100644 --- a/Build/Consts.cs +++ b/Build/Consts.cs @@ -2,5 +2,9 @@ public static class Consts { - public static readonly string[] SOLUTIONS = { "DUI3-DX.slnf" }; + public static readonly string[] Solutions = { "DUI3-DX.slnf" }; + public static readonly string[] Projects = + { + "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023\\Speckle.Connectors.Revit2023.csproj" + }; } diff --git a/Build/Program.cs b/Build/Program.cs index c3e1b14c81..129dcf5f18 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -11,6 +11,7 @@ const string BUILD = "build"; const string TEST = "test"; const string FORMAT = "format"; +const string PACK = "pack"; Target( CLEAN, @@ -46,11 +47,11 @@ void RemoveDirectory(string d) Run("dotnet", "csharpier --check ."); } ); -Target(RESTORE, DependsOn(FORMAT), Consts.SOLUTIONS, s => Run("dotnet", $"dotnet restore --locked-mode {s}")); +Target(RESTORE, DependsOn(FORMAT), Consts.Solutions, s => Run("dotnet", $"dotnet restore --locked-mode {s}")); Target( BUILD, - Consts.SOLUTIONS, + Consts.Solutions, s => { //Run("dotnet", $"build {s} -c Release --no-restore"); @@ -75,6 +76,16 @@ IEnumerable GetFiles(string d) } ); +Target( + PACK, + Consts.Projects, + p => + { + //Run("dotnet", $"build {p} -c Release --no-restore"); + Run("dotnet", $"pack {p} -c Release --no-restore --no-build -o ./output"); + } +); + Target("default", DependsOn(BUILD), () => Console.WriteLine("Done!")); await RunTargetsAndExitAsync(args).ConfigureAwait(true); From f7925ba442579e2d640cf072f54aa1be25906556 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Mon, 13 May 2024 15:46:07 +0100 Subject: [PATCH 16/52] add output --- .github/workflows/dotnet.yml | 5 ++++- .gitignore | 2 ++ Build/Consts.cs | 6 ++++-- Build/Program.cs | 14 ++++++++------ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 47d37be51f..367bca4fb5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -34,7 +34,10 @@ jobs: - name: Build run: dotnet run --project Build/Build.csproj -- build + - name: Pack + run: dotnet run --project Build/Build.csproj -- pack + - name: Upload artifacts uses: actions/upload-artifact@v4 with: - path: dist/**/*.* + path: output/*.* 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/Build/Consts.cs b/Build/Consts.cs index 4b10ef37fe..7f45c91005 100644 --- a/Build/Consts.cs +++ b/Build/Consts.cs @@ -3,8 +3,10 @@ public static class Consts { public static readonly string[] Solutions = { "DUI3-DX.slnf" }; - public static readonly string[] Projects = + public static readonly (string, string)[] Projects = { - "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023\\Speckle.Connectors.Revit2023.csproj" + ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023", "net48") }; + + public static readonly string Root = "C:\\Users\\adam\\Git\\speckle-sharp"; } diff --git a/Build/Program.cs b/Build/Program.cs index 129dcf5f18..a743dbab1f 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.Collections.Generic; using System.IO; +using System.IO.Compression; using Build; using GlobExpressions; using static Bullseye.Targets; @@ -79,13 +80,14 @@ IEnumerable GetFiles(string d) Target( PACK, Consts.Projects, - p => - { - //Run("dotnet", $"build {p} -c Release --no-restore"); - Run("dotnet", $"pack {p} -c Release --no-restore --no-build -o ./output"); + x => + { + var fullPath = Path.Combine(Consts.Root, x.Item1, "bin", "Release", x.Item2); + var outputPath = Path.Combine(Consts.Root, "output", $"{new DirectoryInfo(x.Item1).Name}.zip"); + ZipFile.CreateFromDirectory(fullPath, outputPath); } ); -Target("default", DependsOn(BUILD), () => Console.WriteLine("Done!")); +Target("default", DependsOn(PACK), () => Console.WriteLine("Done!")); await RunTargetsAndExitAsync(args).ConfigureAwait(true); From dee33ea790961cee082af1a556ce70e7c0a6b6aa Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Mon, 13 May 2024 15:46:33 +0100 Subject: [PATCH 17/52] fmt --- Build/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build/Program.cs b/Build/Program.cs index a743dbab1f..b185980791 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -80,8 +80,8 @@ IEnumerable GetFiles(string d) Target( PACK, Consts.Projects, - x => - { + x => + { var fullPath = Path.Combine(Consts.Root, x.Item1, "bin", "Release", x.Item2); var outputPath = Path.Combine(Consts.Root, "output", $"{new DirectoryInfo(x.Item1).Name}.zip"); ZipFile.CreateFromDirectory(fullPath, outputPath); From 6fec4aa4102ab613a635a73c44b74547bae16a16 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Mon, 13 May 2024 16:38:25 +0100 Subject: [PATCH 18/52] try out matrix with env var --- .github/workflows/dotnet.yml | 28 ++++++++++++++++++---- Build/Consts.cs | 1 + Build/Http.cs | 34 +++++++++++++++++++++++++++ Build/Program.cs | 45 +++++++++++++++++++++++++----------- 4 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 Build/Http.cs diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 367bca4fb5..ae74d40218 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -10,6 +10,12 @@ on: jobs: build: runs-on: windows-latest + strategy: + matrix: + paths: [ + "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023\\Speckle.Connectors.Revit2023.csproj", + "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.ArcGIS3\\Speckle.Connectors.Revit2023.csproj" + ] steps: - name: Checkout uses: actions/checkout@v4 @@ -25,17 +31,31 @@ jobs: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v2 + - name: Format + run: dotnet run --project Build/Build.csproj -- format + - name: Clean + env: + TARGET_PATH: ${{ matrix.paths }} + run: dotnet run --project Build/Build.csproj -- clean + - name: Restore + env: + TARGET_PATH: ${{ matrix.paths }} run: dotnet run --project Build/Build.csproj -- restore + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + - name: Build + env: + TARGET_PATH: ${{ matrix.paths }} run: dotnet run --project Build/Build.csproj -- build - - name: Pack - run: dotnet run --project Build/Build.csproj -- pack + - name: Pack + env: + TARGET_PATH: ${{ matrix.paths }} + run: dotnet run --project Build/Build.csproj -- zip - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/Build/Consts.cs b/Build/Consts.cs index 7f45c91005..a2cc7f68ff 100644 --- a/Build/Consts.cs +++ b/Build/Consts.cs @@ -3,6 +3,7 @@ public static class Consts { public static readonly string[] Solutions = { "DUI3-DX.slnf" }; + public static readonly string[] Frameworks = { "net48" }; public static readonly (string, string)[] Projects = { ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023", "net48") diff --git a/Build/Http.cs b/Build/Http.cs new file mode 100644 index 0000000000..fa1b5b1d43 --- /dev/null +++ b/Build/Http.cs @@ -0,0 +1,34 @@ +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 Http +{ + public static async Task TriggerWorkflow(string secret, string artifactId) + { + using var client = new HttpClient(); + var payload = new { event_type = "trigger-workflow", client_payload = new { artifact_id = artifactId } }; + var content = new StringContent( + JsonSerializer.Serialize(payload), + new MediaTypeHeaderValue(MediaTypeNames.Application.Json) + ); + + var request = new HttpRequestMessage() + { + RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), + Headers = { Authorization = new AuthenticationHeaderValue($"Bearer {secret}") }, + 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); + } + } +} diff --git a/Build/Program.cs b/Build/Program.cs index b185980791..79ebf40b3f 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; +using System.Threading.Tasks; using Build; using GlobExpressions; using static Bullseye.Targets; @@ -12,11 +13,12 @@ const string BUILD = "build"; const string TEST = "test"; const string FORMAT = "format"; -const string PACK = "pack"; +const string ZIP = "zip"; +const string TRIGGER_WORKFLOW = "trigger-workflow"; Target( CLEAN, - ForEach("**/bin", "**/obj"), + ForEach("**/output"), dir => { IEnumerable GetDirectories(string d) @@ -48,15 +50,22 @@ void RemoveDirectory(string d) Run("dotnet", "csharpier --check ."); } ); -Target(RESTORE, DependsOn(FORMAT), Consts.Solutions, s => Run("dotnet", $"dotnet restore --locked-mode {s}")); +Target( + RESTORE, + DependsOn(FORMAT), + () => + { + var path = Environment.GetEnvironmentVariable("TARGET_PATH"); + Run("dotnet", $"dotnet restore --locked-mode {path}"); + } +); Target( BUILD, - Consts.Solutions, - s => + () => { - //Run("dotnet", $"build {s} -c Release --no-restore"); - Run("msbuild", $"{s} /p:Configuration=Release /p:IsDesktopBuild=false /p:NuGetRestorePackages=false -v:m"); + var path = Environment.GetEnvironmentVariable("TARGET_PATH"); + Run("msbuild", $"{path} /p:Configuration=Release /p:IsDesktopBuild=false /p:NuGetRestorePackages=false -v:m"); } ); @@ -78,16 +87,26 @@ IEnumerable GetFiles(string d) ); Target( - PACK, - Consts.Projects, - x => + ZIP, + Consts.Frameworks, + framework => { - var fullPath = Path.Combine(Consts.Root, x.Item1, "bin", "Release", x.Item2); - var outputPath = Path.Combine(Consts.Root, "output", $"{new DirectoryInfo(x.Item1).Name}.zip"); + var path = Environment.GetEnvironmentVariable("TARGET_PATH"); + var fullPath = Path.Combine(".", path, "bin", "Release", framework); + var outputPath = Path.Combine(".", "output", $"{new DirectoryInfo(path).Name}.zip"); + Console.WriteLine($"Zipping: '{fullPath}' to '{outputPath}'"); ZipFile.CreateFromDirectory(fullPath, outputPath); } ); -Target("default", DependsOn(PACK), () => Console.WriteLine("Done!")); +Target( + TRIGGER_WORKFLOW, + async () => + { + await Task.CompletedTask; + } +); + +Target("default", DependsOn(ZIP), () => Console.WriteLine("Done!")); await RunTargetsAndExitAsync(args).ConfigureAwait(true); From e073a2f76f2db289d04edce8baddc5a89ee19dd5 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Mon, 13 May 2024 16:56:42 +0100 Subject: [PATCH 19/52] try again with proper paths --- .github/workflows/dotnet.yml | 23 ++++++----------------- Build/Program.cs | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index ae74d40218..7ae2063c0b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -14,7 +14,7 @@ jobs: matrix: paths: [ "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023\\Speckle.Connectors.Revit2023.csproj", - "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.ArcGIS3\\Speckle.Connectors.Revit2023.csproj" + "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.ArcGIS3\\Speckle.Connectors.ArcGIS3.csproj" ] steps: - name: Checkout @@ -33,29 +33,18 @@ jobs: - name: Format run: dotnet run --project Build/Build.csproj -- format - - - name: Clean - env: - TARGET_PATH: ${{ matrix.paths }} - run: dotnet run --project Build/Build.csproj -- clean - name: Restore - env: - TARGET_PATH: ${{ matrix.paths }} - run: dotnet run --project Build/Build.csproj -- restore + run: dotnet run --project Build/Build.csproj -- restore ${{ matrix.paths }} - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - name: Build - env: - TARGET_PATH: ${{ matrix.paths }} - run: dotnet run --project Build/Build.csproj -- build - - - name: Pack - env: - TARGET_PATH: ${{ matrix.paths }} - run: dotnet run --project Build/Build.csproj -- zip + run: dotnet run --project Build/Build.csproj -- build ${{ matrix.paths }} + + - name: Pack + run: dotnet run --project Build/Build.csproj -- zip ${{ matrix.paths }} - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/Build/Program.cs b/Build/Program.cs index 79ebf40b3f..c249649925 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; +using System.Linq; using System.Threading.Tasks; using Build; using GlobExpressions; @@ -16,6 +17,14 @@ const string ZIP = "zip"; const string TRIGGER_WORKFLOW = "trigger-workflow"; +var arguments = new List(); +if (args.Length > 1) +{ + arguments = args.ToList(); + args = new[] { arguments.First() }; + arguments = arguments.Skip(1).ToList(); +} + Target( CLEAN, ForEach("**/output"), @@ -55,7 +64,7 @@ void RemoveDirectory(string d) DependsOn(FORMAT), () => { - var path = Environment.GetEnvironmentVariable("TARGET_PATH"); + var path = arguments.First(); Run("dotnet", $"dotnet restore --locked-mode {path}"); } ); @@ -64,7 +73,7 @@ void RemoveDirectory(string d) BUILD, () => { - var path = Environment.GetEnvironmentVariable("TARGET_PATH"); + var path = arguments.First(); Run("msbuild", $"{path} /p:Configuration=Release /p:IsDesktopBuild=false /p:NuGetRestorePackages=false -v:m"); } ); @@ -91,7 +100,7 @@ IEnumerable GetFiles(string d) Consts.Frameworks, framework => { - var path = Environment.GetEnvironmentVariable("TARGET_PATH"); + var path = arguments.First(); var fullPath = Path.Combine(".", path, "bin", "Release", framework); var outputPath = Path.Combine(".", "output", $"{new DirectoryInfo(path).Name}.zip"); Console.WriteLine($"Zipping: '{fullPath}' to '{outputPath}'"); From 348819ffce716f117f06ed9c790a9809e2a1883a Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Mon, 13 May 2024 17:04:53 +0100 Subject: [PATCH 20/52] more args --- .github/workflows/dotnet.yml | 16 +++++++++------- Build/Program.cs | 11 ++++++----- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 7ae2063c0b..79255c3269 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -12,10 +12,12 @@ jobs: runs-on: windows-latest strategy: matrix: - paths: [ - "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023\\Speckle.Connectors.Revit2023.csproj", - "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.ArcGIS3\\Speckle.Connectors.ArcGIS3.csproj" - ] + include: + - path: "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023\\Speckle.Connectors.Revit2023.csproj" + framework: net48 + - path: "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.ArcGIS3\\Speckle.Connectors.ArcGIS3.csproj" + framework: net48 + steps: - name: Checkout uses: actions/checkout@v4 @@ -35,16 +37,16 @@ jobs: run: dotnet run --project Build/Build.csproj -- format - name: Restore - run: dotnet run --project Build/Build.csproj -- restore ${{ matrix.paths }} + run: dotnet run --project Build/Build.csproj -- restore ${{ matrix.path }} - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - name: Build - run: dotnet run --project Build/Build.csproj -- build ${{ matrix.paths }} + run: dotnet run --project Build/Build.csproj -- build ${{ matrix.path }} - name: Pack - run: dotnet run --project Build/Build.csproj -- zip ${{ matrix.paths }} + run: dotnet run --project Build/Build.csproj -- zip ${{ matrix.path }} ${{ matrix.framework }} - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/Build/Program.cs b/Build/Program.cs index c249649925..a385011801 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -4,7 +4,6 @@ using System.IO.Compression; using System.Linq; using System.Threading.Tasks; -using Build; using GlobExpressions; using static Bullseye.Targets; using static SimpleExec.Command; @@ -97,12 +96,14 @@ IEnumerable GetFiles(string d) Target( ZIP, - Consts.Frameworks, - framework => + () => { var path = arguments.First(); + var framework = arguments.Skip(1).First(); var fullPath = Path.Combine(".", path, "bin", "Release", framework); - var outputPath = Path.Combine(".", "output", $"{new DirectoryInfo(path).Name}.zip"); + var outputDir = Path.Combine(".", "output"); + Directory.CreateDirectory(outputDir); + var outputPath = Path.Combine(outputDir, $"{new DirectoryInfo(path).Name}.zip"); Console.WriteLine($"Zipping: '{fullPath}' to '{outputPath}'"); ZipFile.CreateFromDirectory(fullPath, outputPath); } @@ -112,7 +113,7 @@ IEnumerable GetFiles(string d) TRIGGER_WORKFLOW, async () => { - await Task.CompletedTask; + await Task.CompletedTask.ConfigureAwait(false); } ); From f19faa63763042b6b93bee3f8d85c5b47165981f Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 08:15:10 +0100 Subject: [PATCH 21/52] reworking again --- .github/workflows/dotnet.yml | 13 +++---------- Build/Consts.cs | 3 ++- Build/{Http.cs => Github.cs} | 2 +- Build/Program.cs | 34 ++++++++++++++-------------------- 4 files changed, 20 insertions(+), 32 deletions(-) rename Build/{Http.cs => Github.cs} (97%) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 79255c3269..803367afda 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -10,13 +10,6 @@ on: jobs: build: runs-on: windows-latest - strategy: - matrix: - include: - - path: "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023\\Speckle.Connectors.Revit2023.csproj" - framework: net48 - - path: "DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.ArcGIS3\\Speckle.Connectors.ArcGIS3.csproj" - framework: net48 steps: - name: Checkout @@ -37,16 +30,16 @@ jobs: run: dotnet run --project Build/Build.csproj -- format - name: Restore - run: dotnet run --project Build/Build.csproj -- restore ${{ matrix.path }} + run: dotnet run --project Build/Build.csproj -- restore - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - name: Build - run: dotnet run --project Build/Build.csproj -- build ${{ matrix.path }} + run: dotnet run --project Build/Build.csproj -- build - name: Pack - run: dotnet run --project Build/Build.csproj -- zip ${{ matrix.path }} ${{ matrix.framework }} + run: dotnet run --project Build/Build.csproj -- zip - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/Build/Consts.cs b/Build/Consts.cs index a2cc7f68ff..835a8300fd 100644 --- a/Build/Consts.cs +++ b/Build/Consts.cs @@ -6,7 +6,8 @@ public static class Consts public static readonly string[] Frameworks = { "net48" }; public static readonly (string, string)[] Projects = { - ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023", "net48") + ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023", "net48"), + ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.ArcGIS3", "net48") }; public static readonly string Root = "C:\\Users\\adam\\Git\\speckle-sharp"; diff --git a/Build/Http.cs b/Build/Github.cs similarity index 97% rename from Build/Http.cs rename to Build/Github.cs index fa1b5b1d43..d6048602e4 100644 --- a/Build/Http.cs +++ b/Build/Github.cs @@ -7,7 +7,7 @@ namespace Build; -public static class Http +public static class Github { public static async Task TriggerWorkflow(string secret, string artifactId) { diff --git a/Build/Program.cs b/Build/Program.cs index a385011801..b01cd2d777 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; -using System.Linq; using System.Threading.Tasks; +using Build; using GlobExpressions; using static Bullseye.Targets; using static SimpleExec.Command; @@ -16,14 +16,6 @@ const string ZIP = "zip"; const string TRIGGER_WORKFLOW = "trigger-workflow"; -var arguments = new List(); -if (args.Length > 1) -{ - arguments = args.ToList(); - args = new[] { arguments.First() }; - arguments = arguments.Skip(1).ToList(); -} - Target( CLEAN, ForEach("**/output"), @@ -61,19 +53,19 @@ void RemoveDirectory(string d) Target( RESTORE, DependsOn(FORMAT), - () => + Consts.Solutions, + s => { - var path = arguments.First(); - Run("dotnet", $"dotnet restore --locked-mode {path}"); + Run("dotnet", $"dotnet restore --locked-mode {s}"); } ); Target( BUILD, - () => + Consts.Solutions, + s => { - var path = arguments.First(); - Run("msbuild", $"{path} /p:Configuration=Release /p:IsDesktopBuild=false /p:NuGetRestorePackages=false -v:m"); + Run("msbuild", $"{s} /p:Configuration=Release /p:IsDesktopBuild=false /p:NuGetRestorePackages=false -v:m"); } ); @@ -96,14 +88,16 @@ IEnumerable GetFiles(string d) Target( ZIP, - () => + Consts.Projects, + x => { - var path = arguments.First(); - var framework = arguments.Skip(1).First(); - var fullPath = Path.Combine(".", path, "bin", "Release", framework); + var (path, framework) = x; + + var fullPath = Path.Combine(".", + Path.GetDirectoryName(path), "bin", "Release", framework); var outputDir = Path.Combine(".", "output"); Directory.CreateDirectory(outputDir); - var outputPath = Path.Combine(outputDir, $"{new DirectoryInfo(path).Name}.zip"); + var outputPath = Path.Combine(outputDir, Path.ChangeExtension(path, "zip")); Console.WriteLine($"Zipping: '{fullPath}' to '{outputPath}'"); ZipFile.CreateFromDirectory(fullPath, outputPath); } From 6a7094c8cd1e58d24ed46de60c684530fecd2958 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 08:25:51 +0100 Subject: [PATCH 22/52] add build script --- .github/workflows/dotnet.yml | 15 ++++++--------- Build/Program.cs | 5 ++--- build.ps1 | 3 +++ build.sh | 4 ++++ 4 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 build.ps1 create mode 100644 build.sh diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 803367afda..1759f2b295 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,14 +1,11 @@ -# 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", "dui3/ci/github-actions-test"] jobs: - build: + build-and-publish: runs-on: windows-latest steps: @@ -27,19 +24,19 @@ jobs: key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - name: Format - run: dotnet run --project Build/Build.csproj -- format + run: ./build.sh format - name: Restore - run: dotnet run --project Build/Build.csproj -- restore + run: ./build.sh restore - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - name: Build - run: dotnet run --project Build/Build.csproj -- build + run: ./build.sh build - name: Pack - run: dotnet run --project Build/Build.csproj -- zip + run: ./build.sh zip - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/Build/Program.cs b/Build/Program.cs index b01cd2d777..981ad2e4c2 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -92,9 +92,8 @@ IEnumerable GetFiles(string d) x => { var (path, framework) = x; - - var fullPath = Path.Combine(".", - Path.GetDirectoryName(path), "bin", "Release", framework); + + var fullPath = Path.Combine(".", Path.GetDirectoryName(path), "bin", "Release", framework); var outputDir = Path.Combine(".", "output"); Directory.CreateDirectory(outputDir); var outputPath = Path.Combine(outputDir, Path.ChangeExtension(path, "zip")); 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 From 7a7634e548dc9b576a44126459b1e3a6969305a9 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 08:28:59 +0100 Subject: [PATCH 23/52] use powershell --- .github/workflows/dotnet.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 1759f2b295..7ff03a07af 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -24,21 +24,16 @@ jobs: key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - name: Format - run: ./build.sh format + run: ./build.ps1 format - name: Restore - run: ./build.sh restore + run: ./build.ps1 restore - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - name: Build - run: ./build.sh build + run: ./build.ps1 build - - name: Pack - run: ./build.sh zip - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - path: output/*.* + - name: Pack And Upload + run: ./build.ps1 zip From d6ece2731e531aa5b94873d5bd2b8e501c3bb31a Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 08:45:03 +0100 Subject: [PATCH 24/52] refactor trigger --- .github/workflows/dotnet.yml | 8 +++++++- Build/Build.csproj | 1 + Build/Github.cs | 38 ++++++++++++------------------------ Build/packages.lock.json | 6 ++++++ 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 7ff03a07af..01f18a907b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -35,5 +35,11 @@ jobs: - name: Build run: ./build.ps1 build - - name: Pack And Upload + - name: Pack run: ./build.ps1 zip + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: artifact + path: output/*.* diff --git a/Build/Build.csproj b/Build/Build.csproj index ab3cdcd6e1..71e5acf99b 100644 --- a/Build/Build.csproj +++ b/Build/Build.csproj @@ -7,6 +7,7 @@ + diff --git a/Build/Github.cs b/Build/Github.cs index d6048602e4..ac4dc39ad0 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -1,34 +1,22 @@ -using System; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Net.Mime; -using System.Text.Json; -using System.Threading.Tasks; +using System.Threading.Tasks; +using Octokit; +using Octokit.Internal; namespace Build; public static class Github { - public static async Task TriggerWorkflow(string secret, string artifactId) + private static GitHubClient GetClient(string secret) => + new(new Octokit.ProductHeaderValue("Speckle.build"), new InMemoryCredentialStore(new Credentials(secret))); + + public static async Task TriggerWorkflow(string secret, string workflowFileName) { - using var client = new HttpClient(); - var payload = new { event_type = "trigger-workflow", client_payload = new { artifact_id = artifactId } }; - var content = new StringContent( - JsonSerializer.Serialize(payload), - new MediaTypeHeaderValue(MediaTypeNames.Application.Json) + var client = GetClient(secret); + await client.Actions.Workflows.CreateDispatch( + "specklesystems", + "connector-installers", + workflowFileName, + new CreateWorkflowDispatch("main") ); - - var request = new HttpRequestMessage() - { - RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), - Headers = { Authorization = new AuthenticationHeaderValue($"Bearer {secret}") }, - 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); - } } } diff --git a/Build/packages.lock.json b/Build/packages.lock.json index 52565140d1..f67663ca4e 100644 --- a/Build/packages.lock.json +++ b/Build/packages.lock.json @@ -14,6 +14,12 @@ "resolved": "1.1.9", "contentHash": "AfK5+ECWYTP7G3AAdnU8IfVj+QpGjrh9GC2mpdcJzCvtQ4pnerAGwHsxJ9D4/RnhDUz2DSzd951O/lQjQby2Sw==" }, + "Octokit": { + "type": "Direct", + "requested": "[11.0.1, )", + "resolved": "11.0.1", + "contentHash": "fpwF/DxMJyGS+pIXDKQozx0wCIpOfG8VDr10ls+m9Gn9Lz8GslhhApxkKD9JCNO60HRUeMJsedsAS24gCjTD7Q==" + }, "SimpleExec": { "type": "Direct", "requested": "[12.0.0, )", From b1981542791c1ef441ae253d1a620a2a8eaa1235 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 08:47:24 +0100 Subject: [PATCH 25/52] retry zipping and upload --- Build/Github.cs | 9 +++------ Build/Program.cs | 4 +++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Build/Github.cs b/Build/Github.cs index ac4dc39ad0..ceac346bc3 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -12,11 +12,8 @@ private static GitHubClient GetClient(string secret) => public static async Task TriggerWorkflow(string secret, string workflowFileName) { var client = GetClient(secret); - await client.Actions.Workflows.CreateDispatch( - "specklesystems", - "connector-installers", - workflowFileName, - new CreateWorkflowDispatch("main") - ); + await client.Actions.Workflows + .CreateDispatch("specklesystems", "connector-installers", workflowFileName, new CreateWorkflowDispatch("main")) + .ConfigureAwait(false); } } diff --git a/Build/Program.cs b/Build/Program.cs index 981ad2e4c2..eebc43e0ed 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -96,7 +96,9 @@ IEnumerable GetFiles(string d) var fullPath = Path.Combine(".", Path.GetDirectoryName(path), "bin", "Release", framework); var outputDir = Path.Combine(".", "output"); Directory.CreateDirectory(outputDir); - var outputPath = Path.Combine(outputDir, Path.ChangeExtension(path, "zip")); + + var outputPath = Path.Combine(outputDir, $"{Path.GetDirectoryName(path)}.zip"); + Console.WriteLine($"Zipping: '{fullPath}' to '{outputPath}'"); ZipFile.CreateFromDirectory(fullPath, outputPath); } From ced6391d99356d24ba459754234b0d3ef9bffa06 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 08:57:31 +0100 Subject: [PATCH 26/52] fix zipping --- Build/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build/Program.cs b/Build/Program.cs index eebc43e0ed..4cf124460c 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -93,11 +93,11 @@ IEnumerable GetFiles(string d) { var (path, framework) = x; - var fullPath = Path.Combine(".", Path.GetDirectoryName(path), "bin", "Release", framework); + var fullPath = Path.Combine(".", path, "bin", "Release", framework); var outputDir = Path.Combine(".", "output"); Directory.CreateDirectory(outputDir); - var outputPath = Path.Combine(outputDir, $"{Path.GetDirectoryName(path)}.zip"); + var outputPath = Path.Combine(outputDir, $"{Path.GetFileName(path)}.zip"); Console.WriteLine($"Zipping: '{fullPath}' to '{outputPath}'"); ZipFile.CreateFromDirectory(fullPath, outputPath); From ba9503ac13549c8bdfb5102f0d783613055fa51f Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 08:58:19 +0100 Subject: [PATCH 27/52] change compression --- .github/workflows/dotnet.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 01f18a907b..142ab4e8f6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -43,3 +43,4 @@ jobs: with: name: artifact path: output/*.* + compression-level: 0 # no compression From a5cf5847ca92babac7e060ff6cd978e489b13b2c Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 09:10:15 +0100 Subject: [PATCH 28/52] Add more connectors to zip --- Build/Consts.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Build/Consts.cs b/Build/Consts.cs index 835a8300fd..780982be31 100644 --- a/Build/Consts.cs +++ b/Build/Consts.cs @@ -3,12 +3,11 @@ public static class Consts { public static readonly string[] Solutions = { "DUI3-DX.slnf" }; - public static readonly string[] Frameworks = { "net48" }; public static readonly (string, string)[] Projects = { + ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.ArcGIS3", "net6.0-windows"), + ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Autocad", "net48"), ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023", "net48"), - ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.ArcGIS3", "net48") + ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Rhino7", "net48") }; - - public static readonly string Root = "C:\\Users\\adam\\Git\\speckle-sharp"; } From 328322a5639a969505caee7d7b7a79624c695312 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 09:18:42 +0100 Subject: [PATCH 29/52] fix connectors :( --- Build/Consts.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Build/Consts.cs b/Build/Consts.cs index 780982be31..14320404ce 100644 --- a/Build/Consts.cs +++ b/Build/Consts.cs @@ -5,9 +5,9 @@ public static class Consts public static readonly string[] Solutions = { "DUI3-DX.slnf" }; public static readonly (string, string)[] Projects = { - ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.ArcGIS3", "net6.0-windows"), - ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Autocad", "net48"), + ("DUI3-DX\\Connectors\\ArcGIS\\Speckle.Connectors.ArcGIS3", "net6.0-windows"), + ("DUI3-DX\\Connectors\\Autocad\\Speckle.Connectors.Autocad", "net48"), ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023", "net48"), - ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Rhino7", "net48") + ("DUI3-DX\\Connectors\\Rhino\\Speckle.Connectors.Rhino7", "net48") }; } From 4801bc83a72a74097c9c6e761849521b9eb6732a Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 09:44:20 +0100 Subject: [PATCH 30/52] fix autocad --- Build/Consts.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/Consts.cs b/Build/Consts.cs index 14320404ce..65a4abf7e1 100644 --- a/Build/Consts.cs +++ b/Build/Consts.cs @@ -6,7 +6,7 @@ public static class Consts public static readonly (string, string)[] Projects = { ("DUI3-DX\\Connectors\\ArcGIS\\Speckle.Connectors.ArcGIS3", "net6.0-windows"), - ("DUI3-DX\\Connectors\\Autocad\\Speckle.Connectors.Autocad", "net48"), + ("DUI3-DX\\Connectors\\Autocad\\Speckle.Connectors.Autocad2023", "net48"), ("DUI3-DX\\Connectors\\Revit\\Speckle.Connectors.Revit2023", "net48"), ("DUI3-DX\\Connectors\\Rhino\\Speckle.Connectors.Rhino7", "net48") }; From 71f3a0d6adfc114b973dc3c1dfe86b53684f2100 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 11:30:21 +0100 Subject: [PATCH 31/52] first pass of triggering action with upload/download --- .github/workflows/dotnet.yml | 11 +++++++++-- Build/Github.cs | 14 ++++++++++---- Build/Program.cs | 10 ++++++---- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 142ab4e8f6..e74eb1ab39 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -3,7 +3,8 @@ name: .NET Build and Publish on: pull_request: branches: ["dui3/alpha", "dui3/ci/github-actions-test"] - +permissions: + actions: write jobs: build-and-publish: runs-on: windows-latest @@ -41,6 +42,12 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: artifact + name: output.zip path: output/*.* compression-level: 0 # no compression + + - name: Build Installers + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RUN_ID: ${{ github.run_id }} + run: ./build.ps1 build-installers diff --git a/Build/Github.cs b/Build/Github.cs index ceac346bc3..d6d9a93a16 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Collections.Generic; +using System.Threading.Tasks; using Octokit; using Octokit.Internal; @@ -7,13 +8,18 @@ namespace Build; public static class Github { private static GitHubClient GetClient(string secret) => - new(new Octokit.ProductHeaderValue("Speckle.build"), new InMemoryCredentialStore(new Credentials(secret))); + new(new ProductHeaderValue("Speckle.build"), new InMemoryCredentialStore(new Credentials(secret))); - public static async Task TriggerWorkflow(string secret, string workflowFileName) + public static async Task BuildInstallers(string secret, string runId) { var client = GetClient(secret); await client.Actions.Workflows - .CreateDispatch("specklesystems", "connector-installers", workflowFileName, new CreateWorkflowDispatch("main")) + .CreateDispatch( + "specklesystems", + "connector-installers", + "build_installers.yml", + new CreateWorkflowDispatch("main") { Inputs = new Dictionary() { { "run_id", runId } } } + ) .ConfigureAwait(false); } } diff --git a/Build/Program.cs b/Build/Program.cs index 4cf124460c..e76466bdf3 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; -using System.Threading.Tasks; using Build; using GlobExpressions; using static Bullseye.Targets; @@ -14,7 +13,7 @@ const string TEST = "test"; const string FORMAT = "format"; const string ZIP = "zip"; -const string TRIGGER_WORKFLOW = "trigger-workflow"; +const string BUILD_INSTALLERS = "build-installers"; Target( CLEAN, @@ -105,10 +104,13 @@ IEnumerable GetFiles(string d) ); Target( - TRIGGER_WORKFLOW, + BUILD_INSTALLERS, async () => { - await Task.CompletedTask.ConfigureAwait(false); + var token = Environment.GetEnvironmentVariable("GITHUB_TOKEN"); + var runId = Environment.GetEnvironmentVariable("RUN_ID"); + Console.WriteLine($"Found: {runId} and {string.IsNullOrEmpty(token)}"); + await Github.BuildInstallers(token, runId).ConfigureAwait(false); } ); From 56071d23eb2a8d12001043f173fd050dcb1f809e Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 11:43:35 +0100 Subject: [PATCH 32/52] Octokit doesn't have dispatch event we want? --- Build/Build.csproj | 1 - Build/Github.cs | 39 ++++++++++++++++++++++++--------------- Build/packages.lock.json | 6 ------ 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Build/Build.csproj b/Build/Build.csproj index 71e5acf99b..ab3cdcd6e1 100644 --- a/Build/Build.csproj +++ b/Build/Build.csproj @@ -7,7 +7,6 @@ - diff --git a/Build/Github.cs b/Build/Github.cs index d6d9a93a16..ea50611fe9 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -1,25 +1,34 @@ -using System.Collections.Generic; +using System; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Mime; +using System.Text.Json; using System.Threading.Tasks; -using Octokit; -using Octokit.Internal; namespace Build; public static class Github { - private static GitHubClient GetClient(string secret) => - new(new ProductHeaderValue("Speckle.build"), new InMemoryCredentialStore(new Credentials(secret))); - public static async Task BuildInstallers(string secret, string runId) { - var client = GetClient(secret); - await client.Actions.Workflows - .CreateDispatch( - "specklesystems", - "connector-installers", - "build_installers.yml", - new CreateWorkflowDispatch("main") { Inputs = new Dictionary() { { "run_id", runId } } } - ) - .ConfigureAwait(false); + 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() + { + RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), + Headers = { Authorization = new AuthenticationHeaderValue($"Bearer {secret}") }, + 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); + } } } diff --git a/Build/packages.lock.json b/Build/packages.lock.json index f67663ca4e..52565140d1 100644 --- a/Build/packages.lock.json +++ b/Build/packages.lock.json @@ -14,12 +14,6 @@ "resolved": "1.1.9", "contentHash": "AfK5+ECWYTP7G3AAdnU8IfVj+QpGjrh9GC2mpdcJzCvtQ4pnerAGwHsxJ9D4/RnhDUz2DSzd951O/lQjQby2Sw==" }, - "Octokit": { - "type": "Direct", - "requested": "[11.0.1, )", - "resolved": "11.0.1", - "contentHash": "fpwF/DxMJyGS+pIXDKQozx0wCIpOfG8VDr10ls+m9Gn9Lz8GslhhApxkKD9JCNO60HRUeMJsedsAS24gCjTD7Q==" - }, "SimpleExec": { "type": "Direct", "requested": "[12.0.0, )", From 2aeecdfcfea050188da38cd5f7239a42aca4aa47 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 12:56:55 +0100 Subject: [PATCH 33/52] remove steps to better try secrets --- .github/workflows/dotnet.yml | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e74eb1ab39..52626d34f9 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -18,36 +18,8 @@ jobs: with: dotnet-version: 7.x.x - - 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: ./build.ps1 build - - - name: Pack - run: ./build.ps1 zip - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: output.zip - path: output/*.* - compression-level: 0 # no compression - - name: Build Installers env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | sed 's/./& /g' RUN_ID: ${{ github.run_id }} run: ./build.ps1 build-installers From ca9cd652afdd55ef128c51e47af2ae8b267d9d21 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 13:03:02 +0100 Subject: [PATCH 34/52] try another way to get the secret --- .github/workflows/dotnet.yml | 7 +++++-- Build/Program.cs | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 52626d34f9..bdbae4f2db 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -17,9 +17,12 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 7.x.x - + - name: Set up secret file + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo $GITHUB_TOKEN >> secrets.txt - name: Build Installers env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | sed 's/./& /g' RUN_ID: ${{ github.run_id }} run: ./build.ps1 build-installers diff --git a/Build/Program.cs b/Build/Program.cs index e76466bdf3..847f5bc26e 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -107,9 +107,9 @@ IEnumerable GetFiles(string d) BUILD_INSTALLERS, async () => { - var token = Environment.GetEnvironmentVariable("GITHUB_TOKEN"); + var token = File.ReadAllText("secrets.txt"); var runId = Environment.GetEnvironmentVariable("RUN_ID"); - Console.WriteLine($"Found: {runId} and {string.IsNullOrEmpty(token)}"); + Console.WriteLine($"Found: {runId} and {token.Length}"); await Github.BuildInstallers(token, runId).ConfigureAwait(false); } ); From 739898b2ab515962dfc95641c041fc5439aa57f2 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 13:13:58 +0100 Subject: [PATCH 35/52] trying more with secrets --- .github/workflows/dotnet.yml | 10 +++++----- Build/Program.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index bdbae4f2db..b07bc5bf72 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -17,11 +17,11 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 7.x.x - - name: Set up secret file - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo $GITHUB_TOKEN >> secrets.txt + + - name: Make envfile + uses: SpicyPizza/create-envfile@v2.0 + with: + envkey_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build Installers env: RUN_ID: ${{ github.run_id }} diff --git a/Build/Program.cs b/Build/Program.cs index 847f5bc26e..291153a42f 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -107,7 +107,7 @@ IEnumerable GetFiles(string d) BUILD_INSTALLERS, async () => { - var token = File.ReadAllText("secrets.txt"); + var token = File.ReadAllText(".env"); var runId = Environment.GetEnvironmentVariable("RUN_ID"); Console.WriteLine($"Found: {runId} and {token.Length}"); await Github.BuildInstallers(token, runId).ConfigureAwait(false); From ca223275fa8dffc5645ca180eff515d74cf81d8a Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 13:19:41 +0100 Subject: [PATCH 36/52] parse env files --- Build/EnvFile.cs | 33 +++++++++++++++++++++++++++++++++ Build/Program.cs | 3 ++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Build/EnvFile.cs diff --git a/Build/EnvFile.cs b/Build/EnvFile.cs new file mode 100644 index 0000000000..ed940eb5f0 --- /dev/null +++ b/Build/EnvFile.cs @@ -0,0 +1,33 @@ +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); + string? line; + while ((line = reader.ReadLine()) != null) + { + 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/Program.cs b/Build/Program.cs index 291153a42f..0adda756f5 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -107,7 +107,8 @@ IEnumerable GetFiles(string d) BUILD_INSTALLERS, async () => { - var token = File.ReadAllText(".env"); + var data = EnvFile.Parse(".env"); + var token = data["TOKEN"]; var runId = Environment.GetEnvironmentVariable("RUN_ID"); Console.WriteLine($"Found: {runId} and {token.Length}"); await Github.BuildInstallers(token, runId).ConfigureAwait(false); From 79e019ecf0eecf0e94f05b81b2672064bf2bfe21 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 13:25:14 +0100 Subject: [PATCH 37/52] will it work? who knows? --- Build/Github.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/Github.cs b/Build/Github.cs index ea50611fe9..2ae81230c8 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -21,7 +21,7 @@ public static async Task BuildInstallers(string secret, string runId) var request = new HttpRequestMessage() { RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), - Headers = { Authorization = new AuthenticationHeaderValue($"Bearer {secret}") }, + Headers = { Authorization = new AuthenticationHeaderValue($"Token {secret}") }, Content = content }; request.Headers.Add("X-GitHub-Api-Version", "2022-11-28"); From c3cc1aca7866878170bf02b8c74cbad7a53c8afb Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 13:30:53 +0100 Subject: [PATCH 38/52] print a secret? --- Build/Build.csproj | 1 + Build/EnvFile.cs | 3 +-- Build/Github.cs | 4 ++-- Build/Program.cs | 6 +++++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Build/Build.csproj b/Build/Build.csproj index ab3cdcd6e1..74408729a7 100644 --- a/Build/Build.csproj +++ b/Build/Build.csproj @@ -3,6 +3,7 @@ Exe net7.0 + enable diff --git a/Build/EnvFile.cs b/Build/EnvFile.cs index ed940eb5f0..0734d8dfb9 100644 --- a/Build/EnvFile.cs +++ b/Build/EnvFile.cs @@ -17,8 +17,7 @@ public static Dictionary Parse(string path) } using var reader = File.OpenText(path); - string? line; - while ((line = reader.ReadLine()) != null) + while (reader.ReadLine() is { } line) { var values = line.Split("=", StringSplitOptions.RemoveEmptyEntries); if (values.Length < 2) diff --git a/Build/Github.cs b/Build/Github.cs index 2ae81230c8..f4b81b17ec 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -9,7 +9,7 @@ namespace Build; public static class Github { - public static async Task BuildInstallers(string secret, string runId) + 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 } }; @@ -21,7 +21,7 @@ public static async Task BuildInstallers(string secret, string runId) var request = new HttpRequestMessage() { RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), - Headers = { Authorization = new AuthenticationHeaderValue($"Token {secret}") }, + Headers = { Authorization = new AuthenticationHeaderValue($"Token {token}") }, Content = content }; request.Headers.Add("X-GitHub-Api-Version", "2022-11-28"); diff --git a/Build/Program.cs b/Build/Program.cs index 0adda756f5..b4d837ed5e 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -110,7 +110,11 @@ IEnumerable GetFiles(string d) var data = EnvFile.Parse(".env"); var token = data["TOKEN"]; var runId = Environment.GetEnvironmentVariable("RUN_ID"); - Console.WriteLine($"Found: {runId} and {token.Length}"); + if (runId is null) + { + throw new InvalidOperationException(); + } + Console.WriteLine($"Found: {runId} and {token}"); await Github.BuildInstallers(token, runId).ConfigureAwait(false); } ); From cc46525e07a4a9c9430c6784212db5cc6dc63750 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 13:42:03 +0100 Subject: [PATCH 39/52] maybe fixed token usage --- Build/Github.cs | 2 +- Build/Program.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Build/Github.cs b/Build/Github.cs index f4b81b17ec..73bafe4438 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -21,7 +21,7 @@ public static async Task BuildInstallers(string token, string runId) var request = new HttpRequestMessage() { RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), - Headers = { Authorization = new AuthenticationHeaderValue($"Token {token}") }, + Headers = { Authorization = new AuthenticationHeaderValue("Token", token) }, Content = content }; request.Headers.Add("X-GitHub-Api-Version", "2022-11-28"); diff --git a/Build/Program.cs b/Build/Program.cs index b4d837ed5e..266ee69271 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -114,7 +114,6 @@ IEnumerable GetFiles(string d) { throw new InvalidOperationException(); } - Console.WriteLine($"Found: {runId} and {token}"); await Github.BuildInstallers(token, runId).ConfigureAwait(false); } ); From aa08e4192e132394140d86c3ef7cc0d0c6d283be Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 13:49:46 +0100 Subject: [PATCH 40/52] use PAT? --- .github/workflows/dotnet.yml | 2 +- Build/Github.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b07bc5bf72..76da6dfa25 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -21,7 +21,7 @@ jobs: - name: Make envfile uses: SpicyPizza/create-envfile@v2.0 with: - envkey_TOKEN: ${{ secrets.GITHUB_TOKEN }} + envkey_TOKEN: ${{ secrets.ADAM_BUILD_TOKEN }} - name: Build Installers env: RUN_ID: ${{ github.run_id }} diff --git a/Build/Github.cs b/Build/Github.cs index 73bafe4438..cb1902b918 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -21,7 +21,7 @@ public static async Task BuildInstallers(string token, string runId) var request = new HttpRequestMessage() { RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), - Headers = { Authorization = new AuthenticationHeaderValue("Token", token) }, + Headers = { Authorization = new AuthenticationHeaderValue("Bearer", token) }, Content = content }; request.Headers.Add("X-GitHub-Api-Version", "2022-11-28"); From 29734f55eae5c28a59cfd583059718640e587f1a Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 14:13:46 +0100 Subject: [PATCH 41/52] don't use env file --- .github/workflows/dotnet.yml | 8 +------- Build/Program.cs | 18 +++++++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 76da6dfa25..01425fef0c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -18,11 +18,5 @@ jobs: with: dotnet-version: 7.x.x - - name: Make envfile - uses: SpicyPizza/create-envfile@v2.0 - with: - envkey_TOKEN: ${{ secrets.ADAM_BUILD_TOKEN }} - name: Build Installers - env: - RUN_ID: ${{ github.run_id }} - run: ./build.ps1 build-installers + run: ./build.ps1 build-installers ${{ secrets.ADAM_BUILD_TOKEN }} ${{ github.run_id }} diff --git a/Build/Program.cs b/Build/Program.cs index 266ee69271..3ffbec8258 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; +using System.Linq; using Build; using GlobExpressions; using static Bullseye.Targets; @@ -15,6 +16,14 @@ 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"), @@ -107,13 +116,8 @@ IEnumerable GetFiles(string d) BUILD_INSTALLERS, async () => { - var data = EnvFile.Parse(".env"); - var token = data["TOKEN"]; - var runId = Environment.GetEnvironmentVariable("RUN_ID"); - if (runId is null) - { - throw new InvalidOperationException(); - } + var token = arguments.First(); + var runId = arguments.Skip(1).First(); await Github.BuildInstallers(token, runId).ConfigureAwait(false); } ); From 915973dcad6e28184e31489b01ae97ae20c69ec0 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 14:19:11 +0100 Subject: [PATCH 42/52] add message to error --- Build/Github.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Build/Github.cs b/Build/Github.cs index cb1902b918..2aa6daae0d 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -28,7 +28,9 @@ public static async Task BuildInstallers(string token, string runId) var response = await client.SendAsync(request).ConfigureAwait(false); if (!response.IsSuccessStatusCode) { - throw new InvalidOperationException(response.StatusCode + response.ReasonPhrase); + throw new InvalidOperationException( + $"{response.StatusCode} {response.ReasonPhrase} {await response.Content.ReadAsStringAsync().ConfigureAwait(false)}" + ); } } } From ca77edabf6dbaa89bc7f7e8406a4211f5b57485f Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 14:22:50 +0100 Subject: [PATCH 43/52] add useragent --- Build/Github.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Build/Github.cs b/Build/Github.cs index 2aa6daae0d..993d6fe0ec 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -21,7 +21,11 @@ public static async Task BuildInstallers(string token, string runId) var request = new HttpRequestMessage() { RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), - Headers = { Authorization = new AuthenticationHeaderValue("Bearer", token) }, + Headers = + { + 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"); From 1f5f749a102d4e5c894fe7333fac922514c27351 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 14:49:17 +0100 Subject: [PATCH 44/52] try token again --- .github/workflows/dotnet.yml | 2 +- Build/Github.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 01425fef0c..7be8c2fbf5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -19,4 +19,4 @@ jobs: dotnet-version: 7.x.x - name: Build Installers - run: ./build.ps1 build-installers ${{ secrets.ADAM_BUILD_TOKEN }} ${{ github.run_id }} + run: ./build.ps1 build-installers ${{ secrets.GITHUB_TOKEN }} ${{ github.run_id }} diff --git a/Build/Github.cs b/Build/Github.cs index 993d6fe0ec..c0ad7bff85 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -23,7 +23,7 @@ public static async Task BuildInstallers(string token, string runId) RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), Headers = { - Authorization = new AuthenticationHeaderValue("Bearer", token), + Authorization = new AuthenticationHeaderValue("Token", token), UserAgent = { new ProductInfoHeaderValue("Speckle.build", "3.0.0") } }, Content = content From 45f69c29f7863a3ca595056c19d5f589d88a6123 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 14:52:51 +0100 Subject: [PATCH 45/52] docs say GH token is bearer --- Build/Github.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/Github.cs b/Build/Github.cs index c0ad7bff85..993d6fe0ec 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -23,7 +23,7 @@ public static async Task BuildInstallers(string token, string runId) RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), Headers = { - Authorization = new AuthenticationHeaderValue("Token", token), + Authorization = new AuthenticationHeaderValue("Bearer", token), UserAgent = { new ProductInfoHeaderValue("Speckle.build", "3.0.0") } }, Content = content From 82c46e0dded88a9077ade65f1808f2fddf8d0df3 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 14:55:15 +0100 Subject: [PATCH 46/52] ugh forgot to post --- Build/Github.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Build/Github.cs b/Build/Github.cs index 993d6fe0ec..652a8f3540 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -20,6 +20,7 @@ public static async Task BuildInstallers(string token, string runId) var request = new HttpRequestMessage() { + Method = HttpMethod.Post, RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), Headers = { From 22281f53860416e40c13c44352193b0861a855c0 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 15:01:15 +0100 Subject: [PATCH 47/52] error changed....try putting accept --- Build/Github.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Build/Github.cs b/Build/Github.cs index 652a8f3540..88624baf99 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -24,6 +24,7 @@ public static async Task BuildInstallers(string token, string runId) 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") } }, From 564003de77ee85825444fee7c22742e7a73771c1 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 15:12:41 +0100 Subject: [PATCH 48/52] try PAT again --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 7be8c2fbf5..01425fef0c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -19,4 +19,4 @@ jobs: dotnet-version: 7.x.x - name: Build Installers - run: ./build.ps1 build-installers ${{ secrets.GITHUB_TOKEN }} ${{ github.run_id }} + run: ./build.ps1 build-installers ${{ secrets.ADAM_BUILD_TOKEN }} ${{ github.run_id }} From 3c38210b9cc07b792c856a10b4c4a32e9ff616d9 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 15:15:51 +0100 Subject: [PATCH 49/52] change permissions check --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 01425fef0c..9bf056db31 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -4,7 +4,7 @@ on: pull_request: branches: ["dui3/alpha", "dui3/ci/github-actions-test"] permissions: - actions: write + contents: write jobs: build-and-publish: runs-on: windows-latest From 8601eb3e663d9644bd47e5d2272aea7af5f51cb5 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 15:19:25 +0100 Subject: [PATCH 50/52] change back to token --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 9bf056db31..92d476bd80 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -19,4 +19,4 @@ jobs: dotnet-version: 7.x.x - name: Build Installers - run: ./build.ps1 build-installers ${{ secrets.ADAM_BUILD_TOKEN }} ${{ github.run_id }} + run: ./build.ps1 build-installers ${{ secrets.GITHUB_TOKEN }} ${{ github.run_id }} From 65866960dd168c735926aa039b3617e8521da456 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 15:22:57 +0100 Subject: [PATCH 51/52] put back steps and PAT --- .github/workflows/dotnet.yml | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 92d476bd80..e1a4ed2751 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -17,6 +17,34 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 7.x.x - - - name: Build Installers - run: ./build.ps1 build-installers ${{ secrets.GITHUB_TOKEN }} ${{ github.run_id }} + + - 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: ./build.ps1 build + + - name: Pack + run: ./build.ps1 zip + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: output.zip + path: output/*.* + compression-level: 0 # no compression + + - name: Trigger Build Installers + run: ./build.ps1 build-installers ${{ secrets.ADAM_BUILD_TOKEN }} ${{ github.run_id }} From d0d7438c6f47f752c77fe7af47413f7296cc3a74 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 14 May 2024 15:41:50 +0100 Subject: [PATCH 52/52] switch to use token --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e1a4ed2751..4bab4061b3 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -47,4 +47,4 @@ jobs: compression-level: 0 # no compression - name: Trigger Build Installers - run: ./build.ps1 build-installers ${{ secrets.ADAM_BUILD_TOKEN }} ${{ github.run_id }} + run: ./build.ps1 build-installers ${{ secrets.CONNECTORS_GH_TOKEN }} ${{ github.run_id }}