From 293919defa15a2bb09095b8ddc3277215d179e2b Mon Sep 17 00:00:00 2001 From: Callum Sykes <28632338+clicketyclackety@users.noreply.github.com> Date: Sun, 16 Jul 2023 09:08:20 -0700 Subject: [PATCH 1/4] Added Rhino Installer Cache --- src/commands/setup_rhino.yml | 20 ++++++++++++++++++++ src/scripts/cache_check.ps1 | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 src/scripts/cache_check.ps1 diff --git a/src/commands/setup_rhino.yml b/src/commands/setup_rhino.yml index a0e74c6..1e27a12 100644 --- a/src/commands/setup_rhino.yml +++ b/src/commands/setup_rhino.yml @@ -22,6 +22,17 @@ steps: name: Setup wget command: pip install wget + # https://support.circleci.com/hc/en-us/articles/115015426888-Clear-project-dependency-cache + - restore_cache: + name: Restore Rhino Install Cache + key: rhino-<>-<>-{{ .Environment.CACHE_VERSION }} + paths: + - "*.exe" + + - run: + name: Check for Cache + command: <> + - run: name: Download Rhino environment: @@ -29,7 +40,16 @@ steps: PARAM_FULLVERSION: <> PARAM_CULTURE: <> command: <> + when: on_fail + + - save_cache: + name: Cache Nuget Packages + key: rhino-<>-<>-{{ .Environment.CACHE_VERSION }} + paths: + - "*.exe" + when: always - run: name: Setup Rhino command: <> + when: always diff --git a/src/scripts/cache_check.ps1 b/src/scripts/cache_check.ps1 new file mode 100644 index 0000000..785aa08 --- /dev/null +++ b/src/scripts/cache_check.ps1 @@ -0,0 +1,4 @@ +$no_rhino = (Get-ChildItem *.exe).Length -eq 0 +$exit_code = if ($no_rhino) { 1 } else { 0 } +Write-Host $exit_code +exit $exit_code \ No newline at end of file From df7b70140abfce7708122cb03e9130e5d5157794 Mon Sep 17 00:00:00 2001 From: Callum Sykes <28632338+clicketyclackety@users.noreply.github.com> Date: Sun, 16 Jul 2023 09:19:25 -0700 Subject: [PATCH 2/4] Improved cache check --- src/commands/setup_rhino.yml | 7 ------- src/scripts/download.ps1 | 13 +++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/commands/setup_rhino.yml b/src/commands/setup_rhino.yml index 1e27a12..ab8e350 100644 --- a/src/commands/setup_rhino.yml +++ b/src/commands/setup_rhino.yml @@ -29,10 +29,6 @@ steps: paths: - "*.exe" - - run: - name: Check for Cache - command: <> - - run: name: Download Rhino environment: @@ -40,16 +36,13 @@ steps: PARAM_FULLVERSION: <> PARAM_CULTURE: <> command: <> - when: on_fail - save_cache: name: Cache Nuget Packages key: rhino-<>-<>-{{ .Environment.CACHE_VERSION }} paths: - "*.exe" - when: always - run: name: Setup Rhino command: <> - when: always diff --git a/src/scripts/download.ps1 b/src/scripts/download.ps1 index 1bdb8a0..53cdfb9 100644 --- a/src/scripts/download.ps1 +++ b/src/scripts/download.ps1 @@ -6,5 +6,18 @@ Write-Host $ENV:PARAM_VERSION Write-Host $ENV:PARAM_FULLVERSION Write-Host $ENV:PARAM_CULTURE +$version_file = "rhino_$ENV:PARAM_VERSION`_$ENV:PARAM_FULLVERSION" +try +{ + $no_rhino = (Get-ChildItem $version_file).Length -eq 0 + if ($no_rhino) + { + Write-Host "Cache for $version_file.exe was found, skipping download." + exit 0 + } +} catch {} + +Write-Host "No Cache found, Downloading!" + ## https://github.com/mcneel/compute.rhino3d/blob/7.x/script/update-rhino.ps1 python rhino-setup/py/download-rhino.py -v $ENV:PARAM_VERSION -fv $ENV:PARAM_FULLVERSION -c $ENV:PARAM_CULTURE \ No newline at end of file From 1588b324b2322d654c36ce5e778c7b6fd25a3748 Mon Sep 17 00:00:00 2001 From: Callum Sykes <28632338+clicketyclackety@users.noreply.github.com> Date: Sun, 16 Jul 2023 09:36:31 -0700 Subject: [PATCH 3/4] Updated cache calls --- .gitignore | 5 ++++- src/commands/setup_rhino.yml | 4 ++-- src/scripts/download.ps1 | 16 ++++++++-------- src/scripts/install.ps1 | 7 ++++++- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 3c88c1b..54cf105 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ # orb.yml is "packed" from source, and not published directly from the repository. orb.yml -.DS_Store \ No newline at end of file +.DS_Store + +# cloned cache +rhino-setup/ \ No newline at end of file diff --git a/src/commands/setup_rhino.yml b/src/commands/setup_rhino.yml index ab8e350..062e911 100644 --- a/src/commands/setup_rhino.yml +++ b/src/commands/setup_rhino.yml @@ -27,7 +27,7 @@ steps: name: Restore Rhino Install Cache key: rhino-<>-<>-{{ .Environment.CACHE_VERSION }} paths: - - "*.exe" + - "./rhino-setup/py/*.exe" - run: name: Download Rhino @@ -41,7 +41,7 @@ steps: name: Cache Nuget Packages key: rhino-<>-<>-{{ .Environment.CACHE_VERSION }} paths: - - "*.exe" + - "./rhino-setup/py/*.exe" - run: name: Setup Rhino diff --git a/src/scripts/download.ps1 b/src/scripts/download.ps1 index 53cdfb9..c2f93c8 100644 --- a/src/scripts/download.ps1 +++ b/src/scripts/download.ps1 @@ -1,18 +1,18 @@ #!powershell.exe -ExecutionPolicy Bypass -Write-Host "This is powershell!" +Write-Host "VERS: $ENV:PARAM_VERSION" +Write-Host "FULL: $ENV:PARAM_FULLVERSION" +Write-Host "CULT: $ENV:PARAM_CULTURE" -Write-Host $ENV:PARAM_VERSION -Write-Host $ENV:PARAM_FULLVERSION -Write-Host $ENV:PARAM_CULTURE +$base_dir = (Get-Item(Get-Item $PSScriptRoot).Parent).Parent.FullName +$version_file = "rhino_$ENV:PARAM_VERSION`_$ENV:PARAM_FULLVERSION.exe" +$version_filepath = "$base_dir\rhino-setup\py\$version_file" -$version_file = "rhino_$ENV:PARAM_VERSION`_$ENV:PARAM_FULLVERSION" try { - $no_rhino = (Get-ChildItem $version_file).Length -eq 0 - if ($no_rhino) + if (Test-Path $version_filepath) { - Write-Host "Cache for $version_file.exe was found, skipping download." + Write-Host "Cache for $version_file was found, skipping download." exit 0 } } catch {} diff --git a/src/scripts/install.ps1 b/src/scripts/install.ps1 index dd57376..eaa1f36 100644 --- a/src/scripts/install.ps1 +++ b/src/scripts/install.ps1 @@ -12,7 +12,12 @@ Write-Host = $token.Length python rhino-setup/py/install-rhino.py -l CORE -tk $token # show the install(s) -Get-ChildItem 'C:\Program Files\Rhino *\System\*.exe' +$installs = Get-ChildItem 'C:\Program Files\Rhino *\System\*.exe' +if ($installs -eq 0) +{ + Write-Host "No Rhino install found!" + exit 1 +} # Remove any download cache Remove-Item *.exe \ No newline at end of file From 14056d59bc3ad3b305cb1c7e420ff36d541d867e Mon Sep 17 00:00:00 2001 From: Callum Sykes <28632338+clicketyclackety@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:28:03 -0700 Subject: [PATCH 4/4] cache test --- src/commands/setup_rhino.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/setup_rhino.yml b/src/commands/setup_rhino.yml index 062e911..da6c7fa 100644 --- a/src/commands/setup_rhino.yml +++ b/src/commands/setup_rhino.yml @@ -27,7 +27,7 @@ steps: name: Restore Rhino Install Cache key: rhino-<>-<>-{{ .Environment.CACHE_VERSION }} paths: - - "./rhino-setup/py/*.exe" + - "./rhino-setup/" - run: name: Download Rhino @@ -41,7 +41,7 @@ steps: name: Cache Nuget Packages key: rhino-<>-<>-{{ .Environment.CACHE_VERSION }} paths: - - "./rhino-setup/py/*.exe" + - "./rhino-setup/" - run: name: Setup Rhino